CLASS ndr.reader¶
NDR - create a new Neuroscience Data Reader object
NDR_READER_OBJ = ndr.reader(NDR_READER_TYPE)
Creates an Neuroscence Data Reader object of the indicated type.
Some valid types include 'IntanRHD', 'CedSpike2', 'SpikeGadgets', 'Blackrock'.
Superclasses¶
none
Properties¶
Property | Description |
---|---|
ndr_reader_base | the ndr reader base object, that actually reads the files |
Methods¶
Method | Description |
---|---|
epochclock | return the ndr.time.clocktype objects for an epoch |
getchannelsepoch | List the channels that are available on this device for a given epoch |
read | read data from an ndr.reader object |
readchannels_epochsamples | read the data based on specified channels |
reader | create a new Neuroscience Data Reader object |
readevents_epochsamples | read events, markers, and digital events of specified channels for a specified epoch |
readevents_epochsamples_native | read events or markers of specified channels for a specified epoch |
samplerate | GET THE SAMPLE RATE FOR SPECIFIC CHANNEL FOR REGULARLY-SAMPLED CHANNELS |
t0_t1 | return the t0_t1 (beginning and end) epoch times for an epoch |
Methods help¶
epochclock - return the ndr.time.clocktype objects for an epoch
EC = EPOCHCLOCK(NDR_READER_OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Return the clock types available for this epoch as a cell array
of ndr.time.clocktype objects (or sub-class members).
This function calls the method of the ndr_reader_base class.
If EPOCH_SELECT is not provided, it is assumed to be 1.
See also: ndr.time.clocktype
getchannelsepoch - List the channels that are available on this device for a given epoch
CHANNELS = GETCHANNELSEPOCH(NDR_READER_OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Returns the channel list of acquired channels in this epoch.
EPOCHSTREAMS should be a cell array of files or streams that comprise this epoch.
EPOCH_SELECT indicates the epoch within the EPOCHSTREAMS files to select. The vast
majority of systems only allow one EPOCH per file, so EPOCH_SELECT is usually 1.
It defaults to 1 if it is not given.
CHANNELS is a structure list of all channels with fields:
-------------------------------------------------------
'name' | The name of the channel (e.g., 'ai1')
'type' | The type of data stored in the channel
| (e.g., 'analogin', 'digitalin', 'image', 'timestamp')
read - read data from an ndr.reader object
CHANNELSTRING can be multiple things.
For most readers, it should be a string of NDR channel names, e.g. 'ai1-3+b2-4'.
Intan reader accepts both the NDR channel names, e.g. 'ai1-3+b2-4', and device channel names, e.g. 'A021+A022'.
Neo reader stands as an exception - it expects device channel names, but as a cell array, e.g. { 'A-000', 'A-001' }.
[DATA, TIME] = READ(NDR_READER_OBJ, EPOCHSTREAMS, CHANNELSTRING, ...)
This function takes additional arguments in the form of name/value pairs.
-------------------------------------------------------------------------
| Parameter (default) | Description |
|---------------------------|-------------------------------------------|
| t0 (-Inf) | Time to start reading (in units of |
| | epochclock). Use -Inf to start from |
| | earliest sample available. |
| t1 (Inf) | Time to stop reading (in units of |
| | epochclock). Use Inf to stop at the |
| | last sample available. |
| epoch_select (1) | The epoch within EPOCHSTREAMS to select. |
| | Usually, there is only 1 epoch per file|
| | but some file formats support more than|
| | 1 epoch per file. |
| useSamples (0) | Use sample numbers instead of time |
| s0 (NaN) | Sample number to start reading, if |
| | useSamples is 1. First sample is 1. |
| s1 (NaN) | Sample number to stop reading, if |
| | useSamples is 1. Last sample is Inf. |
-------------------------------------------------------------------------
readchannels_epochsamples - read the data based on specified channels
DATA = READ_CHANNELS(NDR_READER_OBJ, CHANNELTYPE, CHANNEL, EPOCH ,S0, S1)
CHANNELTYPE is the type of channel to read
CHANNEL is a vector of the channel numbers to read, beginning from 1
EPOCH is the epoch number to read from.
DATA will have one column per channel.
reader - create a new Neuroscience Data Reader object
NDR_READER_OBJ = ndr.reader(NDR_READER_TYPE)
Creates an Neuroscence Data Reader object of the indicated type.
Some valid types include 'IntanRHD', 'CedSpike2', 'SpikeGadgets', 'Blackrock'.
Documentation for ndr.reader/reader
doc ndr.reader
readevents_epochsamples - read events, markers, and digital events of specified channels for a specified epoch
[TIMESTAMPS, DATA] = READEVENTS_EPOCHSAMPLES(NDR_READER_OBJ, CHANNELTYPE, CHANNEL, EPOCHSTREAMS, EPOCH_SELECT, T0, T1)
Returns TIMESTAMPS and DATA corresponding to event or marker channels. If the number of CHANNEL entries is 1, then TIMESTAMPS
is a column vector of type double, and DATA is also a column of a type that depends on the type of event that is read.
If the number of CHANNEL entries is more than 1, then TIMESTAMPS and DATA are both columns of cell arrays, with 1 column
per channel.
CHANNELTYPE is a cell array of strings, describing the type of each channel to read, such as
'event' - TIMESTAMPS mark the occurrence of each event; DATA is a logical 1 for each timestamp
'marker' - TIMESTAMPS mark the occurence of each event; each row of DATA is the data associated with the marker (type double)
'text' - TIMESTAMPS mark the occurence of each event; DATA is a cell array of character arrays, 1 per event
'dep' - Create events from a digital channel with positive transitions. TIMESTAMPS mark the occurence of each event and
DATA entries will be a 1
'dimp' - Create events from a digital channel by finding impulses that exhibit positive then negative transitions. TIMESTAMPS
mark the occurrence of each event, and DATA indicates whether the event is a positive transition (1) or negative (-1)
transition.
'den' - Create events from a digital channel with negative transitions. TIMESTAMPS mark the occurrence of each event and
DATA entries will be a -1.
'dimn' - Create events from a digital channel by finding impulses that exhibit negative then positive transitions. TIMESTAMPS
mark the occurence of each event, and DATA indicates whether the event is a negative transition (1) or a positive
transition (-1).
CHANNEL is a vector with the identity(ies) of the channel(s) to be read.
EPOCHSTREAMS is a cell array of full path file names or remote
access streams that comprise the epoch of data
EPOCH_SELECT allows one to choose which epoch in the file one wants to access,
if the file(s) has more than one epoch contained. For most devices, EPOCH_SELECT is always 1.
Step 1: check to see if the user is requesting a "native" type of event (event,marker,text) or a "derived" type of event
(like dep, den, dimp, dimn, which are derived from the data of sampled digital channels)
If the user does request a derived event type, then compute it
readevents_epochsamples_native - read events or markers of specified channels for a specified epoch
[TIMESTAMPS, DATA] = READEVENTS_EPOCHSAMPLES_NATIVE(NDR_READER_OBJ, CHANNELTYPE, CHANNEL, EPOCHFILES, T0, T1)
CHANNELTYPE is a cell array of strings, describing the type of each channel to read, such as
'event' - TIMESTAMPS mark the occurrence of each event; DATA is a logical 1 for each timestamp
'marker' - TIMESTAMPS mark the occurence of each event; each row of DATA is the data associated with the marker (type double)
'text' - TIMESTAMPS mark the occurence of each event; DATA is a cell array of character arrays, 1 per event
One cannot use the event types that are derived from digital data ('dep','dimp','den','dimn') with
READEVENTS_EPOCHSAMPLES_NATIVE. Use READEVENTS_EPOCHSAMPLES instead.
CHANNEL is a vector with the identity(ies) of the channel(s) to be read.
EPOCHSTREAMS is a cell array of full path file names or remote
access streams that comprise the epoch of data
EPOCH_SELECT allows one to choose which epoch in the file one wants to access,
if the file(s) has more than one epoch contained. For most devices, EPOCH_SELECT is always 1.
samplerate - GET THE SAMPLE RATE FOR SPECIFIC CHANNEL FOR REGULARLY-SAMPLED CHANNELS
SR = SAMPLERATE(NDR_READER_OBJ, CHANNELTYPE, CHANNEL, EPOCHSTREAMS, EPOCH_SELECT)
SR is an array of sample rates from the specified channels
CHANNELTYPE is a cell array of strings, describing the type of each channel to read. This must be a regularly-sampled type, such as
'analog_input' or 'ai' - regularly sampled analog input
'analog_output' or 'ao' - regularly sampled analog output
'digital_input' or 'di' - regularly sampled digital input
'digital_output' or 'do' - regularly sampled digital output
CHANNEL is a vector with the identity(ies) of the channel(s) to be read.
EPOCHSTREAMS is a cell array of full path file names or remote
access streams that comprise the epoch of data
EPOCH_SELECT allows one to choose which epoch in the file one wants to access,
if the file(s) has more than one epoch contained. For most devices, EPOCH_SELECT is always 1.
t0_t1 - return the t0_t1 (beginning and end) epoch times for an epoch
T0T1 = T0_T1(NDR_READER_OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Return the beginning (t0) and end (t1) times of the epoch defined by EPOCHSTREAMS and EPOCH_SELECT.
This function calls the method of the ndr_reader_base class.
If EPOCH_SELECT is not provided, it is assumed to be 1.
See also: ndr.time.clocktype, ndr.reader.base/epochclock