Resting EEG¶
Design:
3 minute recording
eyes open vs. eyes closed
Data format: mkpy.mkh5
HDF5
The mkpy.mkh5 data file s000eeg.h5
is a single HDF5 file with four HDF5 groups, each group has one HDF5 dataset, dblock_0, the uninterrupted EEG recording.
/open
/closed
/cals_AD_before
/cals_10uV_after
In longer experimental sessions where the recording is paused from time to time, the data group spans multiple, sequentially labeled data blocks, _dblock_0, dblock_1, … \dblockn, each an uninterrupted recording.
The A/D EEG recordings are converted to a \(\mu\mathrm{V}\) scale via the (mean) \(10\mu\mathrm{V}\) square wave. The calibration pulses are recorded in .crw
, and .log
files are read and converted to HDF5 the same way as EEG data files. Calibration data are typically recorded for each experimental session, so by default each data group is scanned for a dblock with calibration pulses. However since these EEG recordings are from the same session, a single calibration data can be
re-used for the different data groups as shown below.
Example 1 shows how to read the read the HDF5 header and EEG recordings into a pandas.DataFrame with mkpy.
Example 2 shows the contents of the data block headers including sensor location coordinates.
Example 3 shows how to read the HDF5 dblock header and numpy structured array EEG data directly with h5py.
[1]:
import os
import sys
from pathlib import Path
import re
import numpy as np
import pandas as pd
import mkpy
import spudtr
from matplotlib import pyplot as plt
from mkpy import mkh5
from spudtr import epf
# path wrangling for nbsphinx
if "MDE_HOME" in os.environ.keys():
MDE_HOME = Path(os.environ["MDE_HOME"])
else:
from conf import MDE_HOME
DOCS_DATA = MDE_HOME / "docs/_data"
print(os.environ["CONDA_DEFAULT_ENV"])
print(sys.version)
for pkg in [np, pd, mkpy, spudtr]:
print(pkg.__name__, pkg.__version__, pkg.__file__)
mkconda_dev_py39_053022
3.9.13 | packaged by conda-forge | (main, May 27 2022, 16:56:21)
[GCC 10.3.0]
numpy 1.21.6 /home/turbach/miniconda39/envs/mkconda_dev_py39_053022/lib/python3.9/site-packages/numpy/__init__.py
pandas 1.1.5 /home/turbach/miniconda39/envs/mkconda_dev_py39_053022/lib/python3.9/site-packages/pandas/__init__.py
mkpy 0.2.7 /mnt/cube/home/turbach/TPU_Projects/mkpy/mkpy/__init__.py
spudtr 0.1.0 /home/turbach/miniconda39/envs/mkconda_dev_py39_053022/lib/python3.9/site-packages/spudtr/__init__.py
Convert and calibrate the ``.crw``, ``.log`` to mkpy.mkh5 format HDF5
Notes:
only A/D cals are needed for calibration, the 10 uV copy is just for illustration.
the negative event code warning is expected and signals the the pause mark at the end of the recording
[2]:
# 1. set the fileHDF5 file and load the EEG data
eeg_h5_f = DOCS_DATA / "sub000eeg.h5"
eeg_h5 = mkh5.mkh5(eeg_h5_f) # wipe previous
eeg_h5.reset_all() # wipe previous
for h5_group in ["open", "closed"]:
crw = MDE_HOME / f"mkdig/sub000r{h5_group[0]}.crw" # resting EEG eyes open
log = MDE_HOME / f"mkdig/sub000r{h5_group[0]}.x.log" # events
yhdr = MDE_HOME / f"mkpy/sub000r{h5_group[0]}.yhdr" # extra header info
# eyes open, closed EEG data sets
eeg_h5.create_mkdata(h5_group, crw, log, yhdr)
# 2. set calibration pulse parameters and files
pts, pulse, lo, hi, ccode = 5, 10, -40, 40, 0
cals_crw = MDE_HOME / "mkdig/sub000c.crw"
cals_log = MDE_HOME / "mkdig/sub000c.x.log"
cals_yhdr = MDE_HOME / "mkpy/sub000c.yhdr"
# A/D square wave cal data are needed for calibration
eeg_h5.create_mkdata("cals_AD_before", cals_crw, cals_log, cals_yhdr)
# this copy is scaled as if EEG data for illustration only
eeg_h5.create_mkdata("cals_10uV_after", cals_crw, cals_log, cals_yhdr)
for h5_group in ["open", "closed", "cals_10uV_after"]:
eeg_h5.calibrate_mkdata(
h5_group, # data group to calibrate with these cal pulses
n_points=pts, # pts to average
cal_size=pulse, # uV
lo_cursor=lo, # lo_cursor ms
hi_cursor=hi, # hi_cursor ms
cal_ccode=ccode, # condition code
use_cals="cals_AD_before" # alternate data group to find calibration pulses
)
print("\n" * 2)
print("These are the HDF5 datasets in the HDF5 file")
dblock_paths = eeg_h5.dblock_paths
display(dblock_paths)
/mnt/cube/home/turbach/TPU_Projects/mkpy/mkpy/mkh5.py:3666: UserWarning: negative event code(s) found for cal condition code 0 -16384
warnings.warn(msg)
Found cals in /cals_AD_before/dblock_0
Calibrating block /open/dblock_0 of 1: (45568,)
Found cals in /cals_AD_before/dblock_0
Calibrating block /closed/dblock_0 of 1: (45568,)
Found cals in /cals_AD_before/dblock_0
Calibrating block /cals_10uV_after/dblock_0 of 1: (28416,)
These are the HDF5 datasets in the HDF5 file
['cals_10uV_after/dblock_0',
'cals_AD_before/dblock_0',
'closed/dblock_0',
'open/dblock_0']
Example 1. importing mkh5 EEG recordings into a pandas.DataFrame with mkpy
[3]:
dblocks = list()
hdrs = list()
for dbp in dblock_paths:
# hdr is a large dict() that includes sample rate and sensor locations among other things
# dblock is a 1-D numpy structured array (named numeric dtypes): samples (rows) x data streams (columns)
hdr, dblock = eeg_h5.get_dblock(dbp)
# sanity check the fully qualified HDF5 root path /group/dblock_0
# as logged in the header when the data were converted
assert dbp == hdr["h5_dataset"][1:]
# convert to dataframe and track the dblock sequence
dblock = pd.DataFrame(dblock)
dblock.insert(0, "dblock_path", dbp)
#(optional) grab useful info from the header
dblock.insert(0, "sub_id", hdr["runsheet"]["subid"])
# capture
dblocks.append(dblock)
hdrs.append(hdr)
eeg_pd = pd.concat(dblocks)
display(eeg_pd)
sub_id | dblock_path | dblock_ticks | crw_ticks | raw_evcodes | log_evcodes | log_ccodes | log_flags | pygarv | lle | ... | RMOc | LLTe | RLTe | LLOc | RLOc | MiOc | A2 | HEOG | rle | rhz | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | demonstration | cals_10uV_after/dblock_0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000000 | ... | -0.737793 | 0.251221 | 0.493408 | -0.248413 | -0.245972 | -0.242920 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
1 | demonstration | cals_10uV_after/dblock_0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.000000 | ... | -1.229492 | 0.000000 | 0.000000 | -0.248413 | -0.245972 | -0.242920 | -0.492188 | 0.000000 | -0.487549 | 0.000000 |
2 | demonstration | cals_10uV_after/dblock_0 | 2 | 2 | 0 | 0 | 0 | 0 | 0 | 0.000000 | ... | -0.245972 | 0.502441 | 0.246704 | 0.000000 | -0.245972 | -0.242920 | 0.000000 | 0.489502 | 0.000000 | 0.485840 |
3 | demonstration | cals_10uV_after/dblock_0 | 3 | 3 | 0 | 0 | 0 | 0 | 0 | 0.000000 | ... | 0.000000 | 0.000000 | 0.246704 | 0.248413 | -0.245972 | -0.242920 | -0.246094 | 0.244751 | 0.000000 | 0.000000 |
4 | demonstration | cals_10uV_after/dblock_0 | 4 | 4 | 0 | 0 | 0 | 0 | 0 | 0.000000 | ... | -0.245972 | 0.251221 | 0.493408 | 0.000000 | -0.245972 | 0.000000 | 0.000000 | 0.489502 | 0.000000 | 0.485840 |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
45563 | demonstration | open/dblock_0 | 45563 | 45563 | 0 | 0 | 0 | 0 | 0 | -5.105469 | ... | 7.132812 | 0.753906 | -2.712891 | 7.949219 | -1.475586 | 7.289062 | -2.214844 | -15.906250 | 10.242188 | -0.485840 |
45564 | demonstration | open/dblock_0 | 45564 | 45564 | 0 | 0 | 0 | 0 | 0 | 6.808594 | ... | 3.197266 | -4.523438 | -8.390625 | 6.210938 | -5.656250 | 5.101562 | -9.593750 | -23.000000 | 1.950195 | -5.343750 |
45565 | demonstration | open/dblock_0 | 45565 | 45565 | 0 | 0 | 0 | 0 | 0 | 11.914062 | ... | 5.902344 | 0.251221 | -4.687500 | 10.187500 | -3.197266 | 8.015625 | -4.183594 | -31.328125 | 6.339844 | -6.316406 |
45566 | demonstration | open/dblock_0 | 45566 | 45566 | 0 | 0 | 0 | 0 | 0 | 4.539062 | ... | 4.671875 | 8.039062 | -6.414062 | 7.949219 | -2.705078 | 8.742188 | -1.722656 | -22.265625 | 17.062500 | -0.971680 |
45567 | demonstration | open/dblock_0 | 45567 | 45567 | -16384 | -16384 | 1 | 0 | 0 | 7.945312 | ... | 4.425781 | 7.285156 | -7.894531 | 6.210938 | 0.491943 | 10.687500 | -5.906250 | -26.187500 | 17.546875 | -1.457031 |
147968 rows × 41 columns
Note the applying the calibration routine to the A/D calibration pulses scales the to \(10 \mu\mathrm{V}\).
[4]:
#import matplotlib as mpl
with plt.style.context({"font.size": 18}):
f, ax = plt.subplots(figsize=(12, 8))
for dblock_path, dblock_data in eeg_pd.groupby("dblock_path"):
dblock_data["MiPa"][0:500].plot(label=dblock_path, ax=ax)
ax.axhline(10, color='lightgray', lw=.5, alpha=.6)
ax.set(xlabel= "Samples", ylabel="$\mu\mathrm{V}$")
ax.set_title("EEG recording 500 samples")
ax.legend(bbox_to_anchor=(1,1))
Example 2: dblock headers
[5]:
eeg_hdrs = dict([(hdr["h5_dataset"], hdr) for hdr in hdrs])
display(eeg_hdrs.keys())
display(eeg_hdrs["/closed/dblock_0"])
dict_keys(['/cals_10uV_after/dblock_0', '/cals_AD_before/dblock_0', '/closed/dblock_0', '/open/dblock_0'])
{'runsheet': {'name': 'runsheet',
'experiment': 'resting EEG eyes closed',
'subid': 'demonstration',
'date': '08-22-2018',
'hand': 'LRRL',
'license': 'Creative Commons Attribution-NonCommercial-ShareAlike (CC BY-NC-SA) 4.0',
'notes': 'These EEG recordings were made for instructional purposes and are not human subjects research data. This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode'},
'apparatus': {'name': 'apparatus',
'mne_montage_name': '26chan',
'common_ref': 'A1',
'gain20K': 20000,
'gain10K': 10000,
'lp': 100.0,
'hp': 0.01,
'streams': {'lle': {'pos': 'lle',
'neg': 'A1',
'gain': 10000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'lhz': {'pos': 'lhz',
'neg': 'A1',
'gain': 10000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'MiPf': {'pos': 'MiPf',
'neg': 'A1',
'gain': 10000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LLPf': {'pos': 'LLPf',
'neg': 'A1',
'gain': 10000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LLFr': {'pos': 'LLFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LLTe': {'pos': 'LLTe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LLOc': {'pos': 'LLOc',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'MiOc': {'pos': 'MiOc',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LDFr': {'pos': 'LDFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LDCe': {'pos': 'LDCe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LDPa': {'pos': 'LDPa',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LMPf': {'pos': 'LMPf',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LMFr': {'pos': 'LMFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LMCe': {'pos': 'LMCe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'LMOc': {'pos': 'LMOc',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'MiCe': {'pos': 'MiCe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'MiPa': {'pos': 'MiPa',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'rle': {'pos': 'rle',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'rhz': {'pos': 'rhz',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'A2': {'pos': 'A2',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RLPf': {'pos': 'RLPf',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RLFr': {'pos': 'RLFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RLTe': {'pos': 'RLTe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RLOc': {'pos': 'RLOc',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RDFr': {'pos': 'RDFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RDCe': {'pos': 'RDCe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RDPa': {'pos': 'RDPa',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RMPf': {'pos': 'RMPf',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RMFr': {'pos': 'RMFr',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RMCe': {'pos': 'RMCe',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'RMOc': {'pos': 'RMOc',
'neg': 'A1',
'gain': 20000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eeg'},
'HEOG': {'pos': 'lhz',
'neg': 'rhz',
'gain': 10000,
'hphz': 0.01,
'lphz': 100.0,
'mne_type': 'eog'}},
'space': {'coordinates': 'cartesian',
'distance_unit': 'cm',
'orientation': 'ras'},
'fiducials': {'lpa': {'x': -6.9, 'y': 0.0, 'z': 0.0},
'nasion': {'x': 0.0, 'y': 8.5, 'z': 0.0},
'rpa': {'x': 6.9, 'y': 0.0, 'z': 0.0}},
'sensors': {'A1': {'x': -6.2, 'y': -3.4, 'z': -0.1},
'A2': {'x': 6.2, 'y': -3.4, 'z': -0.1},
'GND': {'x': 0.0, 'y': 9.6, 'z': 8.5},
'LDCe': {'x': -7.0, 'y': 0.6, 'z': 10.2},
'LDFr': {'x': -5.7, 'y': 4.8, 'z': 10.0},
'LDPa': {'x': -5.8, 'y': -3.3, 'z': 10.1},
'LLFr': {'x': -7.7, 'y': 2.5, 'z': 5.1},
'LLOc': {'x': -5.0, 'y': -6.6, 'z': 6.1},
'LLPf': {'x': -5.7, 'y': 7.2, 'z': 5.0},
'LLTe': {'x': -7.8, 'y': -2.2, 'z': 5.5},
'LMCe': {'x': -3.9, 'y': -0.3, 'z': 13.3},
'LMFr': {'x': -2.7, 'y': 4.3, 'z': 13.2},
'LMOc': {'x': -2.3, 'y': -5.8, 'z': 10.2},
'LMPf': {'x': -2.3, 'y': 8.2, 'z': 9.9},
'MiCe': {'x': 0.0, 'y': 1.7, 'z': 14.7},
'MiOc': {'x': 0.0, 'y': -8.3, 'z': 6.0},
'MiPa': {'x': 0.0, 'y': -2.7, 'z': 13.2},
'MiPf': {'x': 0.0, 'y': 9.8, 'z': 5.6},
'RDCe': {'x': 7.0, 'y': 0.6, 'z': 10.2},
'RDFr': {'x': 5.7, 'y': 4.8, 'z': 10.0},
'RDPa': {'x': 5.8, 'y': -3.3, 'z': 10.1},
'RLFr': {'x': 7.7, 'y': 2.5, 'z': 5.1},
'RLOc': {'x': 5.0, 'y': -6.6, 'z': 6.1},
'RLPf': {'x': 5.7, 'y': 7.2, 'z': 5.0},
'RLTe': {'x': 7.8, 'y': -2.2, 'z': 5.5},
'RMCe': {'x': 3.9, 'y': -0.3, 'z': 13.3},
'RMFr': {'x': 2.7, 'y': 4.3, 'z': 13.2},
'RMOc': {'x': 2.3, 'y': -5.8, 'z': 10.2},
'RMPf': {'x': 2.3, 'y': 8.2, 'z': 9.9},
'lhz': {'x': -6.7, 'y': 5.5, 'z': 1.1},
'lle': {'x': -4.5, 'y': 7.7, 'z': -1.7},
'rhz': {'x': 6.7, 'y': 5.5, 'z': 1.1},
'rle': {'x': 4.5, 'y': 7.7, 'z': -1.7}}},
'yhdr_file': '/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/mkpy/sub000rc.yhdr',
'yhdr_file_md5': '6acae31bea4e856dedd74153991c386b',
'streams': {'dblock_ticks': {'jdx': 0,
'source': 't_dblock_ticks',
'name': 'dblock_ticks',
'dt': '<u4'},
'crw_ticks': {'jdx': 1,
'source': 't_crw_ticks',
'name': 'crw_ticks',
'dt': '<u4'},
'raw_evcodes': {'jdx': 2,
'source': 't_raw_evcodes',
'name': 'raw_evcodes',
'dt': '<i2'},
'log_evcodes': {'jdx': 3,
'source': 't_log_evcodes',
'name': 'log_evcodes',
'dt': '<i2'},
'log_ccodes': {'jdx': 4,
'source': 't_log_ccodes',
'name': 'log_ccodes',
'dt': '<u2'},
'log_flags': {'jdx': 5,
'source': 't_log_flags',
'name': 'log_flags',
'dt': '<u2'},
'pygarv': {'jdx': 6, 'source': 't_pygarv', 'name': 'pygarv', 'dt': '<u8'},
'lle': {'jdx': 7,
'source': 'dig_chan_0000',
'name': 'lle',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 17.631677600749764,
'var': 0.03942594087426394,
'median': 17.636363636363637,
'iqr': 0.2727272727272734,
'n_cals': 194,
'n_trimmed': 15,
'trimmed_idxs': [5,
24,
30,
43,
51,
53,
70,
79,
105,
142,
144,
155,
156,
160,
201]}},
'lhz': {'jdx': 8,
'source': 'dig_chan_0001',
'name': 'lhz',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.27537511032657,
'var': 0.08416212961239057,
'median': 20.272727272727273,
'iqr': 0.4545454545454568,
'n_cals': 206,
'n_trimmed': 3,
'trimmed_idxs': [119, 154, 202]}},
'MiPf': {'jdx': 9,
'source': 'dig_chan_0002',
'name': 'MiPf',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.001350135013503,
'var': 0.05846311453827659,
'median': 20.0,
'iqr': 0.3636363636363633,
'n_cals': 202,
'n_trimmed': 7,
'trimmed_idxs': [79, 98, 139, 143, 176, 181, 183]}},
'LLPf': {'jdx': 10,
'source': 'dig_chan_0003',
'name': 'LLPf',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.743924392439247,
'var': 0.08715419246695155,
'median': 20.72727272727273,
'iqr': 0.45454545454545325,
'n_cals': 202,
'n_trimmed': 7,
'trimmed_idxs': [8, 12, 14, 91, 164, 185, 200]}},
'RLPf': {'jdx': 11,
'source': 'dig_chan_0004',
'name': 'RLPf',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.549586776859506,
'var': 0.065138613786247,
'median': 20.545454545454547,
'iqr': 0.3636363636363633,
'n_cals': 198,
'n_trimmed': 11,
'trimmed_idxs': [8, 17, 31, 39, 50, 71, 88, 130, 134, 166, 183]}},
'LMPf': {'jdx': 12,
'source': 'dig_chan_0005',
'name': 'LMPf',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.02673796791444,
'var': 0.26642168778060565,
'median': 40.0,
'iqr': 0.8181818181818201,
'n_cals': 204,
'n_trimmed': 5,
'trimmed_idxs': [16, 65, 67, 101, 166]}},
'RMPf': {'jdx': 13,
'source': 'dig_chan_0006',
'name': 'RMPf',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.533976124885214,
'var': 0.228059246779507,
'median': 39.54545454545455,
'iqr': 0.7272727272727266,
'n_cals': 198,
'n_trimmed': 11,
'trimmed_idxs': [0, 7, 31, 83, 106, 107, 144, 162, 166, 197, 198]}},
'LDFr': {'jdx': 14,
'source': 'dig_chan_0007',
'name': 'LDFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.71219735038831,
'var': 0.13046752930731983,
'median': 40.727272727272734,
'iqr': 0.5454545454545396,
'n_cals': 199,
'n_trimmed': 10,
'trimmed_idxs': [6, 23, 26, 50, 52, 103, 107, 109, 173, 206]}},
'RDFr': {'jdx': 15,
'source': 'dig_chan_0008',
'name': 'RDFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.36138613861387,
'var': 0.19020032066212905,
'median': 40.36363636363637,
'iqr': 0.6363636363636402,
'n_cals': 202,
'n_trimmed': 7,
'trimmed_idxs': [9, 30, 43, 63, 69, 71, 197]}},
'LLFr': {'jdx': 16,
'source': 'dig_chan_0009',
'name': 'LLFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.88578088578089,
'var': 0.12872131753250624,
'median': 39.909090909090914,
'iqr': 0.5454545454545467,
'n_cals': 195,
'n_trimmed': 14,
'trimmed_idxs': [16,
34,
40,
46,
56,
59,
67,
82,
91,
112,
120,
145,
158,
192]}},
'RLFr': {'jdx': 17,
'source': 'dig_chan_0010',
'name': 'RLFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 38.734301780693535,
'var': 0.1205521089795334,
'median': 38.727272727272734,
'iqr': 0.5454545454545396,
'n_cals': 194,
'n_trimmed': 15,
'trimmed_idxs': [6,
10,
21,
34,
46,
76,
114,
123,
130,
136,
154,
181,
190,
200,
201]}},
'LMFr': {'jdx': 18,
'source': 'dig_chan_0011',
'name': 'LMFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 35.47301895964998,
'var': 0.09927423321104503,
'median': 35.45454545454546,
'iqr': 0.45454545454546036,
'n_cals': 187,
'n_trimmed': 22,
'trimmed_idxs': [17,
24,
35,
57,
58,
62,
63,
79,
107,
114,
116,
119,
141,
155,
157,
162,
168,
170,
173,
177,
195,
202]}},
'RMFr': {'jdx': 19,
'source': 'dig_chan_0012',
'name': 'RMFr',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 36.40999099909991,
'var': 0.1509074624834221,
'median': 36.45454545454546,
'iqr': 0.6363636363636402,
'n_cals': 202,
'n_trimmed': 7,
'trimmed_idxs': [42, 49, 87, 95, 108, 134, 136]}},
'LMCe': {'jdx': 20,
'source': 'dig_chan_0013',
'name': 'LMCe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.47291092745638,
'var': 0.21729356339924824,
'median': 40.45454545454546,
'iqr': 0.7272727272727266,
'n_cals': 198,
'n_trimmed': 11,
'trimmed_idxs': [11, 33, 65, 77, 113, 120, 151, 173, 188, 192, 193]}},
'RMCe': {'jdx': 21,
'source': 'dig_chan_0014',
'name': 'RMCe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 37.76762275157997,
'var': 0.21833033224941378,
'median': 37.727272727272734,
'iqr': 0.7272727272727266,
'n_cals': 187,
'n_trimmed': 22,
'trimmed_idxs': [5,
8,
36,
46,
47,
49,
64,
95,
99,
107,
114,
131,
141,
144,
147,
155,
158,
161,
168,
179,
184,
198]}},
'MiCe': {'jdx': 22,
'source': 'dig_chan_0015',
'name': 'MiCe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.55363636363637,
'var': 0.15786694214876026,
'median': 39.54545454545455,
'iqr': 0.6363636363636402,
'n_cals': 200,
'n_trimmed': 9,
'trimmed_idxs': [22, 58, 68, 111, 112, 163, 170, 183, 186]}},
'MiPa': {'jdx': 23,
'source': 'dig_chan_0016',
'name': 'MiPa',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 41.91883116883118,
'var': 0.16177896778546166,
'median': 41.909090909090914,
'iqr': 0.6363636363636402,
'n_cals': 196,
'n_trimmed': 13,
'trimmed_idxs': [30,
58,
94,
95,
121,
123,
124,
127,
130,
136,
153,
159,
181]}},
'LDCe': {'jdx': 24,
'source': 'dig_chan_0017',
'name': 'LDCe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.53590909090909,
'var': 0.24581797520661122,
'median': 39.54545454545455,
'iqr': 0.7272727272727266,
'n_cals': 200,
'n_trimmed': 9,
'trimmed_idxs': [21, 37, 84, 124, 154, 162, 179, 193, 197]}},
'RDCe': {'jdx': 25,
'source': 'dig_chan_0018',
'name': 'RDCe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 41.309938765897314,
'var': 0.3626370578698772,
'median': 41.27272727272727,
'iqr': 0.9090909090909065,
'n_cals': 193,
'n_trimmed': 16,
'trimmed_idxs': [1,
6,
7,
32,
41,
60,
76,
87,
89,
107,
117,
136,
180,
184,
198,
199]}},
'LDPa': {'jdx': 26,
'source': 'dig_chan_0019',
'name': 'LDPa',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.41233766233766,
'var': 0.3245382863889356,
'median': 40.45454545454546,
'iqr': 0.9090909090909065,
'n_cals': 196,
'n_trimmed': 13,
'trimmed_idxs': [22,
23,
39,
85,
95,
117,
130,
150,
152,
173,
175,
188,
208]}},
'RDPa': {'jdx': 27,
'source': 'dig_chan_0020',
'name': 'RDPa',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.995240361732506,
'var': 0.12043946344989712,
'median': 40.0,
'iqr': 0.5454545454545396,
'n_cals': 191,
'n_trimmed': 18,
'trimmed_idxs': [12,
19,
22,
25,
32,
42,
57,
59,
81,
89,
92,
103,
124,
147,
166,
186,
192,
195]}},
'LMOc': {'jdx': 28,
'source': 'dig_chan_0021',
'name': 'LMOc',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.739936680235196,
'var': 0.2602729946337554,
'median': 40.727272727272734,
'iqr': 0.8181818181818201,
'n_cals': 201,
'n_trimmed': 8,
'trimmed_idxs': [14, 16, 67, 82, 109, 143, 173, 182]}},
'RMOc': {'jdx': 29,
'source': 'dig_chan_0022',
'name': 'RMOc',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.65248544558891,
'var': 0.6456709589035058,
'median': 40.63636363636364,
'iqr': 1.2727272727272734,
'n_cals': 203,
'n_trimmed': 6,
'trimmed_idxs': [10, 20, 58, 103, 135, 141]}},
'LLTe': {'jdx': 30,
'source': 'dig_chan_0023',
'name': 'LLTe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 39.82286785379569,
'var': 0.30985279611836386,
'median': 39.81818181818182,
'iqr': 0.9090909090909065,
'n_cals': 194,
'n_trimmed': 15,
'trimmed_idxs': [19,
33,
42,
53,
98,
101,
117,
122,
126,
127,
153,
169,
174,
184,
207]}},
'RLTe': {'jdx': 31,
'source': 'dig_chan_0024',
'name': 'RLTe',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.53821800090458,
'var': 0.2306124899535051,
'median': 40.54545454545455,
'iqr': 0.7272727272727266,
'n_cals': 201,
'n_trimmed': 8,
'trimmed_idxs': [7, 14, 34, 38, 133, 159, 195, 203]}},
'LLOc': {'jdx': 32,
'source': 'dig_chan_0025',
'name': 'LLOc',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.24941724941725,
'var': 0.3958965665259373,
'median': 40.18181818181819,
'iqr': 1.0,
'n_cals': 195,
'n_trimmed': 14,
'trimmed_idxs': [32,
57,
61,
76,
101,
105,
110,
111,
117,
125,
143,
183,
197,
202]}},
'RLOc': {'jdx': 33,
'source': 'dig_chan_0026',
'name': 'RLOc',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.660666066606666,
'var': 0.17304493725700187,
'median': 40.63636363636364,
'iqr': 0.6363636363636331,
'n_cals': 202,
'n_trimmed': 7,
'trimmed_idxs': [32, 64, 87, 92, 100, 113, 150]}},
'MiOc': {'jdx': 34,
'source': 'dig_chan_0027',
'name': 'MiOc',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 41.16883116883117,
'var': 0.1889020070838252,
'median': 41.18181818181819,
'iqr': 0.6363636363636331,
'n_cals': 196,
'n_trimmed': 13,
'trimmed_idxs': [35,
45,
104,
109,
113,
122,
124,
147,
183,
184,
196,
199,
200]}},
'A2': {'jdx': 35,
'source': 'dig_chan_0028',
'name': 'A2',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.63586956521739,
'var': 0.24914636027746093,
'median': 40.63636363636364,
'iqr': 0.7272727272727266,
'n_cals': 184,
'n_trimmed': 25,
'trimmed_idxs': [1,
6,
17,
24,
32,
38,
39,
58,
61,
74,
94,
99,
104,
112,
119,
121,
135,
137,
150,
163,
165,
166,
172,
178,
198]}},
'HEOG': {'jdx': 36,
'source': 'dig_chan_0029',
'name': 'HEOG',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 40.85445588893865,
'var': 0.46275616996929014,
'median': 40.909090909090914,
'iqr': 1.0909090909090935,
'n_cals': 203,
'n_trimmed': 6,
'trimmed_idxs': [26, 31, 73, 190, 205, 207]}},
'rle': {'jdx': 37,
'source': 'dig_chan_0030',
'name': 'rle',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.507060900264786,
'var': 0.08080948734467619,
'median': 20.545454545454547,
'iqr': 0.4545454545454568,
'n_cals': 206,
'n_trimmed': 3,
'trimmed_idxs': [20, 70, 97]}},
'rhz': {'jdx': 38,
'source': 'dig_chan_0031',
'name': 'rhz',
'dt': '<f2',
'calibrated': True,
'cals': {'cal_srate': 250.0,
'cal_dblock': ['/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/docs/_data/sub000eeg.h5/cals_AD_before/dblock_0'],
'cal_args': {'n_points': 5,
'cal_size': 10.0,
'lo_cursor': -40.0,
'hi_cursor': 40.0,
'cal_ccode': 0},
'scale_by': 20.578125000000004,
'var': 0.0840307818956612,
'median': 20.545454545454547,
'iqr': 0.45454545454545325,
'n_cals': 192,
'n_trimmed': 17,
'trimmed_idxs': [26,
31,
49,
86,
92,
104,
121,
122,
130,
133,
142,
168,
173,
178,
204,
207,
208]}}},
'name': 'dig',
'magic': 38821,
'subdesc': 'sub000 08/22/18 ',
'expdesc': 'rsc ',
'odelay': 8,
'samplerate': 250.0,
'recordduration': 1.024,
'recordsize': 256,
'nrawrecs': 0,
'nchans': 32,
'mkh5_version': '0.2.7',
'raw_dig_header': {'magic': 38821,
'epoch_len': 0,
'nchans': 32,
'sums': 0,
'tpfuncs': 0,
'pp10uv': 0,
'verpos': 0,
'odelay': 8,
'totevnt': 0,
'10usec_per_tick': 400,
'time': 0,
'cond_code': 0,
'presam': 0,
'trfuncs': 0,
'totrr': 0,
'totrej': 0,
'sbcode': 0,
'cprecis': 1,
'dummy1': 0,
'decfact': 0,
'dh_flag': 0,
'dh_item': 0,
'rfcnts': [0, 0, 0, 0, 0, 0, 0, 0],
'rftypes': '',
'chndes': 'lle\x00lhz\x00MiPfLLPfRLPfLMPfRMPfLDFrRDFrLLFrRLFrLMFrRMFrLMCeRMCeMiCeMiPaLDCeRDCeLDPaRDPaLMOcRMOcLLTeRLTeLLOcRLOcMiOcA2\x00\x00HEOGrle\x00rhz',
'subdes': 'sub000 08/22/18 ',
'sbcdes': '',
'condes': '',
'expdes': 'rsc ',
'pftypes': '',
'chndes2': '',
'flags': 0,
'nrawrecs': 0,
'idxofflow': 0,
'idxoffhi': 0,
'chndes3': ''},
'eeg_file': '/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/mkdig/sub000rc.crw',
'eeg_file_stat': {'st_atime': 1653868489.9435065,
'st_atime_ns': 1653868489943506505,
'st_blksize': 1048576,
'st_blocks': 2634,
'st_ctime': 1595687024.3686264,
'st_ctime_ns': 1595687024368626446,
'st_dev': 51,
'st_gid': 705412,
'st_ino': 32575851,
'st_mode': 33056,
'st_mtime': 1595687024.3686264,
'st_mtime_ns': 1595687024368626446,
'st_nlink': 1,
'st_rdev': 0,
'st_size': 1326550,
'st_uid': 1004346},
'log_file': '/mnt/cube/home/turbach/TPU_Projects/mkpy_data_examples/mkdig/sub000rc.x.log',
'uuid': '373db6fc-f606-4c41-b153-38bb58cd8e2c',
'eeg_file_md5': '610919a37fc74e522f7e803e09f3b2f7',
'log_file_md5': '72c5f0df67bd0f319601e11d35c20dfe',
'h5_dataset': '/closed/dblock_0'}
Example 3: reading EEG and headers without mkpy
WARNING: using a context manager with h5py is strongly advised.
[6]:
import pprint as pp
import json
import h5py
eeg_h5_f = MDE_HOME / f"data/sub000eeg.h5"
json_hdrs = list()
np_dblocks = list()
with h5py.File(eeg_h5_f, 'r') as h5:
for group_path, group in h5.items():
for dblock_path, dblock in group.items():
json_hdrs.append(json.loads(dblock.attrs["json_header"]))
np_dblocks.append(dblock[...].copy())
print("1-D numpy structured array, samples (rows) x data streams (columns), compound dtype")
display(np_dblocks[0].shape, np_dblocks[0].dtype)
print()
print("\n", "header dicts from HDF5 dataset attribute json stringj")
pp.pprint(json_hdrs[0].keys())
1-D numpy structured array, samples (rows) x data streams (columns), compound dtype
(28416,)
dtype([('dblock_ticks', '<u4'), ('crw_ticks', '<u4'), ('raw_evcodes', '<i2'), ('log_evcodes', '<i2'), ('log_ccodes', '<u2'), ('log_flags', '<u2'), ('pygarv', '<u8'), ('lle', '<f2'), ('lhz', '<f2'), ('MiPf', '<f2'), ('LLPf', '<f2'), ('RLPf', '<f2'), ('LMPf', '<f2'), ('RMPf', '<f2'), ('LDFr', '<f2'), ('RDFr', '<f2'), ('LLFr', '<f2'), ('RLFr', '<f2'), ('LMFr', '<f2'), ('RMFr', '<f2'), ('LMCe', '<f2'), ('RMCe', '<f2'), ('MiCe', '<f2'), ('MiPa', '<f2'), ('LDCe', '<f2'), ('RDCe', '<f2'), ('LDPa', '<f2'), ('RDPa', '<f2'), ('LMOc', '<f2'), ('RMOc', '<f2'), ('LLTe', '<f2'), ('RLTe', '<f2'), ('LLOc', '<f2'), ('RLOc', '<f2'), ('MiOc', '<f2'), ('A2', '<f2'), ('HEOG', '<f2'), ('rle', '<f2'), ('rhz', '<f2')])
header dicts from HDF5 dataset attribute json stringj
dict_keys(['runsheet', 'apparatus', 'yhdr_file', 'yhdr_file_md5', 'streams', 'name', 'magic', 'subdesc', 'expdesc', 'odelay', 'samplerate', 'recordduration', 'recordsize', 'nrawrecs', 'nchans', 'mkh5_version', 'raw_dig_header', 'eeg_file', 'eeg_file_stat', 'log_file', 'uuid', 'eeg_file_md5', 'log_file_md5', 'h5_dataset'])