kujaku11 / mth5

Exchangeable and archivable format for magnetotelluric time series to better serve the community through FAIR principles.
https://mth5.readthedocs.io/en/latest/index.html
MIT License
16 stars 6 forks source link

Decimation Filters should not be removed at downsampled sps #185

Open kkappler opened 10 months ago

kkappler commented 10 months ago

Currently, decimation filters are removed by default when time series instrument response is removed.

However, this is only appropriate if the data are upsampled at each decimation stage.

Note that the decimation filters for PKD, as stored by NCEDC, have for example:

decimation_input_sample_rate = 32000.0 decimation_input_sample_rate = 2000.0 decimation_input_sample_rate = 200.0

We cannot back these FIR out on 40sps data, they can only be backed out on data sampled at decimation_input_sample_rate.

I am changing the value of include_decimation from True to False.

In future, if we want to back these filters out, we would need to upsample, and then apply them.

Here is PKD Eletric field ex with instrument response removed with include_decimation=True image

And with include_decimation=False image

kkappler commented 10 months ago

TODO: Consider adding this logic to calibration as per this pseudocode:

if decimation filters are in the removal list:
    remove all non decimation filters
    sort the decimation filters from lowest decimation_input_sample_rate to highest
    for dec_filter in sorted_decimation_filters:
        data = upsample_to_previous_sps()
        data = invert_aaf(data)