pypeit.spectrographs.util module

Spectrograph utility methods.

pypeit.spectrographs.util.load_spectrograph(spec, pypeit_fits=False)[source]

Instantiate a spectrograph from the available subclasses of Spectrograph.

Parameters:
  • spec (str, Spectrograph) – The spectrograph to instantiate. If the input object is None or has Spectrograph as a base class, the instance is simply returned. If it is a string, the string is used to instantiate the relevant spectrograph instance.

  • pypeit_fits (bool, optional) – The spectrograph loader is being called from a post-processing script where the expected input files are PypeIt-written FITS files only. This has the effect of overriding the allowed_extensions attribute to be [".fits"].

Returns:

The spectrograph used to obtain the data to be reduced.

Return type:

Spectrograph

Raises:

PypeItError – Raised if the input is a string that does not select a recognized PypeIt spectrograph.