BaseSourceSpectrum

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

Bases: 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:
wavelengthsarray-like or Quantity

Wavelength values for sampling. If not a Quantity, assumed to be in Angstrom.

flux_unitstr, Unit, or None

Flux is converted to this unit. If not given, internal unit is used.

kwargsdict

Keywords acceptable by convert_flux().

Returns:
sampled_resultQuantity

Sampled flux in the given unit. Might have negative values.

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 if self.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_valnumber or Quantity

Value to renormalize the spectrum to. If not a Quantity, assumed to be in internal unit.

bandSpectralElement

Bandpass to use in renormalization.

wavelengthsarray-like, Quantity, or None

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

forcebool

By default (False), renormalization is only done when band wavelength limits are within self or at least 99% of the flux is within the overlap. Set to True to force renormalization for partial overlap (this changes the underlying model of self to always extrapolate, if applicable). Disjoint bandpass raises an exception regardless.

area, vegaspec

See convert_flux().

Returns:
spobj

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.