-
Notifications
You must be signed in to change notification settings - Fork 13
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
Bug fix: Truncated Redshift distribution #59
Bug fix: Truncated Redshift distribution #59
Conversation
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.
Great catch! Looks like a good change, but I suggested some small modification to the naming / use of self. properties.
paltas/Sampling/distributions.py
Outdated
@@ -338,7 +338,7 @@ def __init__(self, z_lens_min,z_lens_mean,z_lens_std,z_source_min, | |||
z_source_mean,z_source_std): | |||
# transform z_lens_min, z_source_min to be in units of std. deviations | |||
self.z_lens_min = (z_lens_min - z_lens_mean) / z_lens_std | |||
self.z_source_min = (z_source_min - z_source_mean) / z_source_std | |||
self.z_source_min_default = (z_source_min - z_source_mean) / z_source_std |
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 would keep the original naming convention and instead change the object used in the call
paltas/Sampling/distributions.py
Outdated
@@ -355,8 +355,9 @@ def __call__(self): | |||
z_lens = self.z_lens_dist() | |||
clip = (z_lens - self.z_source_mean) / self.z_source_std | |||
# number of std. devs away to stop (negative) | |||
if(clip > self.z_source_min): | |||
if(clip > self.z_source_min_default): | |||
self.z_source_min = clip |
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.
z_source_min here instead of self.z_source_min would be a cleaner fix. In the current fix a new self.property is created during the call, which doesn't seem like optimal behavior since that property is never referenced outside the call.
I think changing the naming as I suggested should fix the merge conflict, but we can take another look if it doesn't |
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.
looks great!
Fix for minor bug for the RedshiftsTruncNorm class
Description of Bug:
The lower source redshift truncation value (self.z_source_min) is updated dependent on the lens redshift, but is not reset to the default/inputted value after each draw. Therefore the truncation value gradually increases as more draws are made.
Fix:
The lower truncation value is now set to the inputted value (self.z_source_min_default) in the cases that it is greater than the lens redshift.