-
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
Deflector mass method #171
Deflector mass method #171
Conversation
…tor classes, dependent on a lens cosmology. Lens class uses this method in deflector_mass_model_lenstronomy to obtain the model in a more simple and general way.
…eflector_mass_method # Conflicts: # slsim/lens.py
…on the other deflectors
…ector_mass_method
for more information, see https://pre-commit.ci
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
==========================================
- Coverage 95.66% 95.62% -0.05%
==========================================
Files 39 39
Lines 1985 2010 +25
==========================================
+ Hits 1899 1922 +23
- Misses 86 88 +2
|
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 very much @furcelay! I like this change. It though requires the consistent treatment of the source redshift but I think this is a better way of doing it in the respective classes.
For multiple source redshift, the lenstronomy LensModel() class has a z_source_convention argument and this is the one for which the single-plane equivalent source redshifts are defined in the mass models (so that's what you then need to do, i.e. LensCosmo(z_source=z_source_convention). And then you can have multiple sources with different redshifts appended to it
"""Returns lens model instance and parameters in lenstronomy conventions. | ||
|
||
:param lens_cosmo: lens cosmology model | ||
:type lens_cosmo: LensCosmo 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.
can you write this as ~lenstronomy.Cosmo.LensCosmo 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.
Corrected in the last commit
Thank you @sibirrer! I'll make sure to handle consistent treatment of the source redshift using |
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 This PR! I like these changes. I approve this PR. Looking forward to seeing your progress in multiple source with different redshift case.
This pull request adds a new method
mass_model_lenstronomy
to theDeflectorBase
,EPLSersic
,NFWHernquist
,NFWCluster
, andDeflector
classes. This method takes a LenstronomyLensCosmo
instance and returns the mass profile parameters for the deflector in Lenstronomy conventions.Although this method depends on a source redshift through the
LensCosmo
instance, it is not tied to a specific source. The results are not stored within the deflector, ensuring that it adheres to the class definition: "Class of a single deflector with quantities only related to the deflector (independent of the source)."The primary advantage of this addition is the simplification and generalization of the
deflector_mass_model_lenstronomy
method in theLens
class. This change removes the need for specific handling of each deflector type, especially theNFWCluster
, which would otherwise require constructing models for the halo and each subhalo within the function (issue #156). By incorporating this new method, these operations are now managed within theNFWCluster
and its subhalos, streamlining the process of implementing #134 and other new deflectors.