123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html><head><title>Python: module mnetonix</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- </head><body bgcolor="#f0f0f8">
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
- <tr bgcolor="#7799ee">
- <td valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>mnetonix</strong></big></big></font></td
- ><td align=right valign=bottom
- ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/Users/achilleas/code/pilsen-workshop/DataConversionToNIX/mnetonix.py">/Users/achilleas/code/pilsen-workshop/DataConversionToNIX/mnetonix.py</a></font></td></tr></table>
- <p><tt>mnetonix.py<br>
- <br>
- Usage:<br>
- python mnetonix.py [--split-data] [--split-stimuli] <datafile> <montage><br>
- <br>
- Arguments:<br>
- datafile Either an EDF file or a BrainVision header file (vhdr).<br>
- montage Any format montage file supported by MNE.<br>
- <br>
- Flags:<br>
- --split-data If specified, each channel of raw data is stored in its own<br>
- separate DataArray.<br>
- <br>
- --split-stimuli If specified, each stimulus type (identified by its label)<br>
- is stored in a separate MultiTag (one MultiTag per<br>
- stimulus type).<br>
- <br>
- <br>
- (Requires Python 3)<br>
- <br>
- Command line script for reading EDF and BrainVision files using MNE<br>
- (mne-python) and storing the data and metadata into a NIX file. Supports<br>
- reading montage files for recording channel locations.<br>
- <br>
- To include in a script, call the '<a href="#-write_raw_mne">write_raw_mne</a>()' and provide a NIX filename<br>
- and MNE Raw structure as arguments.<br>
- <br>
- NIX Format layout<br>
- =================<br>
- <br>
- Data<br>
- ----<br>
- Raw Data are stored in either a single 2-dimensional DataArray or a collection<br>
- of DataArrays (one per recording channel). The latter makes tagging easier<br>
- since MultiTag positions and extents don't need to specify every channel they<br>
- reference. However, creating multiple DataArrays makes file sizes much<br>
- bigger.<br>
- <br>
- Stimuli<br>
- -------<br>
- MNE provides stimulus information through the Raw.annotations dictionary.<br>
- Onsets correspond to the 'positions' array and durations correspond to the<br>
- 'extents' array of the "Stimuli" MultiTag. If stimulus information is split<br>
- by label, each MultiTag uses the label as its name.<br>
- <br>
- Metadata<br>
- --------<br>
- MNE collects metadata into a (nested) dictionary (Raw.info). All non-empty<br>
- keys are converted into Properties in NIX. The nested structure of the<br>
- dictionary is replicated in NIX by creating child Sections, starting with one<br>
- root section with name "Info".<br>
- <br>
- Some extra metadata is kept in the '_raw_extras' private member when loading<br>
- from EDF files. This seems to be missing from the 'Info' dictionary in order<br>
- to keep it anonymous (missing keys are 'subject_info', 'meas_date', 'file_id',<br>
- and 'meas_id'). The '_raw_extras' are also stored in the NIX file in a<br>
- separate Section with name "Extras".</tt></p>
- <p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#aa55cc">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
-
- <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
- <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="mne.html">mne</a><br>
- <a href="nixio.html">nixio</a><br>
- </td><td width="25%" valign=top><a href="numpy.html">numpy</a><br>
- <a href="os.html">os</a><br>
- </td><td width="25%" valign=top><a href="matplotlib.pyplot.html">matplotlib.pyplot</a><br>
- <a href="sys.html">sys</a><br>
- </td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#eeaa77">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
-
- <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
- <td width="100%"><dl><dt><a name="-create_md_tree"><strong>create_md_tree</strong></a>(section, values, block)</dt></dl>
- <dl><dt><a name="-create_stimulus_multi_tag"><strong>create_stimulus_multi_tag</strong></a>(stimtuples, block, mneraw, mtagname='Stimuli')</dt></dl>
- <dl><dt><a name="-main"><strong>main</strong></a>()</dt></dl>
- <dl><dt><a name="-plot_channel"><strong>plot_channel</strong></a>(data_array, index)</dt></dl>
- <dl><dt><a name="-separate_stimulus_types"><strong>separate_stimulus_types</strong></a>(stimuli)</dt></dl>
- <dl><dt><a name="-write_multi_da"><strong>write_multi_da</strong></a>(mneraw, block)</dt></dl>
- <dl><dt><a name="-write_raw_mne"><strong>write_raw_mne</strong></a>(nfname, mneraw, split_data_channels=False, split_stimuli=False)</dt><dd><tt>Writes the provided Raw MNE structure to a NIX file with the given name.<br>
- <br>
- :param nfname: Name for the NIX file to write to. Existing file will be<br>
- overwritten.<br>
- :param mneraw: An MNE Raw structure (any mne.io.BaseRaw subclass).<br>
- :param split_data_channels: If True, each raw data channel will be stored<br>
- in a separate DataArray.<br>
- :param split_stimuli: If True, stimuli will be split into separate<br>
- MultiTags based on the stimulus type (label).<br>
- :rtype: None</tt></dd></dl>
- <dl><dt><a name="-write_single_da"><strong>write_single_da</strong></a>(mneraw, block)</dt></dl>
- <dl><dt><a name="-write_stim_tags"><strong>write_stim_tags</strong></a>(mneraw, block, split)</dt></dl>
- </td></tr></table><p>
- <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
- <tr bgcolor="#55aa55">
- <td colspan=3 valign=bottom> <br>
- <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
-
- <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td>
- <td width="100%"><strong>DATA_BLOCK_NAME</strong> = 'EEG Data Block'<br>
- <strong>DATA_BLOCK_TYPE</strong> = 'Recording'<br>
- <strong>RAW_DATA_GROUP_NAME</strong> = 'Raw Data Group'<br>
- <strong>RAW_DATA_GROUP_TYPE</strong> = 'EEG Channels'<br>
- <strong>RAW_DATA_TYPE</strong> = 'Raw Data'</td></tr></table>
- </body></html>
|