kymata-atlas / kymata-core

Core Kymata codebase, including statistical analysis and plotting tools
https://kymata.org
MIT License
5 stars 0 forks source link

Error when doing second stage preprocessing (ICA) on participant 10 #113

Closed young-x-skyee closed 9 months ago

young-x-skyee commented 9 months ago

I tried to do the second stage preprocessing on participant 10 using the branch big-preprocessing-refactor. When I tried to select the ICA for ECG, the error message below came up whether I selected anything or not. The strange thing about the data itself is that the ECG seems not to be picked up. This error only occurred for participant 10.

Traceback (most recent call last):
  File "c:\Users\cy02\Documents\GitHub\kymata-toolbox\invokers\invoker_run_data_cleansing.py", line 56, in <module>
    main()
  File "c:\Users\cy02\Documents\GitHub\kymata-toolbox\invokers\invoker_run_data_cleansing.py", line 33, in main
    run_second_pass_cleansing_and_EOG_removal(
  File "C:\Users\cy02\Documents\GitHub\kymata-toolbox\kymata\preproc\data_cleansing.py", line 221, in run_second_pass_cleansing_and_EOG_removal
    _remove_ecg(filt_raw, ica)
  File "C:\Users\cy02\Documents\GitHub\kymata-toolbox\kymata\preproc\data_cleansing.py", line 276, in _remove_ecg
    ica.plot_properties(filt_raw, picks=ecg_indices)
  File "C:\Users\cy02\AppData\Local\pypoetry\Cache\virtualenvs\kymata-toolbox-KeSJ-Uls-py3.11\Lib\site-packages\mne\preprocessing\ica.py", line 2524, in plot_properties
    return plot_ica_properties(
           ^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-363>", line 12, in plot_ica_properties
  File "C:\Users\cy02\AppData\Local\pypoetry\Cache\virtualenvs\kymata-toolbox-KeSJ-Uls-py3.11\Lib\site-packages\mne\viz\ica.py", line 501, in plot_ica_properties
    return _fast_plot_ica_properties(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cy02\AppData\Local\pypoetry\Cache\virtualenvs\kymata-toolbox-KeSJ-Uls-py3.11\Lib\site-packages\mne\viz\ica.py", line 554, in _fast_plot_ica_properties
    picks = _picks_to_idx(ica.n_components_, picks, picks_on="components")[:limit]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\cy02\AppData\Local\pypoetry\Cache\virtualenvs\kymata-toolbox-KeSJ-Uls-py3.11\Lib\site-packages\mne\_fiff\pick.py", line 1298, in _picks_to_idx
    raise ValueError(
ValueError: No appropriate components found for the given picks ([])
neukym commented 9 months ago

Thanks @young-x-skyee - can you remind me to look at this when I am next with you? (I think this would make it easier to reproduce.)

neukym commented 9 months ago

Ahh - wait, wasn't there someone for whom we didn't record ECG? (because of missing wires?)

neukym commented 9 months ago

In this case setting remove_ECG as false in the config file should fix it?

young-x-skyee commented 9 months ago

Ahh - wait, wasn't there someone for whom we didn't record ECG? (because of missing wires?)

Yes I think this should be the one, but the ECG channel actually showed up as a flat line. There was also another participant whose HEOG was not recorded and the _remove_veoh_and_heog seems to be working.

young-x-skyee commented 9 months ago

In this case setting remove_ECG as false in the config file should fix it?

Yes I think so, but there is actually an ICA component to be removed since it looks very much like heart beat.

image

neukym commented 9 months ago

Closing for now as workaround can be made with just running remove_VEOG_and_HEOG