osl_ephys.maxfilter#
Submodules#
Attributes#
Functions#
|
Checks if an output directory exists and if not creates it. |
|
Add sub-directory. |
|
Process inputs for several cases |
|
Estimates and stores head position parameters but does not transform data |
|
Estimates head movements and transforms data. |
|
Estimates head movements and transforms data with intermittent HPI |
|
sets the error limit for hpi coil fitting (def 5 mm) |
|
sets the g-value limit for hpi coil fitting (def 0.98) |
|
subtracts hpi signals: chpi sine amplitudes, amp + linefreq harmonics, |
|
sets automated bad channel detection on: scan the whole raw data file, off: no autobad |
|
sets automated bad channel detection on with specified duration. |
|
Threshold for bad channel detection (>ave+X*SD) |
|
sets the list of static bad channels (logical chnos, e.g.: 0323 1042 2631) |
|
sets the basic line interference frequency (50/60Hz) |
|
Add all tsss related args |
|
transforms the data into head position in <fiff_file> |
|
Ignore program warnings.... |
|
sets the order of the inside expansion |
|
sets the order of the outside expansion |
|
uses the cross-talk matrix in <ctcfile> |
|
uses the fine-calibration in <calfile> |
|
set a custom sphere origin. |
|
set origin frame. |
|
|
|
|
|
|
|
Wrapper for Elekta Maxfilter. |
|
Wrapper for running |
|
Wrapper for running |
|
Batch Maxfiltering. |
|
Package Contents#
- osl_ephys.maxfilter.validate_outdir(outdir)[source]#
Checks if an output directory exists and if not creates it.
- osl_ephys.maxfilter.process_file_inputs(inputs)[source]#
Process inputs for several cases
The argument, inputs, can be… 1) string path to unicode file 2) string path to dir (e.g. if CTF .ds dir) 3) string path to file or regular-expression matching files 4) list of string paths to files 5) list of string paths to dirs (e.g. if CTF .ds dirs) 6) list of tuples with path to file and output name pairs 7) list of MNE objects
- osl_ephys.maxfilter._add_headpos(cmd, args, outfif)[source]#
Estimates and stores head position parameters but does not transform data
- osl_ephys.maxfilter._add_movecomp(cmd, args)[source]#
Estimates head movements and transforms data.
Data are transformed to reference head position in continuous raw data
- osl_ephys.maxfilter._add_movecompinter(cmd, args)[source]#
Estimates head movements and transforms data with intermittent HPI
Data are transformed to reference head position in continuous raw data
- osl_ephys.maxfilter._add_hpie(cmd, args)[source]#
sets the error limit for hpi coil fitting (def 5 mm)
- osl_ephys.maxfilter._add_hpig(cmd, args)[source]#
sets the g-value limit for hpi coil fitting (def 0.98)
- osl_ephys.maxfilter._add_hpisubt(cmd, args)[source]#
subtracts hpi signals: chpi sine amplitudes, amp + linefreq harmonics, or switch off (def = amp)
- osl_ephys.maxfilter._add_autobad(cmd, args)[source]#
sets automated bad channel detection on: scan the whole raw data file, off: no autobad
- osl_ephys.maxfilter._add_autobad_dur(cmd, args)[source]#
sets automated bad channel detection on with specified duration.
- osl_ephys.maxfilter._add_badlimit(cmd, args)[source]#
Threshold for bad channel detection (>ave+X*SD)
- osl_ephys.maxfilter._add_bad(cmd, args)[source]#
sets the list of static bad channels (logical chnos, e.g.: 0323 1042 2631)
- osl_ephys.maxfilter._add_linefreq(cmd, args)[source]#
sets the basic line interference frequency (50/60Hz)
- osl_ephys.maxfilter._add_trans(cmd, args)[source]#
transforms the data into head position in <fiff_file>
- osl_ephys.maxfilter.run_maxfilter(infif, outfif, args, logfile_tag='')[source]#
Wrapper for Elekta Maxfilter.
- Parameters:
infif (str) – Path to input fif file (raw data).
outfif (str) – Path to output fif file (maxfiltered).
args (dict) – Dictionary of arguments to pass to maxfilter. See
help(osl_ephys.maxfilter)for all options, and Notes for recommendations.logfile_tag (str, optional) – Tag to append to logfile name. The default is ‘’. This is used to differentiate between different stages of maxfiltering (e.g.,
'_trans','_tsss').
- Returns:
outfif (str) – Path to output fif file (maxfiltered).
stdlog (str) – Path to logfile.
Notes
The recommended use for maxfilter at OHBA is to run multistage maxfiltering, with the following options:
args = {'maxpath': '/neuro/bin/util/maxfilter', 'scanner': 'Neo', 'mode': 'multistage', 'tsss': {}, 'headpos': {}, 'movecomp': {}}
- osl_ephys.maxfilter.run_multistage_maxfilter(infif, outbase, args)[source]#
Wrapper for running
run_maxfilterin three sequential steps:Find Bad Channels
Signal Space Separation
Translate to reference file
- Parameters:
infif (str) – Path to input fif file (raw data).
outbase (str) – output directory.
args (dict) – Dictionary of arguments to pass to maxfilter. See
help(osl_ephys.maxfilter)for all options.
Notes
All files are written to disk and the output of each stage is used as the input to the next.
General advice (from CBU):
don’t use
'trans'with'movecomp'don’t use
'autobad'with'headpos'or'movecomp'don’t use
'autobad'with'st'
References
https://imaging.mrc-cbu.cam.ac.uk/meg/Maxfilter https://imaging.mrc-cbu.cam.ac.uk/meg/maxbugs
- osl_ephys.maxfilter.run_cbu_3stage_maxfilter(infif, outbase, args)[source]#
Wrapper for running
run_maxfilterin three sequential steps used by MRC Cognition and Brain Sciences Unit (CBU) in Cambridge:Fit Origin without nose
Find Bad Channels
Signal Space Separation
Translate to default
- Parameters:
infif (str) – Path to input fif file (raw data).
outbase (str) – output directory.
args (dict) – Dictionary of arguments to pass to maxfilter. See
help(osl_ephys.maxfilter)for all options.
Notes
All files are written to disk and the output of each stage is used as the input to the next.
References
https://imaging.mrc-cbu.cam.ac.uk/meg/Maxfilter https://imaging.mrc-cbu.cam.ac.uk/meg/maxbugs
- osl_ephys.maxfilter.run_maxfilter_batch(files, outdir, args=None)[source]#
Batch Maxfiltering.
- Parameters:
files (str or list of str) – Path(s) to raw fif files to maxfilter.
outdir (str) – Path to directory to save output to.
args (str) – List of additional optional arguments to pass to osl_maxfilter. See
help(osl_ephys.maxfilter)for all options. If a string is passed it it split input a list (delimited by spaces). E.g.args="--maxpath /neuro/bin/util/maxfilter"is equivalent toargs=["--maxpath", "/neuro/bin/util/maxfilter"].
Notes
Example use:
>>> run_maxfilter_batch(files="/path/to/fif", outdir="/path/to/outdir", args="--maxpath /neuro/bin/util/maxfilter --scanner Neo --tsss --mode multistage --headpos --movecomp")