Skip to content

pspline: fix stdev_cut/max iteration bug#63

Open
lgbouma wants to merge 1 commit into
hippke:masterfrom
lgbouma:master
Open

pspline: fix stdev_cut/max iteration bug#63
lgbouma wants to merge 1 commit into
hippke:masterfrom
lgbouma:master

Conversation

@lgbouma
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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.

2 participants