dengemann / meeg-preprocessing Goto Github PK
View Code? Open in Web Editor NEWPreprocessing tools for MEG/EEG
License: BSD 2-Clause "Simplified" License
Preprocessing tools for MEG/EEG
License: BSD 2-Clause "Simplified" License
Hi,
I tried to launch the example script plot_preprocess_filter_ica.py but I got the following error at the check_apply_filter function line: " 'RawFIFF' object has no attribute 'plot_psd' ". Indeed you cannot apply this function to the raw file... Could it be a version problem (I'm using 0.9.dev)?
By the way, I'm wondering if this example is doing the same thing than the example in mne-python (Compute ICA components on raw data). I saw that here you're doing some supplementary filtering, why is it for?
Thanks,
Laetitia
It would be nice to have a stupid 'done' file in a run folder.
This would come in handy to programmatically delete runs that were unsuccessful.
@dengemann we were speaking of adding a parameter to the run_ica function, so as to decimate the epoched ecg and eog.
Would it not be more efficient to decimate the raw data before passing it to compute data (and redecimate it one more time for the ica.fit)?
raw is used to create ecp_epochs (see first line of code below).
raw could include all the channels (i.e. STI, MISC,...), contrary to the output of create_ecg_epochs() (here ecg_epochs) which only includes MAG, GRAD and EEG.
Because of this, a mismatch may appear between the argumtant picks (based on raw) in compute_ica() used in the bottom line of the code below and the actual channels of ecg_epochs.
For instance :
len(raw.ch_names) = 405
len(ecp_epochs.ch_names) = 306
raw.ch_names[405] = 'EEG60'
ecp_epochs.ch_names[306] = 'EEG60'
So for the channel EEG60, the "picks" would point to index 405 according to raw which is out of the bound for ecg_epochs.
def compute_ica(raw, subject, n_components=0.99, picks=None, decim=None,
reject=None, ecg_tmin=-0.5, ecg_tmax=0.5, eog_tmin=-0.5,
eog_tmax=0.5, n_max_ecg=3, n_max_eog=1,
n_max_ecg_epochs=200, img_scale=1.0,
report=None):
...
ecg_epochs = create_ecg_epochs(raw, tmin=ecg_tmin, tmax=ecg_tmax,
picks=None, reject={'mag': 5e-12})
n_ecg_epochs_found = len(ecg_epochs.events)
n_max_ecg_epochs = min(n_max_ecg_epochs, n_ecg_epochs_found)
sel_ecg_epochs = np.arange(n_ecg_epochs_found)
rng = np.random.RandomState(42)
rng.shuffle(sel_ecg_epochs)
ecg_epochs = ecg_epochs[sel_ecg_epochs[:n_max_ecg_epochs]]
ecg_inds, scores = ica.find_bads_ecg(ecg_epochs, method='ctps')
if len(ecg_inds) > 0:
ecg_evoked = ecg_epochs.average(picks=picks)
I'm writing a home made little script that save the fname of each file I create. For instance if I save some epochs: epochs.save(fname)
, I add logfiles.add(fname)
, so that I can easily upload the necessary files between EC2 and S3. Do you think it'd be worth adding this kind of option to the report directly?
I get an init error when I use meeg_preprocessing with python 3.6 and seaborn
import seaborn
from meeg_preprocessing.utils import get_versions, sys
get_versions(sys)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-8d49af5e3bc8> in <module>()
6 continue
7 print(name)
----> 8 module_version = LooseVersion(getattr(module, '__version__', None))
~/anaconda3/lib/python3.6/distutils/version.py in __init__(self, vstring)
302 def __init__ (self, vstring=None):
303 if vstring:
--> 304 self.parse(vstring)
305
306
~/anaconda3/lib/python3.6/distutils/version.py in parse(self, vstring)
310 # use by __str__
311 self.vstring = vstring
--> 312 components = [x for x in self.component_re.split(vstring)
313 if x and x != '.']
314 for i, obj in enumerate(components):
TypeError: cannot use a string pattern on a bytes-like object
This issue comes from LooseVersion
and the module _curse
import seaborn as sns
import sys
from distutils.version import LooseVersion
for name, module in sys.modules.items():
if '.' in name:
continue
print(name)
module_version = LooseVersion(getattr(module, '__version__', None))
I reckon we skip packages that start with '_'
To make processing many runs easier, compute ICA on concatenated epochs.
utlity functions to preconfigure logging, directories and reports
cc @kingjr
To make contribs easier.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.