What’s the right/easy/best way (from Python) to get the MJD for a source catalog for particular visit?
For the full calexp, I can
dt = calexp.getInfo().getVisitInfo().getDate().toPython()
from astropy.time import Time
mjd = Time(dt).mjd
But if I have just the src catalog, the following doesn’t work:
In [51]: src.getMetadata().getDateTime()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-51-23e838d19621> in <module>
----> 1 src.getMetadata().getDateTime()
TypeError: getDateTime(): incompatible function arguments. The following argument types are supported:
1. (self: lsst.daf.base.propertyContainer.propertyList.PropertyList, name: str) -> lsst.daf.base.dateTime.dateTime.DateTime
2. (self: lsst.daf.base.propertyContainer.propertyList.PropertyList, name: str, defaultValue: lsst.daf.base.dateTime.dateTime.DateTime) -> lsst.daf.base.dateTime.dateTime.DateTime
Invoked with: <lsst.daf.base.propertyContainer.propertyList.PropertyList object at 0x2aaaaf4024c8>
Should I instead query directly the registry.sqlite3 file, or is there a light-weight way of pulling out the date from a calexp without triggering a read of the full image?
That returns a PropertyList and not something that inherently knows about date and time. I don’t know what keywords are defined in the PropertyList of catalogs though.
The metadata associated with the Exposure is the metadata of the SourceCatalog, so the answer is your (1), after butler.get('calexp_visitInfo', dataId), which only reads the header.
Also note that rather than going through Python and Astropy you can retrieve an MJD directly as calexp.getInfo().getVisitInfo().getDate().get(lsst.daf.base.DateTime.MJD) for TAI timescale or ...get(lsst.daf.base.DateTime.MJD, lsst.daf.base.DateTime.UTC) for UTC timescale.
To be pedantic, the MJD of mid-exposure varies from one side of the field to the other (by 1s according to the key numbers, or 0.98s from the youtube shutter video). For rapidly varying or moving objects this effect may be significant. Whether or not normal processing corrects for this, does the metadata include the traverse direction for the double-bladed shutter such that users can later correct for location in the focal plane? Otherwise successive exposures will see opposite edges leading and then trailing the mid-array mid-exposure MJD by 0.49s. Will MOPS include such a correction in astrometry submitted to MPC? How accurately will the mid-array mid-exposure MJD be measured aside from this mechanical constraint?
@RobSeaman Per the DPDD, each individual catalog measurement will have its own midPointTai time that corrects for the motion of the shutter. That time will be what’s used in reporting to the MPC, and users won’t need to apply the correction themselves. OSS-REQ-0087 gives the requirements on timing precision (1 ms) and accuracy (10 ms).