edges_analysis.averaging.averaging.bin_gha_unbiased_regular

edges_analysis.averaging.averaging.bin_gha_unbiased_regular(params: ndarray, resids: ndarray, weights: ndarray, gha: ndarray, bins: ndarray) tuple[ndarray, ndarray, ndarray][source]

Bin data in an unbiased way using a model fit.

See memo #183: http://loco.lab.asu.edu/wp-content/uploads/2020/10/averaging_with_weights.pdf)

Data can be in the form of multiple observations, each of which has a “model” fit to it (eg. multiple GHA’s with a model over frequency for each).

Parameters:
  • params – Model parameters for each data point. Shape should be (Nobs, Nterms).

  • resids – Residuals of the models to data. Shape should be (Nobs, Ncoords)

  • weights – Weights of the data/residuals. Shape should be same as resids.

  • gha – The GHA coordinates to bin.

  • bins – The bins into which the GHA should be fit

Returns:

  • params – An array giving the averaged parameters of the model

  • resids – An array giving residuals in the averaged bins.

  • weights – The new weights after averaging.