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 use area.

Parameters:
modelclass, kwargs

See BaseSpectrum.

obsmodeObservationMode

Observation mode for this bandpass.

Attributes Summary

area

Telescope collecting area based on obsmode.

binset

Instrument-specific wavelength set from stsynphot.wavetable.WAVECAT based on obsmode.

obsmode

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.

showfiles()

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

area

Telescope collecting area based on obsmode.

binset

Instrument-specific wavelength set from stsynphot.wavetable.WAVECAT based on obsmode.

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().

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().

Returns:
waverangeQuantity

Lower and upper limits of the wavelength range, in the unit of cenwave.

Raises:
synphot.exceptions.UndefinedBinset

Undefined binset.

bounded_by_zero(wavelengths=None, verbose=True)[source]

Check if sampled throughout is bounded by zeroes.

Parameters:
wavelengthsarray-like, Quantity, or None

Wavelength values for sampling. If not a Quantity, assumed to be in Angstrom. If None, self.waveset is used.

verbosebool

Print warning if unbounded.

Returns:
boundedbool

True if bounded by zeroes, False otherwise.

classmethod from_file(filename, **kwargs)[source]

Disabled.

classmethod from_filter(filtername, **kwargs)[source]

Disabled.

classmethod from_obsmode(obsmode, graphtable=None, comptable=None, component_dict={})[source]

Create a bandpass from observation mode string.

Parameters:
obsmodestr

Observation mode.

graphtablestr or None

Graph table filename. If None, uses stsynphot.config.conf.graphtable.

comptablestr or None

Optical component table filename. If None, uses stsynphot.config.conf.comptable.

component_dictdict

Maps component filename to corresponding Component.

Returns:
bpObservationSpectralElement

Empirical bandpass.

Raises:
synphot.exceptions.SynphotError

Observation mode yields no throughput.

showfiles()[source]

Display self.obsmode optical component filenames.

Note

Similar to IRAF SYNPHOT SHOWFILES.

taper(**kwargs)[source]

Disabled.

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:
areafloat, Quantity, or None

Area that flux covers. If not a Quantity, assumed to be in \(cm^{2}\). If None, use area.

thermtablestr or None

Thermal component table filename. If None, uses stsynphot.config.conf.thermtable.

Returns:
bgQuantity

Thermal background count rate.

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, or None

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().