sappelhoff / pyprep

A Python implementation of the Preprocessing Pipeline (PREP) for EEG data
https://pyprep.readthedocs.io/en/latest/
MIT License
128 stars 30 forks source link

Passing a custom montage to the PrepPipeline(raw, montage=?)? #111

Closed neerajww closed 1 year ago

neerajww commented 2 years ago

Hi,

I am working with an (open-access )EEG dataset which has 255 channels (https://zenodo.org/record/4518754#.YfukTfXTXLC). It is curry file format, and I can load the dataset in mne with its montage information.

 raw = mne.io.read_raw_curry( <filename> + '.dat')

I am confused on how to pass the "montage" information to the pyrep pipeline. I will appreciate any help with this. Excuse me if this is a naive question.

neerajww commented 2 years ago

As a follow up, i tried with montage=None expecting the PrepPipeline will extract information from the raw object.

PrepPipeline(raw, prep_params, montage=None)

But then I get the following (different) error. image

sappelhoff commented 2 years ago

regarding your first question, see this example: https://pyprep.readthedocs.io/en/latest/auto_examples/run_full_prep.html?highlight=montage#load-data-and-prepare-it

regarding your second problem, that is a bit unexpected. Could you try saving your raw using raw.save, and then loading it again using mne.io.read_raw_fif? If the error disappears then, it might be a problem in MNE-Python with the curry data format

neerajww commented 2 years ago

Thank you for the reply. I tried raw.save() saving the file as .fif but the error persists. image

sappelhoff commented 2 years ago

You have to save as fif AND THEN reload the data from that saved fif datafile. Only saving is not enough :-) ... but the error log looks like you did exactly that. Weird how you still get an issue.

Can you do:

print(raw.get_data().shape)

and report what you get here?

Also can you run

import mne
mne.sys_info() 

and report the outputs here?

Which version of pyprep are you using, and how did you install it?

neerajww commented 2 years ago

Yes, you guessed right- I saved + reloaded - the data. Below is the version information. image

Using the preload=True solved it. Thank you! image