How should one efficiently get the MJD for a source catalog?

visitinfo
mjd
Tags: #<Tag:0x00007f61a75b4b80> #<Tag:0x00007f61a75b42e8>

(Michael Wood-Vasey) #1

What’s the right/easy/best way (from Python) to get the MJD for a source catalog for particular visit?

  1. For the full calexp, I can
dt = calexp.getInfo().getVisitInfo().getDate().toPython()
from astropy.time import Time
mjd = Time(dt).mjd
  1. 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>
  1. 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?

(Tim Jenness) #2

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.


(Michael Wood-Vasey) #3

Nothing interesting:

In [5]: src.getMetadata().names()
Out[5]:
['NOISE_SOURCE',
 'NOISE_SEED_MULTIPLIER',
 'NOISE_EXPOSURE_ID',
 'ext_photometryKron_KronFlux_nRadiusForFlux',
 'NOISE_OFFSET',
 'base_CircularApertureFlux_radii']

(John Parejko) #4

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.


(K-T Lim) #5

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.


(Michael Wood-Vasey) #6

Thank you both, @parejkoj and @ktl! That was exactly what I was looking for.


(Rob Seaman) #7

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?