kylemath / DeepEEG

Deep Learning with Tensor Flow for EEG MNE Epoch Objects
MIT License
265 stars 58 forks source link

re-reference to linked mastoid #4

Closed kylemath closed 5 years ago

kylemath commented 5 years ago

https://martinos.org/mne/stable/auto_examples/preprocessing/plot_rereference_eeg.html

kylemath commented 5 years ago

since it is all linear, lets not, and say we did (more important for ERP comparisons across studies )

kylemath commented 5 years ago
        % arithmetically rereference to linked mastoid
        for x=1:EEG.nbchan-2
            EEG.data(x,:) = (EEG.data(x,:)-((EEG.data(EEG.nbchan-2,:))*.5));
        end
kylemath commented 5 years ago

fixed in #8

with new function in util.py, and call in preprocessing, and flag in preprocessing

def mastoidReref(raw):
  ref_idx = pick_channels(raw.info['ch_names'],['M2'])
  eeg_idx = pick_types(raw.info,eeg=True)
  raw._data[eeg_idx,:] =  raw._data[eeg_idx,:]  -  raw._data[ref_idx,:] * .5 ;
  return raw