lkorczowski / Tinnitus-n-Sleep

Detecting events in sleeping tinnitus patients
MIT License
1 stars 0 forks source link

Unexpected behaviour of OMA annotations when cropping raw #76

Closed RobinGuillard closed 4 years ago

RobinGuillard commented 4 years ago

When we crop raw before annotating it with MNE, I observed a desynchronisation of annotations and events.

THR_OMA = dict(abs_threshold=0, rel_threshold=4, n_adaptive=0, decision_function=lambda foo: np.any(foo>0, axis=-1))

raw_OMA = mne.io.read_raw_edf(filename, preload=False, verbose=False) # prepare loading ch_names = raw_OMA.info["ch_names"] picks_chan = ["Activity"] raw_OMA = CreateRaw(raw_OMA[picks_chan][0], raw_OMA.info["sfreq"], picks_chan, ch_types='emg')

croptimes=dict(tmin=raw_OMA.times[0]+3600*2, tmax=raw_OMA.times[-1]-3600) raw_OMA.crop(**croptimes)

duration_OMA = 250 interval_OMA = 250

#Get the table of bad electrodes booleans from the impedance thresholding algo epochs_OMA, OMA_labels, log = preprocess(raw_OMA, duration_OMA, interval_OMA, picks_chan="all", is_good_kwargs=None, filter_kwargs=None, Thresholding_kwargs=THR_OMA, burst_to_episode_kwargs=None, merge_fun=None)

dict_annotations_artefacts = {1: "OMA"} raw_OMA = CleanAnnotations(raw_OMA) raw_OMA = AnnotateRaw_sliding(raw_OMA, np.invert(OMA_labels), dict_annotations=dict_annotations, duration=duration_OMA, interval=interval_OMA) raw_OMA.plot(scalings=dict(emg=1))

image

lkorczowski commented 4 years ago

got it

lkorczowski commented 4 years ago

I believe this subject can be discussed in both #37 and #78

Closing