Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-28329

Standardize on jyear or remove use of "EPOCH" header keys and schemas



    • Team:
      Alert Production
    • Urgent?:


      [{daf_base DateTime.h}} defines "EPOCH is Julian epoch year e.g. 2000.0 for J2000" (see DM-26429), while we discovered in DM-28258 that meas_algorithms loadReferenceObjects.py inserts an EPOCH keyword into the loaded refcat metadata with comment "Epoch (TAI MJD) for catalog". As Tim Jenness pointed out during the review of that ticket, there is a deprecated "EPOCH" header key defined in the FITS standard which was previously "equinox in years" but as of FITS version 1 (from 1993!) "shall not be used in FITS files created after the adoption of the standard; rather, the EQUINOX keyword shall be used." This prompted me to check on how we use the term "epoch" throughout the codebase.

      Changes needed

      meas_algorithms is what triggered this ticket with the "Epoch (TAI MJD)" metadata keyword. That header key should be changed to "EQUINOX" (check the FITS standard for details) and the saved value be a jyear, or changed to "MJD" if we want to keep storing it as MJD. I'd argue that EQUINOX jyear makes the most sense, because the units of proper motion are mas/year. I believe this header key is only used in joinMatchListWithCatalogImpl which sets epoch = matchmeta.getDouble('EPOCH') and then passes that directly to loadSkyCircle. This is clearly incorrect and would fail if actually used because loadSkyCircle expects an astropy.Time; we've apparently never followed that codepath because we've only ever used PS1 which didn't do PM corrections. The methods in the reference loaders that take an epoch kwarg all specify that they take an astropy.Time, which at least makes those uses unambiguous.

      dax_ppdb and sdm_schemas have radecTai and epoch, the former having ucd: time.epoch which does not help me determine its expected format, but may mean something in the database? These should be clarified in the docs and/or renamed.


      The below uses all should not need modification, but I've included them here for completeness.

      • meas_astrom has _getExposureMetadata which returns a Struct with an astropy.Time epoch, which is fine.
      • We also refer to "unix epoch" in various places, but I believe that meaning is clear enough with the "unix" prefix.
      • fgcmcal uses "epochMJD" which is clear that this is an MJD.
      • As part of the proper motion work, jointcal is already changing its use of "epoch" to be Julian Year (DM-24278).
      • There are numerous uses throughout the stack where "epoch" means "one single image at one point in time", which is also unambiguous.


          Issue Links


            There are no comments yet on this issue.


              Parejkoj John Parejko
              Parejkoj John Parejko
              Chris Morrison, Jim Bosch, John Parejko, Lauren MacArthur, Russell Owen, Tim Jenness
              0 Vote for this issue
              6 Start watching this issue



                  CI Builds

                  No builds found.