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

DM-41027: Fix potential infinite loop in analysis_drp colorColorFitPlot #73

Merged
merged 3 commits into from Oct 24, 2023

Conversation

laurenam
Copy link
Contributor

No description provided.

Copy link
Contributor

@taranu taranu left a 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,
Copy link
Contributor

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?

Copy link
Contributor Author

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]
Copy link
Contributor

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.

Copy link
Contributor Author

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.
@laurenam laurenam merged commit 6852990 into main Oct 24, 2023
2 checks passed
@laurenam laurenam deleted the tickets/DM-41027 branch October 24, 2023 04:15
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