Skip to content

DM-42115: Add check for setting minimum number of detectors larger than the cam… #115

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions python/lsst/fgcmcal/fgcmFitCycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,20 @@ def _fgcmFitCycle(self, camera, handleDict, config=None):
else:
_config = self.config

# We need to validate a few configs here after we have the
# camera, to ensure the minimum number of ccds is not
# more than the number of detectors in the camera.
if _config.ccdGrayFocalPlaneFitMinCcd > len(camera):
raise ValueError(
f"Cannot set ccdGrayFocalPlaneFitMinCcd ({_config.ccdGrayFocalPlaneFitMinCcd}) "
f"greater than the number of camera detectors ({len(camera)}).",
)
if _config.minCcdPerExp > len(camera):
raise ValueError(
f"Cannot set minCcdPerExp ({_config.minCcdPerExp}) greater than the number of "
f"camera detectors ({len(camera)}).",
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a fan of including the numbers in the logs message (i.e num requested vs. num actually in camera). And I was also wondering whether, given the large variety in number of detectors/camera, it would be better to make minCcdPerExp a fraction (with some non-zero minimum) rather than absolute number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numbers added. I don't want to change the meanings of these things because it's a fraction of what (total or science ccds)? But this is just a "sanity check" to make sure things are not crazy.

# Set defaults on whether to output standards and zeropoints
self.maxIter = _config.maxIterBeforeFinalCycle
self.outputStandards = _config.outputStandardsBeforeFinalCycle
Expand Down
1 change: 1 addition & 0 deletions tests/config/fgcmFitCycleLatiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
config.requiredBands = ["g", "r"]
# Do 5 iterations in multi-cycle run mode.
config.maxIterBeforeFinalCycle = 5
config.minCcdPerExp = 1
config.nCore = 1
config.cycleNumber = 0
config.utBoundary = 0.0
Expand Down