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-43593: Use FieldValidationError to improve error reporting for slots #279

Merged
merged 1 commit into from
Aug 7, 2024
Merged
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
19 changes: 16 additions & 3 deletions python/lsst/meas/base/baseMeasurement.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,30 @@ def validate(self):
if self._ignoreSlotPluginChecks:
return
if self.slots.centroid is not None and self.slots.centroid not in self.plugins.names:
raise ValueError("source centroid slot algorithm is not being run.")
raise lsst.pex.config.FieldValidationError(
self.__class__.slots,
self,
"source centroid slot algorithm is not being run."
)
if self.slots.shape is not None and self.slots.shape not in self.plugins.names:
raise ValueError("source shape slot algorithm '%s' is not being run." % self.slots.shape)
raise lsst.pex.config.FieldValidationError(
self.__class__.slots,
self,
"source shape slot algorithm '%s' is not being run." % self.slots.shape
)
for slot in (self.slots.psfFlux, self.slots.apFlux, self.slots.modelFlux,
self.slots.gaussianFlux, self.slots.calibFlux):
if slot is not None:
for name in self.plugins.names:
if len(name) <= len(slot) and name == slot[:len(name)]:
break
else:
raise ValueError("source instFlux slot algorithm '%s' is not being run." % slot)
raise lsst.pex.config.FieldValidationError(
self.__class__.slots,
self,
f"Source instFlux algorithm '{slot}' is not being run, required from "
f"non-None slots in: {self.slots}."
)


class BaseMeasurementTask(lsst.pipe.base.Task):
Expand Down
Loading