uvex_transients.missions.downsample_bandpass#
- uvex_transients.missions.downsample_bandpass(bandpass: SpectralElement, *, t_min: float | None = None, t_max: float | None = None, n_spec: int | None = None, tol_mag: float | None = None, rescale: bool = True) SpectralElement[source]#
Replace a dense bandpass table by a short one with matching thermal band integrals.
See the module docstring for the algorithm. The returned bandpass is linearly interpolated between the kept points. Its
meta["downsampling"]records the parameters, the point counts, the achieved worst-case magnitude error, and the mass rescale factor.- Parameters:
bandpass (
SpectralElement) – The bandpass to downsample. Itswavesetand values at the waveset define the table.t_min (
float, optional) – Temperature range in K over which the downsampled bandpass must reproduce blackbody band integrals. Default toconfig["missions.downsample.t_min"]andt_max.t_max (
float, optional) – Temperature range in K over which the downsampled bandpass must reproduce blackbody band integrals. Default toconfig["missions.downsample.t_min"]andt_max.n_spec (
int, optional) – Number of log-uniformly spaced blackbodies the knot selection is optimized on. The error is verified on a denser set that includes temperatures between these. Defaults toconfig["missions.downsample.n_spec"].tol_mag (
float, optional) – Largest tolerated magnitude error in any band integral over the verification set. Defaults toconfig["missions.downsample.tol_mag"].rescale (
bool, optional) – If True (default), scale the kept values so the integrated transmissionint T dnuequals the original’s.
- Returns:
The downsampled bandpass, or bandpass itself if no reduction meets tol_mag.
- Return type:
SpectralElement- Raises:
ValueError – If
t_minandt_maxare not positive witht_min < t_max,n_spec < 2, ortol_mag <= 0.