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. Its waveset and 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 to config["missions.downsample.t_min"] and t_max.

  • t_max (float, optional) – Temperature range in K over which the downsampled bandpass must reproduce blackbody band integrals. Default to config["missions.downsample.t_min"] and t_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 to config["missions.downsample.n_spec"].

  • tol_mag (float, optional) – Largest tolerated magnitude error in any band integral over the verification set. Defaults to config["missions.downsample.tol_mag"].

  • rescale (bool, optional) – If True (default), scale the kept values so the integrated transmission int T dnu equals the original’s.

Returns:

The downsampled bandpass, or bandpass itself if no reduction meets tol_mag.

Return type:

SpectralElement

Raises:

ValueError – If t_min and t_max are not positive with t_min < t_max, n_spec < 2, or tol_mag <= 0.