List of implemented RawIO modules#
neo.rawio
provides classes for reading
electrophysiological data files with a low-level API
neo.rawio.rawiolist
provides a list of successfully imported rawio
classes.
Functions:
- neo.rawio.get_rawio_class(filename_or_dirname)#
Legacy function for returning class guess from file extension DEPRECATED
Classes:
- class neo.rawio.AlphaOmegaRawIO(dirname='', lsx_files=None, prune_channels=True)#
AlphaOmega MPX file format 4 reader. Handles several segments.
A segment is a continuous record (when record starts/stops).
Only files in current dirname are loaded, subfolders are not explored.
- Parameters:
dirname (str or Path-like) – folder from where to load the data
lsx_files (list of strings or None) – list of lsx files in dirname referencing mpx files to load (optional). If None (default), read all mpx files in dirname
prune_channels (bool) – if True removes the empty channels, defaults to True
Warning
Because channels must be gathered into coherent streams, channels names must be the default channel names in AlphaRS or Alpha LAB SNR software.
- extensions = ['lsx', 'mpx']#
- class neo.rawio.AxographRawIO(filename, force_single_segment=False)#
RawIO class for reading AxoGraph files (.axgd, .axgx)
- Args:
- filename (string):
File name of the AxoGraph file to read.
- force_single_segment (bool):
Episodic files are normally read as multi-Segment Neo objects. This parameter can force AxographRawIO to put all signals into a single Segment. Default: False.
- Example:
>>> import neo >>> r = neo.rawio.AxographRawIO(filename=filename) >>> r.parse_header() >>> print(r)
>>> # get signals >>> raw_chunk = r.get_analogsignal_chunk( ... block_index=0, seg_index=0, ... i_start=0, i_stop=1024, ... channel_names=channel_names) >>> float_chunk = r.rescale_signal_raw_to_float( ... raw_chunk, ... dtype='float64', ... channel_names=channel_names) >>> print(float_chunk)
>>> # get event markers >>> ev_raw_times, _, ev_labels = r.get_event_timestamps( ... event_channel_index=0) >>> ev_times = r.rescale_event_timestamp( ... ev_raw_times, dtype='float64') >>> print([ev for ev in zip(ev_times, ev_labels)])
>>> # get interval bars >>> ep_raw_times, ep_raw_durations, ep_labels = r.get_event_timestamps( ... event_channel_index=1) >>> ep_times = r.rescale_event_timestamp( ... ep_raw_times, dtype='float64') >>> ep_durations = r.rescale_epoch_duration( ... ep_raw_durations, dtype='float64') >>> print([ep for ep in zip(ep_times, ep_durations, ep_labels)])
>>> # get notes >>> print(r.info['notes'])
>>> # get other miscellaneous info >>> print(r.info)
- extensions = ['axgd', 'axgx', '']#
- class neo.rawio.AxonaRawIO(filename)#
Class for reading raw, continuous data from the Axona dacqUSB system: http://space-memory-navigation.org/DacqUSBFileFormats.pdf
The raw data is saved in .bin binary files with an accompanying .set file about the recording setup (see the above manual for details).
Usage:
import neo.rawio r = neo.rawio.AxonaRawIO(filename=os.path.join(dir_name, base_filename)) r.parse_header() print(r) raw_chunk = r.get_analogsignal_chunk(block_index=0, seg_index=0, i_start=0, i_stop=1024, channel_names=channel_names) float_chunk = reader.rescale_signal_raw_to_float( raw_chunk, dtype='float64', channel_indexes=[0, 3, 6] )
- extensions = ['bin', 'set', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32']#
- class neo.rawio.BiocamRawIO(filename='')#
Class for reading data from a Biocam h5 file.
- Usage:
>>> import neo.rawio >>> r = neo.rawio.BiocamRawIO(filename='biocam.h5') >>> r.parse_header() >>> print(r) >>> raw_chunk = r.get_analogsignal_chunk(block_index=0, seg_index=0, i_start=0, i_stop=1024, channel_names=channel_names) >>> float_chunk = r.rescale_signal_raw_to_float(raw_chunk, dtype='float64', channel_indexes=[0, 3, 6])
- extensions = ['h5', 'brw']#
- class neo.rawio.BlackrockRawIO(filename=None, nsx_override=None, nev_override=None, nsx_to_load=None, load_nev=True, verbose=False)#
Class for reading data in from a file set recorded by the Blackrock (Cerebus) recording system.
Upon initialization, the class is linked to the available set of Blackrock files.
Note: This routine will handle files according to specification 2.1, 2.2, and 2.3. Recording pauses that may occur in file specifications 2.2 and 2.3 are automatically extracted and the data set is split into different segments.
The Blackrock data format consists not of a single file, but a set of different files. This constructor associates itself with a set of files that constitute a common data set. By default, all files belonging to the file set have the same base name, but different extensions. However, by using the override parameters, individual filenames can be set.
- Args:
- filename (string):
File name (without extension) of the set of Blackrock files to associate with. Any .nsX or .nev, .sif, or .ccf extensions are ignored when parsing this parameter.
- nsx_override (string):
File name of the .nsX files (without extension). If None, filename is used. Default: None.
- nev_override (string):
File name of the .nev file (without extension). If None, filename is used. Default: None.
- nsx_to_load (int, list, ‘max’, ‘all’ (=None)) default None:
IDs of nsX file from which to load data, e.g., if set to 5 only data from the ns5 file are loaded. If ‘all’, then all nsX will be loaded. Contrary to previous version of the IO (<0.7), nsx_to_load must be set at the init before parse_header().
- load_nev (bool):
Load (or not) events/spikes by ignoring or not the nev file. Default: True
- Examples:
>>> reader = BlackrockRawIO(filename='FileSpec2.3001', nsx_to_load=5) >>> reader.parse_header()
Inspect a set of file consisting of files FileSpec2.3001.ns5 and FileSpec2.3001.nev
>>> print(reader)
Display all informations about signal channels, units, segment size….
- extensions = ['ns1', 'ns2', 'ns3', 'ns4', 'ns5', 'ns6', 'nev', 'sif', 'ccf']#
- class neo.rawio.CedRawIO(filename='', take_ideal_sampling_rate=False)#
Class for reading data from CED (Cambridge Electronic Design) spike2. This internally uses the sonpy package which is closed source.
This IO reads smr and smrx files
- extensions = ['smr', 'smrx']#
- class neo.rawio.EDFRawIO(filename='')#
Class for reading European Data Format files (EDF and EDF+). Currently only continuous EDF+ files (EDF+C) and original EDF files (EDF) are supported
- Usage:
>>> import neo.rawio >>> r = neo.rawio.EDFRawIO(filename='file.edf') >>> r.parse_header() >>> print(r) >>> raw_chunk = r.get_analogsignal_chunk(block_index=0, seg_index=0, i_start=0, i_stop=1024, stream_index=0, channel_indexes=range(10)) >>> float_chunk = reader.rescale_signal_raw_to_float(raw_chunk, dtype='float64', channel_indexes=[0, 3, 6])
- extensions = ['edf']#
- class neo.rawio.IntanRawIO(filename='')#
Intan reader can handle two file formats ‘rhd’ and ‘rhs’. It will automatically check for the file extension and will gather the header information based on the extension. Additionally it functions with RHS v 1.0 and RHD 1.0, 1.1, 1.2, 1.3, 2.0, 3.0, and 3.1 files. Intan files contain amplifier channels labeled ‘A’, ‘B’ ‘C’ or ‘D’ depending on the port in which they were recorded along with the following additional channels. 1: ‘RHD2000 auxiliary input channel’, 2: ‘RHD2000 supply voltage channel’, 3: ‘USB board ADC input channel’, 4: ‘USB board digital input channel’, 5: ‘USB board digital output channel’ Due to the structure of the digital input and output channels these can be accessed as one long vector, which must be post-processed. Parameters ———- filename: str
name of the ‘rhd’ or ‘rhs’ data file
- extensions = ['rhd', 'rhs']#
- class neo.rawio.MaxwellRawIO(filename='', rec_name=None)#
Class for reading MaxOne or MaxTwo files.
- extensions = ['h5']#
- class neo.rawio.MedRawIO(dirname=None, password=None, keep_original_times=False, **kargs)#
Class for reading MED (Multiscale Electrophysiology Data) Format.
Uses the dhn-med-py MED python package (version >= 1.0.0), created by Dark Horse Neuro, Inc. and medformat.org.
Currently reads the entire MED session. Every discontinuity is considered to be a new segment. Channels are grouped by sampling frequency, to create streams. In MED all channels will line up time-wise, so streams will span the entire recording, and continuous sections of those streams are divided up into segments.
Timestamps generated are referenced to the beginning of the session, with the beginning of the session being timestamp zero. If UTC timestamps are desired, then the keep_original_times flag in the constructor can be set to True (it defaults to False) and the timestamps used in the object will be seconds, reference to midnight 1 Jan 1970 (assuming that that data is available in the MED data session).
- extensions = ['medd', 'rdat', 'ridx']#
- class neo.rawio.MEArecRawIO(filename='', load_spiketrains=True, load_analogsignal=True)#
Class for “reading” fake data from a MEArec file.
This class provides a convenient way to read data from a MEArec file.
Parameters#
- filenamestr
The filename of the MEArec file to read.
- load_spiketrainsbool, optional
Whether or not to load spike train data. Defaults to True.
- load_analogsignalbool, optional
Whether or not to load continuous recording data. Defaults to True.
- Usage:
>>> import neo.rawio >>> r = neo.rawio.MEArecRawIO(filename='mearec.h5') >>> r.parse_header() >>> print(r) >>> raw_chunk = r.get_analogsignal_chunk(block_index=0, seg_index=0, i_start=0, i_stop=1024, channel_names=channel_names) >>> float_chunk = reader.rescale_signal_raw_to_float(raw_chunk, dtype='float64', channel_indexes=[0, 3, 6]) >>> spike_timestamp = reader.spike_timestamps(unit_index=0, t_start=None, t_stop=None) >>> spike_times = reader.rescale_spike_timestamp(spike_timestamp, 'float64')
- extensions = ['h5']#
- class neo.rawio.MicromedRawIO(filename='')#
Class for reading data from micromed (.trc).
- extensions = ['trc', 'TRC']#
- class neo.rawio.NeuralynxRawIO(dirname='', filename='', exclude_filename=None, keep_original_times=False, **kargs)#
Class for reading datasets recorded by Neuralynx.
This version works with rawmode of one-dir for a single directory of files or one-file for a single file.
- Examples:
>>> reader = NeuralynxRawIO(dirname='Cheetah_v5.5.1/original_data') >>> reader.parse_header()
Inspect all files in the directory.
>>> print(reader)
Display all information about signal channels, units, segment size….
- extensions = ['nse', 'ncs', 'nev', 'ntt', 'nvt', 'nrd']#
- class neo.rawio.NeuroScopeRawIO(filename, binary_file=None)#
- extensions = ['xml', 'dat', 'lfp', 'eeg']#
- class neo.rawio.OpenEphysRawIO(dirname='', ignore_timestamps_errors=None, fill_gap_value=0)#
OpenEphys GUI software offers several data formats, see https://open-ephys.atlassian.net/wiki/spaces/OEW/pages/491632/Data+format
This class implements the legacy OpenEphys format here https://open-ephys.atlassian.net/wiki/spaces/OEW/pages/65667092/Open+Ephys+format
The OpenEphys group already proposes some tools here: open-ephys/analysis-tools but (i) there is no package at PyPI and (ii) those tools read everything in memory.
- The format is directory based with several files:
.continuous
.events
.spikes
- This implementation is based on:
this code open-ephys/analysis-tools written by Dan Denman and Josh Siegle
a previous PR by Cristian Tatarau at Charité Berlin
In contrast to previous code for reading this format, here all data use memmap so it should be super fast and light compared to legacy code.
When the acquisition is stopped and restarted then files are named
*_2
,*_3
. In that case this class creates a new Segment. Note that timestamps are reset in this situation.- Limitation :
Works only if all continuous channels have the same sampling rate, which is a reasonable hypothesis.
A recording can contain gaps due to USB stream loss when high CPU load when recording. Theses gaps are checked channel per channel which make the parse_header() slow. If gaps are detected then they are filled with zeros but the the reading will be much slower for getting signals.
Parameters#
- dirname: str
The directory where the files are stored.
- ignore_timestamps_errors: bool
(deprecated) This parameter is not used anymore.
- fill_gap_value: int
When gaps are detected in continuous files, the gap is filled with this value. Default is 0.
- extensions = ['continuous', 'openephys', 'spikes', 'events', 'xml']#
- class neo.rawio.OpenEphysBinaryRawIO(dirname='', load_sync_channel=False, experiment_names=None)#
Handle several Blocks and several Segments.
Parameters#
- dirnamestr
Path to Open Ephys directory
- load_sync_channelbool
If False (default) and a SYNC channel is present (e.g. Neuropixels), this is not loaded. If True, the SYNC channel is loaded and can be accessed in the analog signals.
- experiment_namesstr or list or None
If multiple experiments are available, this argument allows users to select one or more experiments. If None, all experiements are loaded as blocks. E.g. experiment_names=”experiment2”, experiment_names=[“experiment1”, “experiment2”]
Note#
For multi-experiment datasets, the streams need to be consistent across experiments. If this is not the case, you can select a subset of experiments with the experiment_names argument.
# Correspondencies Neo OpenEphys block[n-1] experiment[n] New device start/stop segment[s-1] recording[s] New recording start/stop
This IO handles several signal streams. Special event (npy) data are represented as array_annotations. The current implementation does not handle spiking data, this will be added upon user request
- extensions = ['xml', 'oebin', 'txt', 'dat', 'npy']#
- class neo.rawio.PhyRawIO(dirname='', load_amplitudes=False, load_pcs=False)#
Class for reading Phy data.
- Usage:
>>> import neo.rawio >>> r = neo.rawio.PhyRawIO(dirname='/dir/to/phy/folder') >>> r.parse_header() >>> print(r) >>> spike_timestamp = r.get_spike_timestamps(block_index=0, ... seg_index=0, spike_channel_index=0, t_start=None, t_stop=None) >>> spike_times = r.rescale_spike_timestamp(spike_timestamp, 'float64')
- extensions = ['npy', 'mat', 'tsv', 'dat']#
- class neo.rawio.Plexon2RawIO(filename, pl2_dll_file_path=None)#
Class for “reading” data from a PL2 file
- Usage:
>>> import neo.rawio >>> r = neo.rawio.Plexon2RawIO(filename='my_data.pl2') >>> r.parse_header() >>> print(r) >>> raw_chunk = r.get_analogsignal_chunk(block_index=0, seg_index=0, i_start=0, i_stop=1024, stream_index=0, channel_indexes=range(10)) >>> float_chunk = r.rescale_signal_raw_to_float(raw_chunk, dtype='float64', channel_indexes=[0, 3, 6]) >>> spike_timestamp = r.get_spike_timestamps(spike_channel_index=0, t_start=None, t_stop=None) >>> spike_times = r.rescale_spike_timestamp(spike_timestamp, 'float64') >>> ev_timestamps, _, ev_labels = r.get_event_timestamps(event_channel_index=0)
- extensions = ['pl2']#
- class neo.rawio.RawBinarySignalRawIO(filename='', dtype='int16', sampling_rate=10000.0, nb_channel=2, signal_gain=1.0, signal_offset=0.0, bytesoffset=0)#
- extensions = ['raw', 'bin']#
- class neo.rawio.Spike2RawIO(filename='', take_ideal_sampling_rate=False, ced_units=True, try_signal_grouping=True)#
This implementation in neo read only old smr files. For smrx files you need to use CedRawIO which is based on sonpy.
- extensions = ['smr']#
- class neo.rawio.SpikeGLXRawIO(dirname='', load_sync_channel=False, load_channel_location=False)#
Class for reading data from a SpikeGLX system
- dirname:
The spikeglx folder containing meta/bin files
- load_sync_channel=False/True
The last channel (SY0) of each stream is a fake channel used for synchronisation.
- extensions = ['meta', 'bin']#