Conversation
|
Why is the detrended SNR so much lower in magnitude? |
Detrending removes background fluctuations of the timescale you choose for the filter, highlighting only fluctuations shorter. The SNR going to zero just means that it's varying slowly enough to get filtered out. It's meant to highlight periodicity, but could also be used to identify transient spikes. |
There was a problem hiding this comment.
Testing was fine, no issues.
You will want to import this feature into the init.py file.
from .utils.detrend import Detrend
Then you don't have to type pydarn.utils.detrend.Detrend.detrend_fitacf() when using this.
I'm still not sure why this can't just go in the filters module still anyway. You can have another class Detrend in there if you want, I just don't want us to blow up with modules with one thing in each of them.
Also, this needs adding with examples to documentation pls.
| @@ -0,0 +1,268 @@ | |||
| import copy | |||
| import pydarn | |||
There was a problem hiding this comment.
You're gonna want to do this as
from pydarn import SuperDARNRadars
I think that's all you want, so instead of importing the entire package again, just add this below.


Scope
This PR adds functionality to detrend fitacf-level data with a running mean low-pass filter. This is useful for the detection of periodic fluctuations (e.g., ULF waves, TIDs), or for simply removing a background feature.
Currently, the detrending functionality works for velocities, SNR's, or both. I didn't see why it would be useful for spectral widths and elevation angles, but it would be trivial to add them if a reason emerged.
The code will work with any experiment where the beams are periodically repeating (e.g. normalscan, camping beam, widebeam, Themisscan). Care must be taken if used with irregular beam intervals.
It would also be pretty easy to slot in additional low-pass filter types in the future - just add another filter function to the class.
Calling sequence
Approval
Number of approvals: 2
Test
Here is an example with SAS widebeam observations of Pc5 ULF waves on 2025-12-16:
Same code but with the Savitsky-Golay low-pass: