Muscle artifact discussion: Computing threshold_muscle and the meaning of order?

  • MNE-Python version: 0.23
  • Mac OS 11.3.1, Python 3.9

I’m trying to learn more about detecting various types of artifacts. My raw data comes from surface electrodes and I’ve performed notch filtering to remove line noise from my raw file.

I can detect muscular artifacts using the documentation described at Annotate muscle artifacts — MNE 0.23.4 documentation

threshold_muscle = 5 
annot_muscle, scores_muscle = annotate_muscle_zscore(raw, ch_type="eeg", threshold=threshold_muscle, min_length_good=0.2,filter_freq=[110,140])
order = np.arange(144, 164)
raw.plot(start=5, duration=20, order=order)

My starts and durations are stored in the lists raw.annotations.onset

My questions are as follows:

  1. Is there a way to choose a reasonable threshold_muscle value using the zscore - Muscle Activity graph? For example, could I take the mean of the values on the graph plus one or two standard deviations?

  2. What do the values 144 and 164 in order represent?

  3. If I’m interested in ocular artifacts, I would use mn.preprocessing.find_eog_events along with the directions at Overview of artifact detection — MNE 0.23.4 documentation.

Now my starts are stored in the list raw.annotations.onset (different from that above) and my durations are all .5 sec.

What is the most efficient means to combine the starts and durations for the muscular artifacts and the starts and durations for the ocular artifacts so as to plot my raw data with both types of artifacts highlighted but in different colors?

I was able to answer the last question aboe on my own using .__add__

The result is a list of ordered dictionaries, both_artifact_types containing items like the following:

OrderedDict([('onset', 1.65), ('duration', 2.935), ('description', 'M'), ('orig_time', None)])

for a muscle artifact, and

OrderedDict([('onset', 7.93), ('duration', 0.5), ('description', 'B'), ('orig_time', None)])

for a blinking one.

I then set raw.set_annotations(both_artifact_types) and raw.plot() to create a plot, which showed both types of artifacts, each labelled M or B.

The colors of the vertical bands for M and for B were different, but is there a way to stipulate these two colors?