pypeit.core.meta module

Provides methods common to PypeItMetaData and Spectrograph that define the common metadata used for all spectrographs.

pypeit.core.meta.convert_radec(ra, dec)[source]

Handle multiple ra,dec inputs and return decimal degrees

If ra, dec are str but do not have J or ‘:’ in the RA term, then they will be converted to floats

Parameters:
  • ra (str or float or numpy.ndarray) – RA as decimal deg (float) or hh:mm:ss.s (str)

  • dec (str or float or numpy.ndarray) – DEC as decimal deg (float) or +dd:mm:ss.s (str) Must be the same format as ra

Returns:

float,float of ra,dec in decimal deg if input is str or float np.ndarray, np.ndarray of ra,dec in decimal deg if input is np.ndarray

Return type:

tuple

pypeit.core.meta.define_additional_meta(nlamps=20)[source]

Defines meta that tends to be instrument-specific and not used as widely in the code.

See define_core_meta() for additional details

For meta used to define configurations, the rtol key specifies the relative tolerance for a match

Parameters:

nlamps (int, optional) – Number of calibrations lamps for this instrument.

Returns:

Describes the additional meta data used in pypeit.

Return type:

dict

pypeit.core.meta.define_core_meta()[source]

Define the core set of meta data that must be defined to run PypeIt.

See the metadata.rst file for further discussion

Warning

The keys should all be <= 8 length as they are all written to the Header.

Each meta entry is a dict with the following keys:
  • dtype: str, float, int

  • comment: str

  • rtol: float, optional – Sets the relative tolerance for float meta when used to set a configuration

Each meta dtype must be scalar or str. No tuple, list, ndarray, etc.

Returns:

core_meta

Return type:

dict

pypeit.core.meta.get_meta_data_model(nlamps=20)[source]

Construct full metadata model general to all spectrographs.

This is a wrapper for define_core_meta() and define_additional_meta() that checks that the keys defined by both are unique (a coding issue) and returns a single combined dictionary.

Parameters:

nlamps (int, optional) – Number of calibrations lamps for this instrument, passed directly to define_additional_meta().

Returns:

Dictionary with the full metadata model common to all spectrographs.

Return type:

dict

Raises:

ValueError – Raised if the coding of func:define_core_meta and define_additional_meta() do not produce unique keys. This should never be raised in the released version.