simonsobs / sotodlib

Simons Observatory: Time-Ordered Data processing library.
MIT License
14 stars 17 forks source link

stats Module for tod_ops #144

Open kmharrington opened 3 years ago

kmharrington commented 3 years ago

Add in things like these

https://github.com/simonsobs/LATR_Validation/blob/6d89e3eae8e92c32aaa69218587d54982bfbda1d/latrtools/latrtools/__init__.py#L400-L654

jeffiuliano commented 3 years ago

Initial commit with some of these functions has been pushed to branch ae00232. What else did we want to include? Is this the right place for a noise model and tool to fit psds against it? (Which can be some combination of the one I modified from pysmurf, the one Katie made, and whoever else has thoughts/needs)?

kmharrington commented 3 years ago

I think this is the right place to put these. The first two functions will need to be "AxisManager-ified."

It would be nice to have a white noise calculator + 1/f fitting setup in sotodlib. @RemingtonGerras was starting the white noise side, perhaps you all could bring them together.

RemingtonGerras commented 3 years ago

Hey sorry for the radio silence, yeah I'd love to be able to help out with white noise calculator and a 1/f + wn fitting setup!

skhrg commented 3 years ago

@kmharrington I've been tasked by Jeff with finishing this up. What do you mean by "AxisManager-ifing" the first two functions?

kmharrington commented 3 years ago

On a second look, that's a good question. What are you all using these functions for?

Also, on the average_to function, it'd be cool to have the option to have a new axes added to the AxisManager that is downstamped to that level. (I have a vision of this sort of function being expanded to include things like cuts).

skhrg commented 3 years ago

@jeffiuliano probably has a better answer as far as intended use case goes, but they seem most useful as something to pass to a fitting function or something.

Adding an option to add the downsampled axes to AxisManager should be easy enough to do.

jeffiuliano commented 3 years ago

Yeah, that's right. Mostly I've used these when, say, fitting a histogram results or something. It's much more likely to be used for something like that, which may not be in an axis manager or aligned with an AM axis (but I guess could be). So we can give them the same function(am, timestamps=None) format but it seems unusual to use them that way.

One that we might want to use that way (applying to aman timestamps) is a sine function to fit against (taking phase and amplitude as inputs).

kmharrington commented 3 years ago

Could we start building toward the fitting direction? Ex: Fit histogram of aman.XYZ to shape ABC? That and fit aman.XYZ to sine-wave? Those would instantly be useful I expect.

skhrg commented 3 years ago

Do we want/need anything more than functions to pass on to an existing fitting routine (scipy.curvefit, scipy.minimize, etc.)? Or is it worth it to make wrappers that call those functions?