Skip to content

Commit a1f12eb

Browse files
authored
Merge pull request #397 from lsst/tickets/DM-47124
DM-47124: Allow proper motion to be in rad units or have Angle type.
2 parents 65afce5 + c263a74 commit a1f12eb

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

python/lsst/meas/algorithms/loadReferenceObjects.py

+14-6
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,20 @@ def applyProperMotions(self, catalog, epoch):
233233
return
234234

235235
# Warn/raise for a catalog in an incorrect format, if epoch was specified.
236-
if ("pm_ra" in catalog.schema
237-
and not isinstance(catalog.schema["pm_ra"].asKey(), afwTable.KeyAngle)):
238-
if self.config.requireProperMotion:
239-
raise RuntimeError("requireProperMotion=True but refcat pm_ra field is not an Angle.")
240-
else:
241-
self.log.warning("Reference catalog pm_ra field is not an Angle; cannot apply proper motion.")
236+
if "pm_ra" in catalog.schema:
237+
pm_ra_radians = False
238+
field = catalog.schema["pm_ra"].asField()
239+
if field.getTypeString() == "Angle" or field.getUnits() == "rad":
240+
pm_ra_radians = True
241+
242+
if self.config.requireProperMotion and not pm_ra_radians:
243+
raise RuntimeError(
244+
"requireProperMotion=True but refcat pm_ra field is not an Angle or radians.",
245+
)
246+
elif not pm_ra_radians:
247+
self.log.warning(
248+
"Reference catalog pm_ra field is not an Angle or radians; cannot apply proper motion.",
249+
)
242250
return
243251

244252
if ("epoch" not in catalog.schema or "pm_ra" not in catalog.schema):

0 commit comments

Comments
 (0)