First, clone the repository into a local folder. Then, navigate to that directory, activate your preferred conda environment, and run pip install . (or pip install -e .). Import with from telemetry_ta import miri_telem, nircam_telem. Installation may crash when finding missing packages that you would have to install manually.
We start by requesting the metadata for all MIRI or NIRCam level 2b coronagraphic data products from MAST. These correspond to individual exposures.
For MIRI, the sequence consists of:
- 1st TA exposure
- 2nd TA exposure
- 1st science exposure + subsequent dithers, if any
For NIRCam, there is a single TA exposure, followed by 1-9 science exposures.
The MAST table columns are explained here: https://mast.stsci.edu/api/v0/_jwst_inst_keywd.html - in short, these are the FITS header keywords. Each row of the table contains the corresponding keyword values for one of the exposures.
We group the table using the keyword VISIT_ID, since this contains a single TA
sequence plus the related subsequent exposures.
We instantiate an InstrTelem object - either MiriTelem or NircamTelem,
with the subtable for a single visit. This is what happens next:
- Request the telemetry logs using the
VSTSTARTandVISITENDkeywords, which bound the visit in time starting from the initial blind slew to the TA target. This uses the tool written by Marshall Perrin and Jeff Valenti. - Request the guide star exposures contemporaneous with the visit, and connect them to their corresponding exposure. This uses Marshall Perrin's tool.
- Extract the guide star positions during each exposure, and append their x and
y positions (in
telframe) to the table. - Get the TA centroids for the ACQ exposures from the telemetry log, and append
their x and y positions (in
telframe) to the table rows for the corresponding ACQ exposure. - Derive the sky position of the target from the ACQ exposures.
- Read the target positions in detector coordinates from the telemetry log
- Use the GS star positions and sky coordinates to derive an attitude matrix for the telescope.
- Use that attitude matrix to compute sky coordinates for the target.
- Derive the TEL position of the target in the ACQ exposures
- In the occulted exposures, use the guide star position again to set the telescope attitude matrix.
- With the new attitude matrix, convert the computed target sky coordinates back to telescope coordinates.
- Transform these coordinates to the science aperture's
idlcoordinate frame.
Let's follow along with with how the telemetry is parsed:
When an ObservationTelemetry (really, should be VisitTelemetry) object is instantiated, the method process_observation() is run. This executes the following steps:
engdb_lib.get_visit_log():- request telemetry starting 15 minutes before the VSTSTART time and ending 15 minutes after the VISITEND time
- filter down to the events between the start and end times
- add the target detector position from the acquisition centroids
Example notebooks can be found in the notebooks directory. Currently a notebook only exists for MIRI data, because there is less of it than there is NIRCam data so it runs faster.
First, get the observations to analyze with (for example)
mast_tools.get_metadata_from_mast("nrc", extra_kwds={'productLevel': ['2b']}, psf_only=True). This returns a pandas DataFrame.
Visits that should not be included in the analysis are stored in the
data/{instr}_bad_visits.txt files. Place the visit IDs there, and they will be
dropped from the mast results.
- TODO Filter NIRCam data; only choose the primary wavelength?
- This is already implemented in
nircam_telem.py
- This is already implemented in
- TODO generate diagnostic plots and reports
- TODO Calibrate occulted position with WebbPSF