simpeg / aurora

software for processing natural source electromagnetic data
MIT License
13 stars 2 forks source link

scipy filters now available in xarray via mth5 #248

Open kkappler opened 1 year ago

kkappler commented 1 year ago

See email correspondence below: these tools can likely be used to simplify some of the time series operations in aurora.

I ended up copying some of the xrscipy filters and updated the decimate method to be closer to what scipy does, using a chebyshev iir filter and then down sample. I followed their registration of a methods to xarray, so when now when you import anything from mth5 a 'filt' object is registered to xr.DataArray.filt and xr.Datase.filt and they have methods like decimate, detrend, low pass, high-pass, bandpass, dt, fs, dx. https://github.com/kujaku11/mth5/blob/master/mth5/timeseries/scipy_filters.py Thinking about extending this way of adding to xarray for removing channel response cause it seems efficient. I removed resample methods in ChannelTS and RunTS cause I don't see a reason for resample over decimate unless you can think of one. I also added add and a merge(list of channels or runs, new_sample_rate) to RunTS and ChannelTS. Both will combine in time and create a monotonic time index with interpolated gaps using a linear interpolation as default. Merge can take objects with different sample rates and combine into one long time series with a common sample rate. I merged these into master and added some documentation and examples. https://mth5.readthedocs.io/en/latest/source/ts.html