Hi Chris,
I understand that you are trying to filter 60Hz interference from your data using "helperWPHarmonicFilter" which is working fine for a sample size of <4000 but doesn’t give the expected output for a large sample size.
I was able to find the helper function you mentioned in one of the examples from Wavelet Packet Harmonic Interference Removal.
Could you help me with the model and data that you are running so that I can reproduce the issue at my end?
I have few other approaches that you can try from your end and see if it works.
To improve the performance of the function on larger datasets, you can try the following approaches:
- Down sampling: If your data has a high sampling rate, you can consider down sampling it to reduce the number of data points. This can help reduce the computational load on the function.
- Windowing: You can divide your data into smaller windows or segments and apply the "helperWPHarmonicFilter" function to each window individually. This can help mitigate the performance degradation by processing smaller chunks of data at a time.
- Optimization: Review the implementation of the "helperWPHarmonicFilter" function and check if there are any opportunities for optimization. Look for any unnecessary calculations or redundant operations that can be removed or simplified.
- Parallelization: If your programming environment allows it, you can consider parallelizing the filtering process. By distributing the computation across multiple processors or threads, you can potentially improve the performance on larger datasets.
Alternatively, to filter out 60Hz interference from your data you could also look into:
- Notch Filter https://www.mathworks.com/discovery/notch-filter.html
- Fast Fourier Transform https://www.mathworks.com/discovery/fft.html#
I hope this helps.