edges_analysis.averaging.averaging.bin_freq_unbiased_regular

edges_analysis.averaging.averaging.bin_freq_unbiased_regular(model: Model, params: ndarray, freq: ndarray, resids: ndarray, weights: ndarray, resolution: float | int | None = None, **fit_kwargs) tuple[ndarray, ndarray, ndarray, ndarray, ndarray][source]

Bin an array along the frequency axis into regular bins.

To make the bins regular, we use a model over the frequency axis to evaluate central value, and add the residuals to it.

Parameters:
  • model_type – The model for which the residuals are defined.

  • params – 2D array of parameters (parameters for each model along last axis).

  • freq – The frequencies of the input

  • resids – The residuals of the input model

  • weights – The weights of the data.

  • resolution – The resolution of the new data.

  • fit_kwargs – Anything passed to construct the ModelFit instance, example method.

Returns:

  • freq – The new frequencies

  • weights – The binned weights

  • spec – The binned spectrum

  • resids – The new residuals to the same model

  • params – The new parameters of the same model