Thomaslund1 / SpecCorrect

3 stars 0 forks source link

flexible function for mean/median? #8

Closed rterrien closed 3 months ago

rterrien commented 3 months ago

https://github.com/Thomaslund1/SpecCorrect/blob/08d049fadda169bc37c260964bda3d941203401e/lib.py#L248

This function uses only np.nanmedian(), but we could adjust it to use an arbitrary function by providing a keyword in the definition of groupByOrderMeds(..., combine_func = np.nanmedian) Then use combine_func() instead of np.nanmedian to do the actual reduction. That way it would default to np.nanmedian, but we could test out alternatives without rewriting the function. (It could be helpful to try np.nanmean, or astropy.stats.biweight_location)

Fos314 commented 3 months ago

This function now has this capability. I will look elsewhere in the code to see if it can be adopted elsewhere