eradiate.spectral.spectral_response_weights#

eradiate.spectral.spectral_response_weights(spectral_data, srf)#

Compute the weight each spectral bin carries in the band aggregate produced by pipelines.logic.apply_spectral_response().

Parameters:
  • spectral_data (DataArray) – Spectral data the weights are computed for. Only its w, bin_wmin and bin_wmax coordinates are used.

  • srf (SpectralResponseFunction) – Spectral response function to apply.

Returns:

DataArray – Weights, indexed against the w coordinate of spectral_data. They sum to 1 when the SRF support is entirely covered by the data.

Notes

SRF weighting turns a set of per-bin values \(x_i\) into a single band value \(\sum_i c_i x_i\). This function computes the coefficients \(c_i\). They are computed by feeding a unit impulse on each bin (i.e. considering the \(x_i = 1\), all other values set to zero) through the resampling and integration steps that are to be applied to the actual data. Computed weights are consumed by pipelines.logic.apply_spectral_response(), allowing different usage depending on whether the mean or variance of a variable is processed, and by srf_spp_distribution() to allocate samples.