Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _write_vmrk_file(vmrk_fname, eeg_fname, events, meas_date):
"""Write BrainvVision marker file."""
with codecs.open(vmrk_fname, 'w', encoding='utf-8') as fout:
print(r'Brain Vision Data Exchange Marker File, Version 1.0', file=fout) # noqa: E501
print(r';Exported using pybv {}'.format(__version__), file=fout)
print(r'', file=fout)
print(r'[Common Infos]', file=fout)
print(r'Codepage=UTF-8', file=fout)
print(r'DataFile={}'.format(eeg_fname.split(os.sep)[-1]), file=fout)
print(r'', file=fout)
print(r'[Marker Infos]', file=fout)
print(r'; Each entry: Mk
# see: https://sphinx.readthedocs.io/en/1.3/extensions.html
extensions = [
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx',
'numpydoc'
]
# Generate the autosummary
autosummary_generate = True
# General information about the project.
project = 'pybv'
copyright = '2018-{}, pybv developers'.format(date.today().year)
author = 'pybv developers'
version = pybv.__version__
release = version
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# Define master doc
master_doc = 'index'
# Options for HTML output
html_theme = "alabaster"
html_theme_options = {"description": "A lightweight I/O utility for the BrainVision data format.", # noqa: E501
"fixed_sidebar": True,
"github_button": True,
"github_repo": "pybv",
def _write_vhdr_file(vhdr_fname, vmrk_fname, eeg_fname, data, sfreq, ch_names,
orientation='multiplexed', format='binary_float32',
resolution=1e-7, unit='µV'):
"""Write BrainvVision header file."""
fmt = format.lower()
bvfmt, _ = _chk_fmt(format)
multiplexed = _chk_multiplexed(orientation)
with codecs.open(vhdr_fname, 'w', encoding='utf-8') as fout:
print(r'Brain Vision Data Exchange Header File Version 1.0', file=fout)
print(r';Written using pybv {}'.format(__version__), file=fout)
print(r'', file=fout)
print(r'[Common Infos]', file=fout)
print(r'Codepage=UTF-8', file=fout)
print(r'DataFile={}'.format(op.basename(eeg_fname)), file=fout)
print(r'MarkerFile={}'.format(op.basename(vmrk_fname)), file=fout)
if fmt.startswith('binary'):
print(r'DataFormat=BINARY', file=fout)
if multiplexed:
print(r'; DataOrientation: MULTIPLEXED=ch1,pt1, ch2,pt1 ...', file=fout) # noqa: E501
print(r'DataOrientation=MULTIPLEXED', file=fout)
print(r'NumberOfChannels={}'.format(len(data)), file=fout)
print(r'; Sampling interval in microseconds', file=fout)
print(r'SamplingInterval={}'.format(int(1e6 / sfreq)), file=fout)