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

pspline: fix stdev_cut/max iteration bug #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lgbouma
Copy link

@lgbouma lgbouma commented Nov 7, 2021

Hi Michael,

Currently line 25 of pspline.py seems to iterate over stdev_cut. This leads to a TypeError when stdev_cut is a float (which generally should be allowed?).

More broadly, I think this might be a bug relative to earlier implementations of this routine, which had this line iterating over constants.SPLINES_MAXITER, which I think might be correct.

Thank you for creating and maintaining this very useful tool!
-Luke

Hi Michael,

Currently line 25 of pspline.py seems to iterate over stdev_cut. This leads to a TypeError when stdev_cut is a float (which generally should be allowed?).

More broadly, I think this might be a bug relative to earlier implementations of this routine, which had this line as for i in range(constants. PSPLINES_MAXITER):, which I think might be correct.

Thank you for creating and maintaining this very useful tool!
-Luke
@hippke
Copy link
Owner

hippke commented Nov 7, 2021

Hey Luke, thanks for bringing this up. It was indeed a feature request to change it to stdev_cut to make it user configurable. Would changing the loop to for i in range(int(stdev_cut)) be OK for your use case? Or is there a need to really go float?

@lgbouma
Copy link
Author

lgbouma commented Nov 7, 2021

Hi Michael, thanks for this response. I'm perhaps a bit confused. My understanding of the goal of this loop in pseudo-code is roughly

until we reach convergence:
    find and mask any outlier points outside of +/-*stdev_cut* sigma
    fit the pspline to the remaining points in the light curve
    check if in the residual there are any points outside of +/-*stdev_cut* sigma -- if there are any continue, else exit

If this is correct, why would iterate over range(int(stdev_cut)) instead of over range(constants.SPLINES_MAXITER))? I would think that convergence wouldn't be related to whether one selects 1-sigma, 2-sigma, etc, but would be better achieved by constants.SPLINES_MAXITER. I might be missing something here though!

[edit: fixed typo]

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

2 participants