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
DM-41027: Fix potential infinite loop in analysis_drp colorColorFitPlot #73
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.
See comments.
minPointsForFit = pexConfig.Field( | ||
doc="Minimum number of valid objects to bother attempting a fit.", | ||
dtype=int, | ||
default=5, |
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.
Does this need to be validated as > 0?
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.
Good idea. I made it a RangeField
and gave it min=1
.
@@ -305,10 +330,11 @@ def colorColorFitPlot(self, catPlot, plotInfo, fitParams): | |||
SNsUsed = (catPlot[SNBand + "_" + plotInfo["SNFlux"]].values[fitPoints] |
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.
Is it possible for SNsUsed to be empty? I imagine the fit likely would have failed in that case, but if there's a chance it would keep going and result in an infinite loop again, maybe an explicit check would be worthwhile.
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.
Another good idea. I put in a check on len(fitParams["fitPoints"])
above with:
if len(fitParams["fitPoints"]) < 1:
raise ValueError("No fitPoints for {}".format(dataId))
Also fixes a bug resulting in the wrong bands being used to calculate the effective magnitude maximum threshold.
a38d183
to
7dac2bc
Compare
No description provided.