synospec.etc.efficiency module

Provides Efficiency object, primarily just a linear interpolator for efficiency data.


License

Copyright © 2020, Kyle B. Westfall


class synospec.etc.efficiency.AtmosphericThroughput(airmass=1.0, location='maunakea')[source]

Bases: synospec.etc.efficiency.Efficiency

Atmospheric throughput.

Parameters
  • airmass (float, optional) – Airmass of the observation.

  • location (str, optional) – Location of the observations. Currently this can only be 'maunakea'.

reset_airmass(airmass)[source]
class synospec.etc.efficiency.CombinedEfficiency(efficiencies, wave=None)[source]

Bases: synospec.etc.efficiency.Efficiency

A class that combines multiple efficiencies that can be accessed separately or act as a single efficiency.

Accessing this object as you would an Efficiency object always returns the total efficiency.

Parameters
  • efficiencies (list, dict) – The set of efficiencies to combine. Nominally this should be a dictionary that gives the efficiencies and a keyword identifier for each. A list can be entered, meaning that the efficiencies can only be access by their index, not a keyword. Each list element or dictionary value must be an Efficiency object.

  • wave (array-like, optional) – Wavelengths of/for efficiency measurements.

efficiencies

The efficiencies combined. Access to individual efficiencies is by keyword; if keywords are not provided, access is by single integer index.

Type

dict

Raises

TypeError – Raised if efficiencies is not a list or dictionary, or if the elements of either are not Efficiency objects.

__getitem__(key)[source]

Return the specified efficiency.

classmethod from_total(total, wave=None)[source]

Construct the combined efficiency object from the total efficiency only. This is virtually identical to a single Efficiency object.

Parameters
  • total (float, array-like) – Constant or 1D total efficiency data.

  • wave (array-like, optional) – 1D array with wavelengths in angstroms. If not provided, eta must be a constant; if provided, eta must be an array.

keys()[source]

The iterable with the efficiency keywords.

class synospec.etc.efficiency.Efficiency(eta, wave=None)[source]

Bases: object

Base class for efficiency data.

Provided a wavelength independent efficiency value (\(\eta\); eta), or a sampled vector of \(\eta\) vs. wavelength (\(\lambda\); wave), this class mainly just allows for access and interpolation of those data. When provided as a function of wavelength, the efficiency is assumed to be 0 outside the bounds of the provided wavelength vector.

Parameters
  • eta (float, array-like) – Constant or 1D efficiency data.

  • wave (array-like, optional) – 1D array with wavelengths in angstroms. If not provided, eta must be a constant; if provided, eta must be an array.

interpolator

Linear interpolator used to sample efficiency at any wavelength, if vectors are provided.

Type

scipy.interpolate.interp1d

Raises
  • TypeError – Raised if wave is not provided and eta has a len attribute.

  • ValueError – Raised if wave is provided and eta is not a vector or if wave and eta have different shapes.

__call__(wave)[source]

Return the efficiency interpolated at the provided wavelengths.

Parameters

wave (array-like) – Wavelengths at which to return the efficiency.

__getitem__(k)[source]

Return the selected element of the efficiency vector.

Parameters

k (int) – Vector element to return.

property eta

The effeciency vector.

classmethod from_file(datafile, wave_units='angstrom')[source]

Read from an ascii file.

The format of the file must be columnated data with the first column providing the wavelength and the second column providing the efficiency. The data is read using numpy.genfromtxt.

Parameters
  • datafile (str) – Ascii file with the data.

  • wave_units (str, optional) – Units of the wavelength in the file. Must be interpretable by astropy.units and convertable to angstroms.

rescale(scale)[source]

Rescale the efficiency data.

The internal attributes are directly modified.

Parameters

scale (scalar-like, array-like) – Factor for the efficiency. No check is performed to make sure this doesn’t result in a value larger than 1! Value must be broadcastable to the shape of the efficiency vector.

property wave

The wavelength vector with direct efficiency values.

class synospec.etc.efficiency.FiberThroughput(fiber='polymicro')[source]

Bases: synospec.etc.efficiency.Efficiency

Fiber efficiency object.

Currently this only returns efficiencies based on pre-computed data. See $SYNOSPEC_DIR/data/efficiency/fibers/.

Parameters

fiber (str, optional) – The fiber vendor. Currently this can only be ‘polymicro’.

static select_data_file(fiber)[source]
class synospec.etc.efficiency.FilterResponse(band='g')[source]

Bases: synospec.etc.efficiency.Efficiency

The efficiency of a broad-band filter.

Parameters

band (str, optional) – The band to use. Options are for the response functions in the $SYNOSPEC_DIR/data/broadband_filters directory.

Raises

FileNotFoundError – Raised if the default file for the given band is not available.

class synospec.etc.efficiency.SpectrographThroughput(wave=None, coupling=None, fibers=None, grating=None, camera=None, detector=None, other=None)[source]

Bases: synospec.etc.efficiency.CombinedEfficiency

Define the spectrograph throughput from the telescope focal plane to the detector.

Parameters
  • wave (array-like, optional) – Wavelength vector at which to define the total efficiency.

  • coupling (Efficiency, optional) – Focal-plain coupling efficiency.

  • fibers (Efficiency, optional) – Fiber efficiency.

  • grating (Efficiency, optional) – Grating efficiency

  • camera (Efficiency, optional) – Camera efficiency

  • detector (Efficiency, optional) – Detector efficiency

  • other (Efficiency, optional) – Other efficiency terms

class synospec.etc.efficiency.SystemThroughput(wave=None, spectrograph=None, telescope=None)[source]

Bases: synospec.etc.efficiency.CombinedEfficiency

Define the full system throughput from the top of the telescope to the detector; i.e., ratio of detected-to-incident photons.

Parameters
  • wave (array-like, optional) – Wavelength vector at which to define the total efficiency.

  • spectrograph (Efficiency, optional) – Spectrograph efficiency

  • telescope (Efficiency, optional) – Telescope efficiency