NeilwBailey / RELAX

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with RELAX v1.2

AndreaPav80 opened this issue · comments

Hi there,

Thank you very much for this useful plugin. When I try to run it, at some point I got this error in function "RELAX_blinks_IQR_method": "Unrecognized function or variable 'BlinkIndexMetric' ".

Please, can you help?

Thanks.
Andrea

Hi Andrea

Great to hear you're finding RELAX useful.

With regards to your error message, would you mind providing some more details to enable me to work out what the problem might be? In particular:

  1. whether this occurs for all files or just one file,
  2. whether the file(s) that causes the error contains blinks,
  3. whether visual inspection of the raw data indicates the data is relatively clean or noisy before processing
  4. the settings you are using (attaching the RELAX_cfg.mat output file could help, but especially the RELAX_cfg.ProbabilityDataHasNoBlinks setting you've used).

Kind regards,

Neil

Hi Neil,

Thank you very much for your prompt reply.

  1. I've tried with 4 participants, each having 2 conditions (8 files in total). I always got the same error.

  2. Yes, the files contains some blinks and noise from muscles etc. However, to me the noise level is not dramatically high. I think these data are pretty clean even before the processing.

  3. Like I said, there is of course some noise, but to me this is not so high. I have attached two files from subject 1. Maybe you want to have a look. Before running RELAX, I remove the ECG channel, edit channels location, resample to 250Hz and remove baseline (DC-offset) (usually I resample to 500Hz, original file is 1kHz).

  4. Unfortunately I cannot provide the RELAX_cfg.ProbabilityDataHasNoBlinks (though it should be zero or close to it), as it crashes before saving this variable.

On a side note, when I run RELAX on 128Hz resampled signals, it works. However, I don't want to resample to this frequency as it is too low with respect to the original frequency (1kHz). 250Hz should be fine for ERPs and 500 Hz for oscillatory dynamics. So I'd prefer to use 500 Hz.

I have shared a folder via Google Drive containing the data from subject 1 (with 2 conditions), and screenshots of the RELAX error and parameters I use (mainly the default ones). Here's the link: https://drive.google.com/file/d/1C2Pca9mBhygP9gcGNsACTZTWnpB_vyhx/view?usp=share_link

Please, let me know your thoughts and thanks again for your time.

Best,
Andrea

Hi Andrea

Thank you for the details and sharing some example files. It was an interesting (but tricky) problem to solve!

It seems there are multiple issues causing the error:

Firstly, I suspect you're using a Brain Products EEG cap, which I've just noticed label their FP electrodes as "Fp1, Fp2, Fpz" rather than "FP1, FP2, FPZ". We developed RELAX using data mostly collected from a Neuroscan system, which uses the capitalised labels, so the capitalised labels are set as the defaults, and RELAX is coded in a case sensitive manner. As such, it's not finding your Fp1, Fp2 and Fpz electrodes, so isn't capturing the maximal blink. This can easily be solved by adjusting the blink electrode labels when setting the "blink affected electrodes" labels.

However, your files also seem to have both high powered alpha activity and small blink amplitudes. Because RELAX uses the upper quartile range + (3 * the interquartile range) as an amplitude threshold to detect blinks and the alpha activity in your files is almost as large as the (small amplitude) blinks, the blinks aren't exceeding this threshold, and RELAX isn't detecting the blinks.

When I tested potential solutions, the simplest seemingly robust solution was to low pass filter the data at 6Hz to exclude alpha from the blink detection step (this low pass filtering is only applied within the blink detection step, the blinks will be marked in the data that has had your overall filter parameter settings applied, and your final data will still include the alpha activity).

I've attached a replacement for RELAX_blinks_IQR_method that will apply this solution. It's in txt format, so just save it in the matlab .m format, and replace the file in the RELAX folder (within your EEGLAB plugins folder) with this file (you could keep a backup of the original in case you need to return to that original file later).

RELAX_blinks_IQR_method.txt

One other point to note is that your parameter selections currently include low pass filtering at 30Hz. Both the empirically based muscle activity detection method and ICLabel use data above 30Hz to detect muscle activity, so neither method will clean the muscle activity out of your data with those settings. I would recommend using the default 80Hz filtering, at least for the data cleaning steps. You can always low pass filter at 30Hz after the cleaning if you would like (although I prefer to keep the higher frequencies in for data analysis, as ERPs might be affected by the higher frequencies).

Please let me know if this solution works (or does not work). If it's effective, I'll think about whether it could be implemented as an option in RELAX's next update. If it doesn't work, I'll have a think about alternative solutions.

Kind regards,

Neil

Wow, thanks for this. I use Biosemi which uses labels Fp1, Fp2 and Fpz as well! Been using RELAX this whole time with subpar eye blink cleaning! :D

Just a note here that RELAX v1.1.3 will be robust to case changes in electrode labels, and the low pass filtering at 6Hz prior to blink detection will be implemented as an option if necessary (although from our testing this is only necessary for a small minority of files).