pypeit.history module

Module for managing the history of PypeIt output files.

class pypeit.history.History(header=None)[source]

Bases: object

Holds and creates history entries for FITS files.

Parameters:

header (astropy.io.fits.Header, optional) – Header from a fits file. The history keyword entries in this header will be used to populate this History object. Defaults to None.

history

List of history entries.

Type:

list of str

add_coadd1d(spec1d_files, objids, gpm_exp=None)[source]

Add history entries for 1D coadding.

The history shows what files and objects were used for coadding. For example:

HISTORY 2021-01-23T02:12 PypeIt Coadded 4 objects from 3 spec1d files
HISTORY File 0 "spec1d_DE.20170425.53065-dra11_DEIMOS_2017Apr25T144418.240.fits"
HISTORY File 1 "spec1d_DE.20170425.51771-dra11_DEIMOS_2017Apr25T142245.350.fits"
HISTORY File 2 "spec1d_DE.20170425.50487-dra11_DEIMOS_2017Apr25T140121.014.fits"
HISTORY Object ID SPAT0692-SLIT0704-DET08 from file 0
HISTORY Object ID SPAT0695-SLIT0706-DET04 from file 2
HISTORY Object ID SPAT0691-SLIT0704-DET08 from file 2
HISTORY Object ID SPAT0695-SLIT0706-DET04 from file 1
Parameters:
  • spec1d_files (list) – List of the spec1d files used for coadding.

  • objids (list) – List of the PypeIt object ids used in coadding.

  • gpm_exp (list, optional) – List of boolean indicating which exposures were coadded.

add_reduce(calib_id, metadata, frames, bg_frames)[source]

Add history entries for reducing a frame. For example:

HISTORY 2021-03-05T23:56 PypeIt Reducing target HIP15339
HISTORY Combining frames:
HISTORY "S20161108S0087.fits.gz"
HISTORY "S20161108S0090.fits.gz"
HISTORY Subtracted background from frames:
HISTORY "S20161108S0088.fits.gz"
HISTORY "S20161108S0089.fits.gz"
HISTORY Calibration frames:
HISTORY arc,science,tilt "S20161108S0069.fits.gz"
HISTORY arc,science,tilt "S20161108S0070.fits.gz"
HISTORY arc,science,tilt "S20161108S0071.fits.gz"
HISTORY arc,science,tilt "S20161108S0072.fits.gz"
HISTORY pixelflat,trace "S20161108S0078.fits.gz"
Parameters:
  • calib_id (int) – The calibration id being reduced.

  • metadata (pypeit.metadata.PypeItMetaData) – The metadata for all the fits files PypeIt knows of.

  • frames (numpy.ndarray) – Array of indexes into metadata of the frames being combined in the reduction.

  • bg_frames (numpy.ndarray) – Array of indexes into metadata of the frames being subtracted in the reduction.

append(history, add_date=True)[source]

Append a new history entry.

Parameters:
  • history (str) – The history text to add.

  • add_date (bool) – If true a isot formatted date willbe prepended to the history entry. Defaults to True.

write_to_header(header)[source]

Write history entries to a FITS header.

Parameters:

header (astropy.io.fits.Header) – The header to write to.