chemicalc.instruments

class chemicalc.instruments.InstConfig(name: str, res: float, samp: float, start: float, end: float, truncate: bool = False)

Bases: object

Object containing Instrument configuration.

Parameters
  • name (str) – Name of the instrument configuration

  • res (float) – Resolving power (\(\lambda/d\lambda\))

  • samp (float) – Pixels per Resolution element

  • start (float) – Beginning wavelength in Angstroms

  • end – Ending wavelength in Angstroms

  • truncate – If true, discards any pixels with wavelengths > ending wavelength

Variables
  • _custom_wave (bool) – True if Instrument’s wavelength has been manually set

  • wave (np.ndarray) – Instrument’s wavelength grid

  • snr (Optional[Union[float,np.ndarray]]) – Signal/Noise of observation (per pixel). Initially None.

set_custom_wave(wave: numpy.ndarray, update_config: bool = True) → None

Sets instrument wavelength array to input array

Parameters
  • wave (np.ndarray) – Array of wavelengths

  • update_config (bool) – Update instrument’s start_wavelength and end_wavelength attributes to match new wavelength grid.

Returns

reset_wave(truncate: bool = False) → None

Reset wavelength based on instrument configuration (beginning and ending wavelengths, resolving power, and sampling of the resolution element).

Parameters

truncate (bool) – truncate any pixels with lambda > ending wavelength.

Returns

set_snr(snr_input: Union[int, float, numpy.ndarray, chemicalc.s2n.Sig2NoiseQuery], fill_value=None) → None

Sets S/N for instrument configuration.

  • If snr_input is an int or float, a constant S/N is set for all pixels.

  • If snr_input is a 2D array, the first row is the wavelength grid and the second row is the S/N per pixel. The S/N is then interpolated onto the instrument’s wavelength grid.

  • If snr_input is a 1D array, the wavelength grid is assumed to be linearly spaced from the instruments starting and ending wavelength. The S/N is then interpolated onto the instrument’s wavelength grid.

  • If snr_input is a Sig2NoiseQuery, the relevant ETC is queried and the S/N is interpolated onto the instrument’s wavelength grid.

Parameters
  • snr_input – Signal-to-Noise Ratio.

  • fill_value – Argument passed on to scipy.interpolate.interp1d to handle S/N for wavelength regions that extend beyond the coverage of snr_input. Common choices are “extrapolate” (to linearly extrapolate) or 0 (to set S/N to zero). If None, an error will be raised if snr_input does not span the full wavelength range of the instrument.

Returns

summary() → None

Prints summary of instrument configuration.

Returns

__len__() → int
Return int

length of wavelength array

class chemicalc.instruments.AllInstruments(file: str = None)

Bases: object

Object containing all pre-defined instrument configurations.

Parameters

file – JSON file containing instrument parameters. If None, uses default Chem-I-Calc instrument file.

Variables

spectrographs (Dict[str,InstConfig]) – Dictionary of instrument configurations

list_spectrographs() → None

Lists names of all predefined instruments

Returns

get_spectrograph(name: str)chemicalc.instruments.InstConfig

Get InstConfig object of a predefined instrument

Parameters

name (str) – name of spectrograph

Returns

Predefined InstConfig

chemicalc.instruments.AllInst = <chemicalc.instruments.AllInstruments object>

Pre-initialized object of all the instruments

Type

AllInstruments