CLASS ndr.reader.whitematter¶
NDR_READER_WHITEMATTER - Reader class for WhiteMatter LLC (WM) binary files.
This class reads data from WhiteMatter LLC .bin files where metadata is
embedded in the filename. It assumes an 8-byte header followed by
interleaved int16 data samples.
It relies on the helper function ndr.format.whitematter.header to parse
filenames and whitematter.read (or ndr.format.binarymatrix.read) to
read the data.
Superclasses¶
Properties¶
none
Methods¶
Method | Description |
---|---|
canbereadtogether | can the channels in a channel struct be read in a single function call? |
daqchannels2internalchannels | Convert public channel info to internal representation. |
epochclock | Return the ndr.time.clocktype objects for an epoch. |
filenamefromepochfiles | Return the .bin filename from a list. |
getchannelsepoch | List the channels available for a given epoch. |
mfdaq_channeltypes | channel types for ndi.daq.system.mfdaq objects |
mfdaq_prefix | Give the channel prefix for a channel type |
mfdaq_type | Give the preferred long channel type for a channel type |
readchannels_epochsamples | Read data samples for specified channels. |
readevents_epochsamples_native | read events or markers of specified channels for a specified epoch |
samplerate | Get the sample rate for specific channels. |
t0_t1 | Return the beginning and end epoch times for an epoch. |
underlying_datatype | Get the native data type for channels. |
whitematter | Create a new NDR reader object for WhiteMatter LLC format. |
Methods help¶
canbereadtogether - can the channels in a channel struct be read in a single function call?
[B,ERRORMSG] = CANBEREADTOGETHER(NDR_READER_BASE_OBJ, CHANNELSTRUCT)
Returns 1 if the NDR_READER_BASE_OBJ can read all of the channels in
CHANNELSTRUCT with a single function call. If they cannot be read together,
a description is provided in ERRORMSG.
In the abstract class, this returns 1 if all of the samplerate values are
the same and none are NaNs.
CHANNELSTRUCT is a structure with the following fields:
------------------------------------------------------------------------------
| Parameter | Description |
|-----------------------------|----------------------------------------------|
| internal_type | Internal channel type; the type of channel as|
| | it is known to the device. |
| internal_number | Internal channel number, as known to device |
| internal_channelname | Internal channel name, as known to the device|
| ndr_type | The NDR type of channel; should be one of the|
| | types returned by |
| | ndr.reader.base.mfdaq_type |
| samplerate | The sampling rate of this channel, or NaN if |
| | not applicable.
------------------------------------------------------------------------------
in the abstract class, this returns 1 if all the samplerates are the same
and none are NaNs
Help for ndr.reader.whitematter/canbereadtogether is inherited from superclass ndr.reader.base
daqchannels2internalchannels - Convert public channel info to internal representation.
CHANNELSTRUCT = DAQCHANNELS2INTERNALCHANNELS(OBJ, CHANNELPREFIX,
CHANNELNUMBER, EPOCHSTREAMS, EPOCH_SELECT)
Converts requested DAQ channels (e.g., prefix 'ai', numbers [1 5 10])
into the internal structure format needed by readchannels_epochsamples.
For this reader, the internal representation is straightforward as
channels are simply referenced by their 1-based index.
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
Output CHANNELSTRUCT fields:
internal_type : Type used internally ('analog_in', 'time')
internal_number : Channel number used internally (1-based index)
internal_channelname : Original channel name ('ai1', 't1')
ndr_type : Standard NDR type ('analog_in', 'time')
samplerate : Sampling rate for the channel
See also: ndr.reader.base/daqchannels2internalchannels
epochclock - Return the ndr.time.clocktype objects for an epoch.
EC = EPOCHCLOCK(OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Returns the clock types available for this epoch. For WhiteMatter
files, this is assumed to be only 'dev_local_time', as the
absolute time reference is derived from the filename, not embedded
timing signals within the data stream relative to an external clock.
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
See also: ndr.time.clocktype, ndr.reader.base/epochclock
filenamefromepochfiles - Return the .bin filename from a list.
FILENAME = FILENAMEFROMEPOCHFILES(OBJ, FILENAME_ARRAY)
Identifies the WhiteMatter LLC data file (expected extension '.bin'
and starting with 'HSW', case-insensitive) from the cell array
of full path filenames FILENAME_ARRAY.
Throws an error if zero or more than one matching file is found.
See also: ndr.reader.base/filenamefromepochfiles
getchannelsepoch - List the channels available for a given epoch.
CHANNELS = GETCHANNELSEPOCH(OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Returns a structure list of channels available in the epoch.
Channel information (number of channels) is read from the header
derived from the filename. All data channels are assumed to be
'analog_in' type. A single 'time' channel is also reported.
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
Output CHANNELS structure fields:
'name' : Channel name (e.g., 'ai1', 't1')
'type' : Channel type (e.g., 'analog_in', 'time')
'time_channel' : Index of the associated time channel (always 1)
See also: ndr.format.whitematter.header, ndr.reader.base/getchannelsepoch
mfdaq_channeltypes - channel types for ndi.daq.system.mfdaq objects
CT = MFDAQ_CHANNELTYPES - channel types for ndi.daq.system.mfdaq objects
Returns a cell array of strings of supported channels of the
ndi.daq.system.mfdaq class. These are the following:
Channel type: | Description:
-------------------------------------------------------------
analog_in | Analog input channel
aux_in | Auxiliary input
analog_out | Analog output channel
digital_in | Digital input channel
digital_out | Digital output channel
marker |
See also: ndi.daq.system.mfdaq/MFDAQ_TYPE
Help for ndr.reader.whitematter.mfdaq_channeltypes is inherited from superclass ndr.reader.base
mfdaq_prefix - Give the channel prefix for a channel type
PREFIX = MFDAQ_PREFIX(CHANNELTYPE)
Produces the channel name prefix for a given CHANNELTYPE.
Channel type: | MFDAQ_PREFIX:
---------------------------------------------------------
'analog_in', 'ai' | 'ai'
'analog_out', 'ao' | 'ao'
'digital_in', 'di' | 'di'
'digital_out', 'do' | 'do'
'time','timestamp','t' | 't'
'auxiliary','aux','ax', | 'ax'
'auxiliary_in' |
'mark', 'marker', or 'mk' | 'mk'
'text' | 'text'
'event' or 'e' | 'e'
'metadata' or 'md' | 'md'
'digital_in_event', 'de', | 'dep'
'digital_in_event_pos','dep'|
'digital_in_event_neg','den'| 'den'
'digital_in_mark','dimp', | 'dimp'
'digital_in_mark_pos','dim' |
'digital_in_mark_neg','dimn'| 'dimn'
See also: ndi.daq.system.mfdaq/MFDAQ_TYPE
Help for ndr.reader.whitematter.mfdaq_prefix is inherited from superclass ndr.reader.base
mfdaq_type - Give the preferred long channel type for a channel type
TYPE = MFDAQ_TYPE(CHANNELTYPE)
Produces the preferred long channel type name for a given CHANNELTYPE.
Channel type: | MFDAQ_TYPE:
---------------------------------------------------------
'analog_in', 'ai' | 'analog_in'
'analog_out', 'ao' | 'analog_out'
'digital_in', 'di' | 'digital_in'
'digital_out', 'do' | 'digital_out'
'time','timestamp','t' | 'time'
'auxiliary','aux','ax', | 'auxiliary'
'auxiliary_in' |
'mark', 'marker', or 'mk' | 'mark'
'event' or 'e' | 'event'
See also: ndi.daq.system.mfdaq/MFDAQ_PREFIX
Help for ndr.reader.whitematter.mfdaq_type is inherited from superclass ndr.reader.base
readchannels_epochsamples - Read data samples for specified channels.
DATA = READCHANNELS_EPOCHSAMPLES(OBJ, CHANNELTYPE, CHANNEL,
EPOCHSTREAMS, EPOCH_SELECT, S0, S1)
Reads data for the given CHANNELTYPE and CHANNEL numbers between
sample S0 and sample S1 (inclusive, 1-based).
Uses the ndr.format.whitematter.read function to perform the reading.
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
S0, S1 are the start and end sample numbers.
Returns DATA matrix (Samples x Channels). For 'time' channeltype,
returns a column vector of time stamps.
See also: ndr.format.whitematter.read, ndr.reader.base/readchannels_epochsamples
readevents_epochsamples_native - read events or markers of specified channels for a specified epoch
[DATA] = READEVENTS_EPOCHSAMPLES_NATIVE(NDR_READER_BASE_OBJ, CHANNELTYPE, CHANNEL, EPOCHFILES, T0, T1)
CHANNELTYPE is the type of channel to read
('event','marker', etc). It must be a string (not a cell array of strings).
CHANNEL is a vector with the identity of the channel(s) to be read.
EPOCH is the epoch number or epochID
DATA is a two-column vector; the first column has the time of the event. The second
column indicates the marker code. In the case of 'events', this is just 1. If more than one channel
is requested, DATA is returned as a cell array, one entry per channel.
TIMEREF is an ndi.time.timereference with the NDI_CLOCK of the device, referring to epoch N at time 0 as the reference.
Help for ndr.reader.whitematter/readevents_epochsamples_native is inherited from superclass ndr.reader.base
samplerate - Get the sample rate for specific channels.
SR = SAMPLERATE(OBJ, EPOCHSTREAMS, EPOCH_SELECT, CHANNELTYPE, CHANNEL)
Returns the sampling rate in Hz for the specified channels.
For WhiteMatter files, the sampling rate is constant across all
analog channels and is read from the header (filename).
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
CHANNELTYPE is the type ('analog_in', 'time', etc.).
CHANNEL is the vector of channel numbers.
See also: ndr.format.whitematter.header, ndr.reader.base/samplerate
t0_t1 - Return the beginning and end epoch times for an epoch.
T0T1 = T0_T1(OBJ, EPOCHSTREAMS, EPOCH_SELECT)
Returns the beginning (t0) and end (t1) times of the epoch
in seconds, relative to the start of the recording (t0=0).
The end time is determined from the file size and header info.
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
See also: ndr.format.whitematter.header, ndr.reader.base/t0_t1
underlying_datatype - Get the native data type for channels.
[DATATYPE, P, DATASIZE] = UNDERLYING_DATATYPE(OBJ, EPOCHSTREAMS,
EPOCH_SELECT, CHANNELTYPE, CHANNEL)
Returns the underlying data type as stored in the file.
For WhiteMatter files, analog data is 'int16'. Time is 'double'.
The polynomial P describes scaling: P=[OFFSET SCALE]. Since this
reader returns raw int16, P is [0 1].
EPOCHSTREAMS is a cell array of filenames for the epoch.
EPOCH_SELECT is the epoch number (must be 1 for this format).
CHANNELTYPE is the type ('analog_in', 'time', etc.).
CHANNEL is the vector of channel numbers.
See also: ndr.reader.base/underlying_datatype
whitematter - Create a new NDR reader object for WhiteMatter LLC format.
OBJ = ndr.reader.whitematter()
Creates a Neuroscience Data Reader object for the WhiteMatter LLC
binary file format.
See also: ndr.reader.base
Documentation for ndr.reader.whitematter/whitematter
doc ndr.reader.whitematter