Skip to content
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

Point source refactoring #338

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sibirrer
Copy link
Collaborator

The current convention for the point source amplitudes are 'point_amp' for amplitudes in the image plane and 'source_amp' for amplitudes in the source plane. This lead to confusions about in what plane the amplitudes are defined, since this convention could be equally applied to 'SOURCE_POSITION' and 'LENSED_POSITION' point source models.

This PR suggests to rename 'point_amp' -> 'image_amp'. This would require a non-backwards compatible change but might provide more clarity moving forward. Suggestions are welcomed.

@sibirrer sibirrer requested a review from ajshajib August 14, 2022 20:15
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2857037590

  • 22 of 22 (100.0%) changed or added relevant lines in 6 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 96.829%

Totals Coverage Status
Change from base Build 2841972003: 0.0%
Covered Lines: 17621
Relevant Lines: 18198

💛 - Coveralls

@sibirrer sibirrer requested a review from smericks August 18, 2022 22:20
Copy link
Collaborator

@smericks smericks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some suggestions for documentation details. I also suggested to give a more informative key error message for 'source_amp' vs 'image_amp'. Overall, I do agree that image_amp makes more sense than point_amp.

@@ -8,7 +8,7 @@ class LensedPositions(PSBase):
"""
class of a a lensed point source parameterized as the (multiple) observed image positions
Name within the PointSource module: 'LENSED_POSITION'
parameters: ra_image, dec_image, point_amp
parameters: ra_image, dec_image, source_amp/source_amp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to image_amp/source_amp

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful to explicitly write "source_amp is the amplitude of the point source in the source plane. image_amp are the amplitudes of the point source images in the image plane. When fixed_magnification=True, use source_amp. Otherwise, use image_amp" (in source_position as well)

@@ -11,7 +11,7 @@ class of a single point source defined in the original source coordinate positio

Name within the PointSource module: 'SOURCE_POSITION'
parameters: ra_source, dec_source, source_amp, mag_pert (optional)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to " parameters: ... image_amp/source_amp" to match lensed_position.py

@@ -76,7 +76,7 @@ def image_amplitude(self, kwargs_ps, kwargs_lens=None, x_pos=None, y_pos=None, m
mag = self._lens_model.magnification(ra_image, dec_image, kwargs_lens)
point_amp = kwargs_ps['source_amp'] * np.abs(mag)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way to throw an informative error before trying to access kwargs_ps['source_amp']? i.e. check for both self.fixed_magnification = True and the existence of the 'source_amp' key before trying to access it? And also check the opposite for self.fixed_magnification = False and 'image_amp'. This might be difficult because you would have to put this in every function that uses kwargs_ps...

@ajshajib
Copy link
Collaborator

@sibirrer, are you by the way waiting for my review at this point? As I saw that @smericks already requested changes, I was waiting for changes from you before I start my review. But, I can also do the review if you prefer it now.

@sibirrer
Copy link
Collaborator Author

@ajshajib : ah, not yet. It's on my todo list and then I re-post it to Sydney. This branch currently also has conflicts that need to be resolved. Since this current proposed change is not backwards compatible, I was thinking of merging this instead into an other beta_release branch where we might accumulate multiple features/conventions that are not backward compatible but generally a good idea to change

@ajshajib
Copy link
Collaborator

@ajshajib : ah, not yet. It's on my todo list and then I re-post it to Sydney. This branch currently also has conflicts that need to be resolved. Since this current proposed change is not backwards compatible, I was thinking of merging this instead into an other beta_release branch where we might accumulate multiple features/conventions that are not backward compatible but generally a good idea to change

Ok, got it. No worries or rush from my side. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants