Closed maciekswat closed 6 years ago
To add an example of ICA as it will be used in the pipeline, assume we have just run the code above; then we run the following:
# Initialize the ICA object and run on our Raw object (NOTE: THIS CAN TAKE OVER AN HOUR!)
ica = mne.preprocessing.ICA(method='fastica')
ica.fit(raw, picks=mne.pick_types(raw.info, eeg=True, eog=True))
# Detect blink components based on their correlation with an EOG channel
ica.exclude = ica.find_bads_eog(raw, threshold=3.)[0]
# Save ICA solution as a .fif file
ica_path = '/data/eeg/scalp/ltp/example_data/LTP123_4-ica.fif'
ica.save(ica_path)
# Load our saved ICA object
ica = mne.preprocessing.read_ica(ica_path)
# Remove the components we previously marked for exclusion
ica.apply(raw)
Our Raw object has now (hopefully!) been cleaned of blinks. The option to load the ICA solution and apply it to our re-referenced time series could be added as a parameter to the proposed PTSA "read_mne" function. In other words we could have three load options - load non-re-referenced data, load re-referenced data, and load re-referenced and ICA cleaned data. (ICA will be run on the re-referenced data, so the data will need the common average reference applied before applying ICA!)
I'm closing this since we should focus on loading data with cmlreaders. When loading EEG data there, it returns a simple container type which has methods to convert to PTSA or MNE formats.
Here is a code sample to demonstrate some basic MNE functionality: