Open
Description
Hey,
I like to implement the NoisyChannel class in my preprocessing pipeline and to I like to complete the detection by looking at which channel has a psd value in at least one frequency that is significantly different (given a Z-score threshold) than the others.
In term of code it would simply looks a bit like this:
def bad_by_psd(data, fmin=0, fmax=np.inf, sd=3):
data_size = len(get_good_eeg_chan(data)) # data_size = eeg channel number
psd = data.compute_psd(fmin=fmin, fmax=fmax)
log_psd = 10 * np.log10(psd.get_data())
zscore_psd = scipy.stats.zscore(log_psd)
mask = np.zeros(data_size, dtype=bool)
for i in range(len(mask)):
mask[i] = any(zscore_psd[i] > sd)
return mask # or it could return directly a list of bad channels
It has given me good results, and complements deviation and correlation detection quite well.
In essence, it's a little redundant with find_bad_by_hfnoise()
and less explicit but there a lot of use cases where we are not interested in >50 Hz frequencies and bad_by_psd
allow to tackle channel parasitized by low delta noises (like sweat electrodes) or gamma noises.
What do you think about a new way to tackle artifacts based on PSD ?
Metadata
Metadata
Assignees
Labels
No labels