-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skeleton for cluster lens simulations #148
Conversation
…-packages/data as wanted by LensPop)
This reverts commit 8be0219. I've modified setup.py and the requirements for easyer installation on a non-LSST environment (local), but now I revert this as is not related with the purpose of this fork.
This reverts commit e1bffbd. I've modified setup.py and the requirements for easyer installation on a non-LSST environment (local), but now I revert this as is not related with the purpose of this fork.
…r Lens class modifications
…dir/site-packages/data as wanted by LensPop)" This reverts commit 887a653. Revert requirements
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #148 +/- ##
==========================================
+ Coverage 95.51% 95.65% +0.13%
==========================================
Files 38 39 +1
Lines 1896 1955 +59
==========================================
+ Hits 1811 1870 +59
Misses 85 85
|
for more information, see https://pre-commit.ci
… galaxy_cluster_lenses.py
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @furcelay , thank you very much for your PR. I have some major comments. GalaxyClusterLenses and ClusterLensPop are mostly duplicates of Lens and LensPop classes. I think you should start from the small steps. I encourage you to start from generating cluster deflector and sources for cluster lenses. and then, you can think about ClusterLens and ClusterLensPop (might be able to use existing classes with addition of some extra parameters). Please let me know if you have any questions!
slsim/Pipelines/cluster_pipeline.py
Outdated
@@ -0,0 +1,3 @@ | |||
class ClusterPipeline: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need this class. It would be great if you could delete this class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this class as it is not needed yet.
slsim/cluster_lens.py
Outdated
import warnings | ||
|
||
|
||
class ClusterLens(LensedSystemBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class has a lot of overlap with existing Lens() class. I think we can think about using existing Lens class or creating a Clusterlens() class only with functions which are not in Lens class. You can do this later (save this somewhere else and once you start working on this class, you can bring it back.). For now focus on creating a class to generate or manage cluster deflectors. Simon has implemented class to manage NFW and Hernquist mass model. Please look at them and see if they are useful for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the ClusterLens class and implemented NFWCluster
which is a new Deflector
subclass to manage clusters. It can work with the existing Lens
class by modifying the deflector_mass_model_lenstronomy
. Another way might be to handle the mass model in the Deflector
class and just call it from the Lens
class (see #156).
slsim/cluster_lens_pop.py
Outdated
from slsim.lensed_population_base import LensedPopulationBase | ||
|
||
|
||
class ClusterLensPop(LensedPopulationBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is exactly the same as LensPop() class. So, you can delete it and use LensPop() class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed this class
from slsim.Pipelines.cluster_pipeline import ClusterPipeline | ||
|
||
|
||
class TestClusterPipeline(object): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not need ClusterPipeline class. So, remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
tests/test_cluster_lens.py
Outdated
|
||
|
||
class TestClusterLens(object): | ||
# pytest.fixture(scope='class') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As ClusterLens class is a duplication of Lens class, these testing are also duplication of existing test functions. The best way is to start from the basic steps. I encourage you to start from cluster deflector class which will manage cluster deflector population.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
tests/test_cluster_lens_pop.py
Outdated
|
||
|
||
@pytest.fixture | ||
def gg_lens_pop_instance(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need these test functions if you remove ClusterLensPop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
… component (e.g. for a cluster)
for more information, see https://pre-commit.ci
I've removed the redundant or unneeded classes and implemented a new Deflector to handle clusters. This deflector is a NFW halo without a luminous component and subhalos that can be any other deflector (EPL+Sérsic or NFW+Hernquist). I've also implemented a new function to compute its line-of-sight velocity dispersion of the halo following Lokas & Mamon 2001 as it cannot be weighted by the light as in the NFW + Hernquist model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @furcelay looks very good and I am glad you could use most of the other classes for your cluster class. I have just a minor inquiry about the velocity dispersion. You calculate them for the NFW halo alone, just want to make sure that this is what you want
|
||
m_halo, c_halo = self.halo_properties | ||
rs_arcsec, _ = lens_cosmo.nfw_physical2angle(m_halo, c_halo) | ||
vel_disp = vel_disp_nfw_aperture( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the dispersion in the dark matter particles, or some light tracer particles? For a NFW+Hernquist model, we have a velocity dispersion routine (currently averaged to the half-light radius) in this routine:
def vel_disp_composite_model(r, m_star, rs_star, m_halo, c_halo, cosmo, z_lens): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sibirrer, indeed the velocity dispersion is the one of the dark matter particles without any light tracer. This is because the velocity dispersion of the dark matter halo of groups or clusters cannot be measured in the same way as galaxies. It is usually measured by the spread in the redshift of the subhalos within a radius and assuming the radial profile for the velocity dispersion from Łokas & Mamon 2001. So it should be consistent with the measured velocity dispersion with some considerations on the aperture radius.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @furcelay! I leave it to @nkhadka21 for the final review and merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @furcelay , thank you very miuch for this update! Looks very good. I have a minor comment. Please address it.
- 'z': redshift of deflector | ||
""" | ||
|
||
def __init__(self, deflector_dict, subhalos_list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add doc string for deflector_dict and subhalos_list. Clarify what subhalos_list should contain. Might be useful to explain how halo_EPl.fits and subhaloes_table.fits that you have added in TestData can be used in this class or you need to add full list of halos or subhalos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @nkhadka21, I've added the docstring for that method. Also included the fits files in test_nfw_cluster
to exemplify their use, both have an astropy table with the quantities to init the halo and subhalos respectively.
…ble.fits files to exemplify its use.
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@furcelay, thank you very much for the update! I approved it and excited to see your progress on other aspects of the cluster lens code!
Thank you! I hope to have more progress soon. |
This is the first pull following #134 and provides a skeleton of the classes described in that issue. The classes are empty except for
ClusterLens(LensBase)
which is partially implemented.ClusterLens
takes the parameters that describe a halo (by the time only EPL) and a table with the parameters of each subhalo and generates the Lenstronomy keywords to simulate the lens. This is exemplified in a new notebookcluster_lens.ipynb
.