Skip to content

Instantly share code, notes, and snippets.

@dengemann
Created August 25, 2014 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dengemann/e9b45f2ff3e3380907d3 to your computer and use it in GitHub Desktop.
Save dengemann/e9b45f2ff3e3380907d3 to your computer and use it in GitHub Desktop.
"""
========================================
Create a fiff file from arbitrary inputs
========================================
This example creates random data and writes them to a fiff file.
"""
print(__doc__)
# Authors: Denis Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
import numpy as np
rng = np.random.RandomState(42)
data = rng.random_sample((248, 2000))
sfreq = 1e3
ch_types = ['misc'] * 248
ch_names = ['MISC {:03d}'.format(i + 1) for i in range(len(ch_type))]
info = mne.create_info(ch_names=ch_names, sfreq=sfreq, ch_types=ch_types)
raw = mne.io.RawArray(data, info)
raw.save('misc.fif')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment