Skip to content

Commit

Permalink
Update covariance units
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsaunders committed Dec 9, 2022
1 parent d1bb8a0 commit b73e64c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions doc/lsst.meas.algorithms/reference-catalog-schema.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ The following are optional; fields should only be present if the information is
- ``parallax_flag``: set if parallax value or parallaxErr is bad
- ``coord_ra_pm_ra_Cov``: covariance between coord_ra and pm_ra (rad^2/year)
- ``coord_ra_pm_dec_Cov``: covariance between coord_ra and pm_dec (rad^2/year)
- ``coord_ra_parallax_Cov``: covariance between coord_ra and parallax (rad^2/year)
- ``coord_ra_parallax_Cov``: covariance between coord_ra and parallax (rad^2)
- ``coord_dec_pm_ra_Cov``: covariance between coord_dec and pm_ra (rad^2/year)
- ``coord_dec_pm_dec_Cov``: covariance between coord_dec and pm_dec (rad^2/year)
- ``coord_dec_parallax_Cov``: covariance between coord_dec and parallax (rad^2/year)
- ``coord_dec_parallax_Cov``: covariance between coord_dec and parallax (rad^2)
- ``pm_ra_parallax_Cov``: covariance between pm_ra and parallax (rad^2/year)
- ``pm_dec_parallax_Cov``: covariance between pm_dec and parallax (rad^2/year)
7 changes: 6 additions & 1 deletion python/lsst/meas/algorithms/convertReferenceCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,16 @@ def _makeSchema(filterNameList, *, addCentroid=False,
for j in range(i + 1, 5):
j_field = fields[j]
j_unit = units[j]
formatted_unit = "rad^2"
if ("year" in i_unit) and ("year" in j_unit):
formatted_unit += "/year^2"
elif ("year" in i_unit) or ("year" in j_unit):
formatted_unit += "/year"
schema.addField(
field=f"{i_field}_{j_field}_Cov",
type="F",
doc=f"uncertainty covariance between {i_field} and {j_field}",
units=f"{i_unit} {j_unit}"
units=formatted_unit
)
return schema

Expand Down
4 changes: 2 additions & 2 deletions tests/test_convertReferenceCatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def testMakeSchema_fullCovariance(self):
self.assertIn("pm_ra_parallax_Cov", refSchema)
self.assertIn("parallaxErr", refSchema)
self.assertEqual(refSchema['coord_raErr'].asField().getUnits(), "rad")
self.assertEqual(refSchema['coord_ra_coord_dec_Cov'].asField().getUnits(), "rad rad")
self.assertEqual(refSchema['coord_ra_coord_dec_Cov'].asField().getUnits(), "rad^2")
self.assertEqual(refSchema['pm_raErr'].asField().getUnits(), "rad/year")
self.assertEqual(refSchema['pm_dec_parallax_Cov'].asField().getUnits(), "rad/year rad")
self.assertEqual(refSchema['pm_dec_parallax_Cov'].asField().getUnits(), "rad^2/year")

def testCheckFluxUnits(self):
"""Test that we can identify old style fluxes in a schema."""
Expand Down

0 comments on commit b73e64c

Please sign in to comment.