synospec.etc.efficiency module
Provides Efficiency object, primarily just a linear interpolator for efficiency data.
Copyright © 2020, Kyle B. Westfall
- class synospec.etc.efficiency.AtmosphericThroughput(airmass=1.0, location='maunakea')[source]
Bases:
synospec.etc.efficiency.EfficiencyAtmospheric throughput.
- Parameters
airmass (
float, optional) – Airmass of the observation.location (
str, optional) – Location of the observations. Currently this can only be'maunakea'.
- class synospec.etc.efficiency.CombinedEfficiency(efficiencies, wave=None)[source]
Bases:
synospec.etc.efficiency.EfficiencyA class that combines multiple efficiencies that can be accessed separately or act as a single efficiency.
Accessing this object as you would an
Efficiencyobject 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 anEfficiencyobject.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
efficienciesis not a list or dictionary, or if the elements of either are notEfficiencyobjects.
- classmethod from_total(total, wave=None)[source]
Construct the combined efficiency object from the total efficiency only. This is virtually identical to a single
Efficiencyobject.- Parameters
total (
float, array-like) – Constant or 1D total efficiency data.wave (array-like, optional) – 1D array with wavelengths in angstroms. If not provided,
etamust be a constant; if provided,etamust be an array.
- class synospec.etc.efficiency.Efficiency(eta, wave=None)[source]
Bases:
objectBase 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,
etamust be a constant; if provided,etamust be an array.
- interpolator
Linear interpolator used to sample efficiency at any wavelength, if vectors are provided.
- Raises
TypeError – Raised if
waveis not provided andetahas alenattribute.ValueError – Raised if
waveis provided andetais not a vector or ifwaveandetahave 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.EfficiencyFiber 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’.
- class synospec.etc.efficiency.FilterResponse(band='g')[source]
Bases:
synospec.etc.efficiency.EfficiencyThe 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.CombinedEfficiencyDefine 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 efficiencycamera (
Efficiency, optional) – Camera efficiencydetector (
Efficiency, optional) – Detector efficiencyother (
Efficiency, optional) – Other efficiency terms
- class synospec.etc.efficiency.SystemThroughput(wave=None, spectrograph=None, telescope=None)[source]
Bases:
synospec.etc.efficiency.CombinedEfficiencyDefine 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 efficiencytelescope (
Efficiency, optional) – Telescope efficiency