Skip to content

EEG reading error caused by missing impedance values #8

@dominikwelke

Description

@dominikwelke

hi all -

i'm new to curry fileformats but received some EEG recordings from a cooperating lab that i want/need to work with.

it's cdt/ceo/dpo extension, so curry 9 i suppose?

the files can be read in matlab/eeglab, but the curry python reader errors out with the traceback:

  File "/Users/phtn595/Work/git_contributions/curry-python-reader/curryreader.py", line 202, in read
    impedancematrix = np.asarray(impedancelist, dtype = float).reshape(int(len(impedancelist) / nChannels), nChannels)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: cannot reshape array of size 33 into shape (0,34)

and indeed this is understandable as one channel seems to have no impedance value (i.e. -1). see last column below in an excerpt from the dpo file. -1 is ignored and this leads to a list of only 33 impedance values that cannot be reshaped to a 0x34 matrix:

IMPEDANCE_VALUES START
   ListDescription      = impedance values
   ListUnits            = 
   ListNrColumns        =  34
   ListNrRows           =  10
   ListNrTimepts        =  1
   ListNrBlocks         =  1
   ListBinary           =  0
   ListType             =  3
   ListTrafoType        =  0
   ListGridType         =  2
   ListFirstColumn      =  1
   ListIndexMin         = -1
   ListIndexMax         = -1
   ListIndexAbsMax      = -1
IMPEDANCE_VALUES END

IMPEDANCE_VALUES START_LIST	# Do not edit!
  9871	 12442	 17649	 13102	 14253	 15033	 10513	 18967	 10114	 13667	 7068	 4591	 18177	 5596	 15204	 15351	 11921	 21504	 19095	 24288	 24735	 20308	 16984	 8665	 10267	 18437	 14242	 13812	 12748	 19413	 19826	 8910	 22469	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
 -1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1	-1
IMPEDANCE_VALUES END_LIST

from looking into the data in eeglab it seems there is in fact only 33 eeg/physio channels + 1 trigger channel. makes sense this one doesnt have an impedance measurement.
as said, i am new to curry formats so i dont know whether this is format intended or caused by erroneous settings.

code wise, the python reader might be improved to handle this case (if the -1 is intended).
less preferred, it could also ignore impedances when errors occur, e.g. via try wrapping - i did that as a hotfix and there are no follow-up errors due to the missing impedance values

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions