Fixes (photometry.fixes)

This submodule contains auxullary functions for making specific fixes to data needed in some specific cases.

Time offset (photometry.fixes.time_offset)

Corrections of time offset present in early data releases of TESS Data (sectors 1-21). This involved the following corrections to the timestamps:

Staggered readouts of the four cameras:

The two-second integrations in the cameras are offset by 0.5 seconds, in the order camera 1, camera 3, camera 4, camera 2. This applies to FFIs only.

Staggered readouts of the four CCDs within a camera:

The readouts of the four CCDs are staggered by 0.020 seconds, in the order CCD 1, CCD 2, CCD 3, CCD 4. This applies to FFIs only.

Off-by-one error in cadence counting:

A correction to an error in calculation the start and end times of 2m and 30m data: these values were too high by 2.0 seconds in the original data products.

Detailed correction to start and end times:

The start times of integrations for every 2 minute and 30 minute cadence were shifted forward by 31 milliseconds, and the end times were shifted forward by 11 milliseconds. These offsets correct for effects in the focal plane electronics.

Assuming \(S\), \(M\) and \(E\) are the original start, mid and end-timestamps respectively and \(S'\), \(M'\) and \(E'\) are the new (corrected) timestamps:

\[ \begin{align}\begin{aligned}S' &= S - 2.000 + 0.031 = S - 1.969\\E' &= S' + 1.980\end{aligned}\end{align} \]

The end time used to be the start time + 2.000 seconds:

\[E = S + 2.000\]

Doing the math we find \(M' = (S'+E')/2 = (S+E)/2 - 1.979\) and \(E'=E - 1.989\). So the mid-time shifts by (2 - 0.021) seconds, which is the 11ms offset before readout plus half of the 20ms readout time.

The correction should definitely be applied to all data releases <= 26, and possibly for data releases 27 and 29 (sectors 20 and 21), depending on the headers in the files. For the troublesome sectors 20 and 21, there were two data releases with the same data release numbers. The only way of distinguishing between them is to use the PROCVER header keyword, which unfortunately wasn’t saved in the HDF5 files in earlier versions of the pipeline. In that case, the “prepare” stage will have to be re-run and HDF5 file re-created.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

photometry.fixes.time_offset.time_offset(time, header, datatype='ffi', timepos='mid', return_flag=False)[source]

Apply time offset correction to array of timestamps.

Parameters
  • time (ndarray) – Array of timestamps in days.

  • header (dict) – Header from TPF, FFI or HDF5 file.

  • datatype (str, optional) – Data product to correct. Choices are 'ffi' or 'tpf'. Default is 'ffi'.

  • timepos (str, optional) – At what time during exposure are times indicating? Choices are 'mid', 'start' and 'end'. Default is 'mid'.

  • return_flag (bool, optional) – Also return the flag indication whether the timestamps were corrected.

Returns

  • ndarray: Corrected timestamps in days.

  • bool: True if corrections to timestamps were needed, false otherwise.

    Only returned if return_flag parameter is set.

Return type

tuple

Raises

ValueError – If invalid timepos.

Code author: Rasmus Handberg <rasmush@phys.au.dk>