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)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
- other
BaseSpectrum
- wavelengthsarray-like,
Quantity
, orNone
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%.
- other
- Returns
- result{‘full’, ‘partial_most’, ‘partial_notmost’, ‘none’}
‘full’ -
self
coverage is within or same asother
‘partial_most’ - Less than
threshold
fraction ofself
flux is outside the overlapping wavelength region, i.e., the lack of overlap is insignificant‘partial_notmost’ -
self
partially overlaps withother
but does not qualify for ‘partial_most’‘none’ -
self
does not overlapother
- Raises
- synphot.exceptions.SynphotError
Invalid inputs.
- efficiency(wavelengths=None)[source]¶
Calculate dimensionless efficiency.
- emflx(area, wavelengths=None)[source]¶
Calculate equivalent monochromatic flux.
- Parameters
- area, wavelengths
See
unit_response()
.
- Returns
- em_flux
Quantity
Equivalent monochromatic flux.
- em_flux
- equivwidth(**kwargs)[source]¶
Calculate bandpass equivalent width.
- Parameters
- kwargsdict
See
integrate()
.
- Returns
- equvw
Quantity
Bandpass equivalent width.
- equvw
- 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) orread_ascii_spec()
(if ASCII).
- Returns
- bp
SpectralElement
Empirical bandpass.
- bp
- 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
- bp
SpectralElement
Empirical bandpass.
- bp
- Raises
- synphot.exceptions.SynphotError
Invalid filter name.
- 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
, orNone
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.
- wavelengthsarray-like,
- Returns
- bandw
Quantity
IRAF SYNPHOT RMS width of the bandpass.
- bandw
- Raises
- synphot.exceptions.SynphotError
Threshold is invalid.
- rectwidth(wavelengths=None)[source]¶
Calculate bandpass rectangular width.
- rmswidth(wavelengths=None, threshold=None)[source]¶
Calculate the bandpass RMS width. Not to be confused with
photbw()
.- Parameters
- wavelengthsarray-like,
Quantity
, orNone
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.
- wavelengthsarray-like,
- Returns
- rms_width
Quantity
RMS width of the bandpass.
- rms_width
- Raises
- synphot.exceptions.SynphotError
Threshold is invalid.
- tlambda(**kwargs)[source]¶
Calculate 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
, orNone
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.
- unit_response(area, wavelengths=None)[source]¶
Calculate unit response of this bandpass.
- Parameters
- Returns
- uresp
Quantity
Flux (in FLAM) of a star that produces a response of one photon per second in this bandpass.
- uresp
- 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.