Hi Richard,
Iâm considering epoch my raw data first and then do the ica to see whether the ecg scalp map and the ecg evoked plot will get any better since there actually still many artifacts and noise in my raw data which although had been high-pass filtered and annotated muscle artifacts and removed power line noise (for example, the figure below). In fact, the very beginning and the end of the raw data contained no information on the experiment task, theyâre just the preparation and the rest periods of my task.
I would really suggest to take a step back and figure out why the generation of ECG evokeds doesnât seem to work properly. As long as we cannot figure that out, automated ECG rejection via ICA will most likely not work either
Okay, I follow your suggestions,
ecg_events, ch_ecg, average_pulse, ecg = mne.preprocessing.find_ecg_events(raw_perception, return_ecg=True, verbose=True)
ecg_epoch = mne.Epochs(raw_perception, ecg_events)
ecg_evoked = ecg_epoch.average()
ecg_evoked.apply_baseline(baseline=(None, -0.2))
ecg_evoked.plot_joint()
Returns:
It said that Reconstructing ECG signal from âMagnetometersâ, is that right?
Reconstructing ECG signal from Magnetometers
Setting up band-pass filter from 5 - 35 Hz
FIR filter parameters
---------------------
Designing a two-pass forward and reverse, zero-phase, non-causal bandpass filter:
- Windowed frequency-domain design (firwin2) method
- Hann window
- Lower passband edge: 5.00
- Lower transition bandwidth: 0.50 Hz (-12 dB cutoff frequency: 4.75 Hz)
- Upper passband edge: 35.00 Hz
- Upper transition bandwidth: 0.50 Hz (-12 dB cutoff frequency: 35.25 Hz)
- Filter length: 10000 samples (10.000 sec)
Number of ECG events detected : 680 (average pulse 100 / min.)
I donât know if I was doing right, but the figures not look like so:
Thatâs quite a high heart rate, did you expect this?
Plot the detected events onto the raw data to see if they even make sense.
raw_perception.plot(events=ecg_events)
it seems unsual, the intervals between two adjacent ecg events have varying lengths, but how can this happen?
Obviously the automated ECG peak detection is not working, or the participant in question has some sort of cardiovascular condition� What you can try is find a channel that appears to have a relatively clear ECG artifact and pass its ch_name
to find_ecg_events()
, and see if that produces any better results?
Hi Richard,
I checked another subject, same thing happened in him, so itâs not the problem of subjects. Then I tried to find the ecg artifacts in raw data plot according to the ecg pattern shown in the tutorial(the figure below):
But unfortunally, I didnât found one in my data, here is what the pattern look like in my data in some similar channels as the tutorial used:
Yeah there doesnât seem to be much of an ECG artifact, so the peak finder will fail.
Since there doesnât seem to be a clear ECG signal in your data anyway, why do you still want to remove it? Seems like it doesnât affect the recordings too muchâŠ
hhhhâŠâŠ youâre absolutely right! Why should I, bother myself so much
I just thought everybody has heartbeats, so the ecg must exist, which turns out itâs a wrong idea?
Thatâs what Iâm hoping too!
Iâm not sure why thereâs no strong ECG artifact in the magnetometer data. Maybe it has been pre-processed already? No ideaâŠ
Okay, anyway, thank you verrrrrry much! Your support is greatly appreciated. Itâs my first time dealing with MEG data, glad youâre here
I have another question, itâs better to do ica after epoch, right? So maybe after removing power line noise, annotate muscle artifacts, I should run epoch, then do ica?
If you want to work with epoched data eventually anyway, then it makes sense to run ICA on epochs, yes. And annotating muscle artifacts and filtering out power line noise â or simply cutting it away by applying a low-pass filter â can also be a good idea. Most importantly, run a high-pass filter on your data before running ICA. Good luck!
Okay, got it! Thanks a millionïŒ
ECG detection does not work properly after the MEG signal has been processed with maxfilter, since maxfilter removes a lot of the heartbeat signal (but not all of it). What I usually do is run find_ecg_events
on the raw, non-maxfiltered data and use those events later to make ECG epochs on the maxfiltered version.
Hi,
Thanks for your replay! I did use the fif file end with _tsss.fif, I didnât know what the process was done to the raw fif file at first, but after you mentioned, I guess that would be maxfilter. By the way, since you talked about how to make ECG epochs, will you remove ECG from your data, or just ignore it when the independent component source plot produced from _tsss data didnât show one?
If I didnât have access to the non-maxfiltered data and the heartbeat detection was not working for me, I think I would just ignore ECG artifacts. This scenario is unlikely however, usually the raw data has been available to me. It also depends on what you are trying to prove with your study: are heartbeats going to interfere with whatever you are trying to show/prove?
My concentration is on visual perception (the ventral visual pathway) and memory, Iâm not sure whether the ECG will interfere with the effect I want, but it seems like the ECG rejection is a ânormal routine/operationâ everyone follows.Since I will do the ICA using the epoched data, so using raw data to fit ica seems impracticable to me. What Iâm decide to do is if there is an obvious ECG component shown in the ICs source plot while the scalp map might look odd like what I mentioned above, I would consider to exclude it, but if there is not an ECG component shown in the ICs source plot, I might just ignore it.
A post was split to a new topic: question about cardiac artifacts & ICA