SpectralElement

class synphot.spectrum.SpectralElement(modelclass, clean_meta=False, **kwargs)[source]

Bases: synphot.spectrum.BaseUnitlessSpectrum

Class to handle instrument filter bandpass.

Parameters
modelclass, kwargs

See BaseSpectrum.

Methods Summary

check_overlap(other[, wavelengths, threshold])

Check for wavelength overlap between two spectra.

efficiency([wavelengths])

Calculate dimensionless efficiency.

emflx(area[, wavelengths])

Calculate equivalent monochromatic flux.

equivwidth(**kwargs)

Calculate bandpass equivalent width.

from_file(filename, **kwargs)

Creates a bandpass from file.

from_filter(filtername, **kwargs)

Load pre-defined filter bandpass.

fwhm(**kwargs)

Calculate FWHM of equivalent gaussian.

photbw([wavelengths, threshold])

Calculate the bandpass RMS width as in IRAF SYNPHOT.

rectwidth([wavelengths])

Calculate bandpass rectangular width.

rmswidth([wavelengths, threshold])

Calculate the bandpass RMS width.

tlambda(**kwargs)

Calculate throughput at bandpass average wavelength.

to_fits(filename[, wavelengths])

Write the bandpass to a FITS file.

tpeak([wavelengths])

Calculate peak bandpass throughput.

unit_response(area[, wavelengths])

Calculate unit response of this bandpass.

wpeak([wavelengths])

Calculate wavelength at peak throughput.

Methods Documentation

check_overlap(other, wavelengths=None, threshold=0.01)[source]

Check for wavelength overlap between two spectra.

Only wavelengths where self throughput is non-zero are considered.

Example of full overlap:

|---------- other ----------|
   |------ self ------|

Examples of partial overlap:

|---------- self ----------|
   |------ other ------|

|---- other ----|
   |---- self ----|

|---- self ----|
   |---- other ----|

Examples of no overlap:

|---- self ----|  |---- other ----|

|---- other ----|  |---- self ----|
Parameters
otherBaseSpectrum
wavelengthsarray-like, Quantity, or None

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

thresholdfloat

If less than this fraction of flux or throughput falls outside wavelength overlap, the lack of overlap is insignificant. This is only used when partial overlap is detected. Default is 1%.

Returns
result{‘full’, ‘partial_most’, ‘partial_notmost’, ‘none’}
  • ‘full’ - self coverage is within or same as other

  • ‘partial_most’ - Less than threshold fraction of self flux is outside the overlapping wavelength region, i.e., the lack of overlap is insignificant

  • ‘partial_notmost’ - self partially overlaps with other but does not qualify for ‘partial_most’

  • ‘none’ - self does not overlap other

Raises
synphot.exceptions.SynphotError

Invalid inputs.

efficiency(wavelengths=None)[source]

Calculate dimensionless efficiency.

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.

Returns
qtlamQuantity

Dimensionless efficiency.

emflx(area, wavelengths=None)[source]

Calculate equivalent monochromatic flux.

Parameters
area, wavelengths

See unit_response().

Returns
em_fluxQuantity

Equivalent monochromatic flux.

equivwidth(**kwargs)[source]

Calculate bandpass equivalent width.

Parameters
kwargsdict

See integrate().

Returns
equvwQuantity

Bandpass equivalent width.

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

Creates a bandpass from file.

If filename has ‘fits’ or ‘fit’ suffix, it is read as FITS. Otherwise, it is read as ASCII.

Parameters
filenamestr

Bandpass filename.

kwargsdict

Keywords acceptable by read_fits_spec() (if FITS) or read_ascii_spec() (if ASCII).

Returns
bpSpectralElement

Empirical bandpass.

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

Load pre-defined filter bandpass.

Parameters
filternamestr

Filter name. Choose from ‘bessel_j’, ‘bessel_h’, ‘bessel_k’, ‘cousins_r’, ‘cousins_i’, ‘johnson_u’, ‘johnson_b’, ‘johnson_v’, ‘johnson_r’, ‘johnson_i’, ‘johnson_j’, or ‘johnson_k’.

kwargsdict

Keywords acceptable by read_remote_spec().

Returns
bpSpectralElement

Empirical bandpass.

Raises
synphot.exceptions.SynphotError

Invalid filter name.

fwhm(**kwargs)[source]

Calculate FWHM of equivalent gaussian.

Parameters
kwargsdict

See photbw().

Returns
fwhm_valQuantity

FWHM of equivalent gaussian.

photbw(wavelengths=None, threshold=None)[source]

Calculate the bandpass RMS width as in IRAF SYNPHOT.

This is a compatibility function. To calculate the actual bandpass RMS width, use rmswidth().

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.

thresholdfloat or Quantity, optional

Data points with throughput below this value are not included in the calculation. By default, all data points are included.

Returns
bandwQuantity

IRAF SYNPHOT RMS width of the bandpass.

Raises
synphot.exceptions.SynphotError

Threshold is invalid.

rectwidth(wavelengths=None)[source]

Calculate bandpass rectangular width.

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.

Returns
rectwQuantity

Bandpass rectangular width.

rmswidth(wavelengths=None, threshold=None)[source]

Calculate the bandpass RMS width. Not to be confused with photbw().

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.

thresholdfloat or Quantity, optional

Data points with throughput below this value are not included in the calculation. By default, all data points are included.

Returns
rms_widthQuantity

RMS width of the bandpass.

Raises
synphot.exceptions.SynphotError

Threshold is invalid.

tlambda(**kwargs)[source]

Calculate throughput at bandpass average wavelength.

Parameters
kwargsdict

See avgwave().

Returns
t_lambdaQuantity

Throughput at bandpass average wavelength.

to_fits(filename, wavelengths=None, **kwargs)[source]

Write the bandpass to a FITS file.

Throughput column is automatically named ‘THROUGHPUT’.

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

tpeak(wavelengths=None)[source]

Calculate peak bandpass throughput.

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.

Returns
tpeakQuantity

Peak bandpass throughput.

unit_response(area, wavelengths=None)[source]

Calculate unit response of this bandpass.

Parameters
areafloat or Quantity

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

wavelengthsarray-like, Quantity, or None

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

Returns
urespQuantity

Flux (in FLAM) of a star that produces a response of one photon per second in this bandpass.

wpeak(wavelengths=None)[source]

Calculate wavelength at peak throughput.

If there are multiple data points with peak throughput value, only the first match is returned.

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.

Returns
wpeakQuantity

Wavelength at peak throughput.