BaseSourceSpectrum¶
-
class
synphot.spectrum.
BaseSourceSpectrum
(modelclass, clean_meta=False, **kwargs)[source]¶ Bases:
synphot.spectrum.BaseSpectrum
Base class to handle spectrum with flux unit like source spectrum and observation. Do not use directly.
Methods Summary
__call__
(wavelengths[, flux_unit])Sample the spectrum. normalize
(renorm_val[, band, wavelengths, …])Renormalize the spectrum to the given Quantity and band. Methods Documentation
-
__call__
(wavelengths, flux_unit=None, **kwargs)[source]¶ Sample the spectrum.
Parameters: - wavelengths : array-like or
Quantity
Wavelength values for sampling. If not a Quantity, assumed to be in Angstrom.
- flux_unit : str or
Unit
orNone
Flux is converted to this unit. If not given, internal unit is used.
- kwargs : dict
Keywords acceptable by
convert_flux()
.
Returns: - sampled_result :
Quantity
Sampled flux in the given unit. Might have negative values.
- wavelengths : array-like or
-
normalize
(renorm_val, band=None, wavelengths=None, force=False, area=None, vegaspec=None)[source]¶ Renormalize the spectrum to the given Quantity and band.
Warning
Redshift attribute (
z
) is reset to 0 in the normalized spectrum even ifself.z
is non-zero. This is because the normalization simply adds a scale factor to the existing composite model. This is confusing but should not affect the flux sampling.Parameters: - renorm_val : number or
Quantity
Value to renormalize the spectrum to. If not a Quantity, assumed to be in internal unit.
- band :
SpectralElement
Bandpass to use in renormalization.
- wavelengths : array-like,
Quantity
, orNone
Wavelength values for renormalization. If not a Quantity, assumed to be in Angstrom. If
None
,self.waveset
is used.- force : bool
By default (
False
), renormalization is only done when band wavelength limits are withinself
or at least 99% of the flux is within the overlap. Set toTrue
to force renormalization for partial overlap (this changes the underlying model ofself
to always extrapolate, if applicable). Disjoint bandpass raises an exception regardless.- area, vegaspec
See
convert_flux()
.
Returns: - sp : obj
Renormalized spectrum.
Raises: - synphot.exceptions.DisjointError
Renormalization band does not overlap with
self
.- synphot.exceptions.PartialOverlap
Renormalization band only partially overlaps with
self
and significant amount of flux falls outside the overlap.- synphot.exceptions.SynphotError
Invalid inputs or calculation failed.
- renorm_val : number or
-