Closed timonmerk closed 2 years ago
@richardkoehler I am referencing from the PR to this issue here. It's basically not just the notch filter, but also the filter in generell. For the notch filter it might be easy to fix, since we initialize the filter currently in this manner in features.py
data = notch_filter(x=data, Fs=self.fs, trans_bandwidth=15,
freqs=arange(self.line_noise, 3*self.line_noise,
self.line_noise),
fir_design='firwin', verbose=False,
notch_widths=3, filter_length=data.shape[1]-1)
So at least the "3*self.line_noise" needs to be adapted wrt to the used sampling frequency. Maybe the notch / bandpass filter could be defined even in settings.py? In this way we could pass them to features.py instantiation, and the correct filters could be already precalculated.
Something more tricky is probably the 'trans_bandwidth', since this heavily depends on the 'filter_length'. Higher 'filter_length' will allow for "sharper" filter functions. So it might be necessary to iteratively increase this parameter until the filter calculation is possible, or a more advanced way is possbile :sweat_smile:
I think this issue comes up mainly with testing modules using openBCI though, since here fs is pretty low
Notch filter params are set in relation to fs now
For too low sampling frequencies, the current notch filter will fail. Design filter in settings.py?
Settings.py should be written as class s.t. settings.json, df_M1 and such code isn't part of start_BIDS / start_LSL anymore.