ObservationSpectralElement¶
- class stsynphot.spectrum.ObservationSpectralElement(modelclass, obsmode=None, **kwargs)[source]¶
Bases:
SpectralElement
Class to handle bandpass from observation mode.
This class has additional methods that are specific to observation mode and instrument-specific wavelength set.
Note
For methods that take
area
, it is recommended but not required to usearea
.- Parameters:
- modelclass, kwargs
See
BaseSpectrum
.- obsmode
ObservationMode
Observation mode for this bandpass.
Attributes Summary
Telescope collecting area based on
obsmode
.Instrument-specific wavelength set from
stsynphot.wavetable.WAVECAT
based onobsmode
.Observation mode for this bandpass.
Methods Summary
binned_pixelrange
(waverange, **kwargs)Calculate the number of pixels within the given wavelength range and
binset
.binned_waverange
(cenwave, npix, **kwargs)Calculate the wavelength range covered by the given number of pixels centered on the given central wavelengths of
binset
.bounded_by_zero
([wavelengths, verbose])Check if sampled throughout is bounded by zeroes.
from_file
(filename, **kwargs)Disabled.
from_filter
(filtername, **kwargs)Disabled.
from_obsmode
(obsmode[, graphtable, ...])Create a bandpass from observation mode string.
Display
self.obsmode
optical component filenames.taper
(**kwargs)Disabled.
thermback
([area, thermtable])Calculate thermal background count rate for
self.obsmode
.to_fits
(filename[, wavelengths])Write the spectrum to a FITS file.
Attributes Documentation
- obsmode¶
Observation mode for this bandpass.
Methods Documentation
- binned_pixelrange(waverange, **kwargs)[source]¶
Calculate the number of pixels within the given wavelength range and
binset
.- Parameters:
- waverangetuple of float or
Quantity
Lower and upper limits of the desired wavelength range. If not a Quantity, assumed to be in Angstrom.
- kwargsdict
Keywords accepted by
synphot.binning.pixel_range()
.
- waverangetuple of float or
- Returns:
- npixnumber
Number of pixels.
- Raises:
- synphot.exceptions.UndefinedBinset
Undefined
binset
.
- binned_waverange(cenwave, npix, **kwargs)[source]¶
Calculate the wavelength range covered by the given number of pixels centered on the given central wavelengths of
binset
.- Parameters:
- cenwavefloat or
Quantity
Desired central wavelength. If not a Quantity, assumed to be in Angstrom.
- npixint
Desired number of pixels, centered on
cenwave
.- kwargsdict
Keywords accepted by
synphot.binning.wave_range()
.
- cenwavefloat or
- Returns:
- waverange
Quantity
Lower and upper limits of the wavelength range, in the unit of
cenwave
.
- waverange
- Raises:
- synphot.exceptions.UndefinedBinset
Undefined
binset
.
- bounded_by_zero(wavelengths=None, verbose=True)[source]¶
Check if sampled throughout is bounded by zeroes.
- classmethod from_obsmode(obsmode, graphtable=None, comptable=None, component_dict={})[source]¶
Create a bandpass from observation mode string.
- Parameters:
- Returns:
- bp
ObservationSpectralElement
Empirical bandpass.
- bp
- Raises:
- synphot.exceptions.SynphotError
Observation mode yields no throughput.
- showfiles()[source]¶
Display
self.obsmode
optical component filenames.Note
Similar to IRAF SYNPHOT SHOWFILES.
- thermback(area=None, thermtable=None)[source]¶
Calculate thermal background count rate for
self.obsmode
.Calculation uses
thermal_spectrum()
to extract thermal component source spectrum in PHOTLAM per square arcsec. Then this spectrum is integrated and multiplied by detector pixel scale and telescope collecting area to produce a count rate in count/s/pix. This unit is non-standard but used widely by STScI Exposure Time Calculator.Note
Similar to IRAF SYNPHOT THERMBACK.
- Parameters:
- Returns:
- bg
Quantity
Thermal background count rate.
- bg
- Raises:
- stsynphot.exceptions.PixscaleNotFoundError
Undefined pixel scale for the given observation mode.
- to_fits(filename, wavelengths=None, **kwargs)[source]¶
Write the spectrum to a FITS file.
Throughput column is automatically named ‘THROUGHPUT’. Graph and optical component tables are written to table header (not primary) under these keywords:
GRFTABLE
CMPTABLE
- Parameters:
- filenamestr
Output filename.
- wavelengthsarray-like,
Quantity
, orNone
Wavelength values for sampling. If not a Quantity, assumed to be in Angstrom. If
None
,self.waveset
is used.- kwargsdict
Keywords accepted by
synphot.specio.write_fits_spec()
.