Classes:
Main container gathering all the data, whether discrete or continous, for a given recording session.
A block is not necessarily temporally homogeneous, in contrast to Segment.
Usage:
TODO
name: | A label for the dataset |
---|---|
description: | text description |
file_origin: | filesystem path or URL of the original data file. |
file_datetime: | the creation date and time of the original data file. |
rec_datetime: | the date and time of the original recording |
index: | integer. You can use this to define an ordering of your Block. It is not used by Neo in any way. |
A Segment is a heterogeneous container for discrete or continous data sharing a common clock (time basis) but not necessary the same sampling rate, start or end time.
Usage:
TODO
name: | A label for the dataset |
---|---|
description: | text description |
file_origin: | filesystem path or URL of the original data file. |
file_datetime: | the creation date and time of the original data file. |
rec_datetime: | the date and time of the original recording |
index: | integer. You can use this to define a temporal ordering of your Segment. For instance you could use this for trial numbers. |
Usage 1 multi segment recording with 2 electrode array:
bl = Block()
# create a block with 3 Segment and 2 RecordingChannelGroup
for s in range(3):
seg = Segment(name = 'segment %d' %s, index = s)
bl.segments.append(seg)
for r in range(2):
rcg = RecordingChannelGroup('Array probe %d' % r, channel_indexes =
arange(64) )
bl.recordingchannelgroups.append(rcg)
# populating AnalogSignalArray
for s in range(3):
for r in range(2):
a = AnalogSignalArray( randn(10000, 64), sampling_rate =
10*pq.kHz )
bl.recordingchannelgroups[r].append(a)
bl.segments[s].append(a)
Usage 2 grouping channel:
bl = Block()
# Create a new RecordingChannelGroup and add to current block
rcg = RecordingChannelGroup(channel_names=['ch0', 'ch1', 'ch2'])
rcg.channel_indexes = [0, 1, 2]
bl.recordingchannelgroups.append(rcg)
for i in range(3):
rc = RecordingChannel(index=i)
rcg.recordingchannels.append(rc) # <- many to many relationship
rc.recordingchannelgroups.append(rcg) # <- many to many
relationship
Usage 3 dealing with Units:
bl = Block()
rcg = RecordingChannelGroup( name = 'octotrode A')
bl.recordingchannelgroups.append(rcg)
# create several Units
for i in range(5):
u = Unit(name = 'unit %d' % i, description =
'after a long and hard spike sorting')
rcg.append(u)
channel_names: | List of strings naming each channel |
---|---|
channel_indexes: | |
List of integer indexes of each channel | |
name: | string |
description: | string |
file_origin: | string |
A RecordingChannel is a container for AnalogSignal objects that come from the same logical and/or physical channel inside a Block.
Note that a RecordingChannel can belong to several RecordingChannelGroup.
Usage one Block with 3 Segment and 16 RecordingChannel and 48 AnalogSignal:
bl = Block()
# Create a new RecordingChannelGroup and add to current block
rcg = RecordingChannelGroup(name = 'all channels)
bl.recordingchannelgroups.append(rcg)
for c in range(16):
rc = RecordingChannel(index=c)
rcg.recordingchannels.append(rc) # <- many to many relationship
rc.recordingchannelgroups.append(rcg) # <- many to many
relationship
for s in range(3):
seg = Segment(name = 'segment %d' %s, index = s)
bl.segments.append(seg)
for c in range(16):
for s in range(3):
anasig = AnalogSignal( np.rand(100000), sampling_rate =
20*pq.Hz)
bl.segments[s].analogsignals.append(anasig)
rcg.recordingchannels[c].analogsignals.append(anasig)
index: | (int) Index of the channel |
---|
coordinate: | (Quantity) x, y, z |
---|---|
name: | string |
description: | string |
file_origin: | string |
A representation of a continuous, analog signal acquired at time t_start at a certain sampling rate.
Inherits from quantities.Quantity, which in turn inherits from :py:class:numpy.ndarray.
Usage:
>>> from quantities import ms, kHz, nA, uV
>>> import numpy as np
>>> a = AnalogSignal([1,2,3], sampling_rate=0.42*kHz, units='mV')
>>> b = AnalogSignal([4,5,6]*nA, sampling_period=42*ms)
>>> c = AnalogSignal(np.array([1.0, 2.0, 3.0]), t_start=42*ms,
... sampling_rate=0.42*kHz, units=uV)
signal: | the data itself, as a Quantity array, NumPy array or list |
---|---|
units: | required if the signal is a list or NumPy array, not if it is a Quantity |
sampling_rate: | or :sampling_period: Quantity, number of samples per unit time or interval between two samples. If both are specified, they are checked for consistency. |
t_start: | Quantity, time when signal begins. Default: 0.0 seconds |
---|
Note that the length of the signal array and the sampling rate are used to calculate t_stop and duration.
name: | string |
---|---|
description: | string |
file_origin: | string |
dtype: | |
---|---|
copy: | (bool) True by default |
Any other additional arguments are assumed to be user-specific metadata and stored in annotations:
>>> a = AnalogSignal([1,2,3], day='Monday')
>>> print a.annotations['day']
Monday
A representation of several continuous, analog signals that have the same duration, sampling rate and start time. Basically, it is a 2D array like AnalogSignal: dim 0 is time, dim 1 is channel index
Inherits from quantities.Quantity, which in turn inherits from numpy.ndarray.
t_start: | time when signal begins |
---|---|
sampling_rate: | or :sampling_period: Quantity, number of samples per unit time or interval between two samples. If both are specified, they are checked for consistency. |
sampling_period: | |
---|---|
interval between two samples (1/sampling_rate) | |
duration: | signal duration (size * sampling_period) |
t_stop: | time when signal ends (t_start + duration) |
name: | |
---|---|
description: | |
file_origin: |
A representation of a continuous, analog signal acquired at time t_start with a varying sampling interval.
Usage:
>>> from quantities import ms, nA, uV
>>> import numpy as np
>>> a = IrregularlySampledSignal([0.0, 1.23, 6.78], [1,2,3], units='mV', time_units='ms')
>>> b = IrregularlySampledSignal([0.01, 0.03, 0.12]*s, [4,5,6]*nA)
times: | NumPy array, Quantity array or list |
---|---|
signal: | Numpy array, Quantity array or list of the same size as times |
units: | required if the signal is a list or NumPy array, not if it is a Quantity |
time_units: | required if times is a list or NumPy array, not if it is a Quantity |
dtype: | Data type of the signal (times are always floats) |
---|
name: | |
---|---|
description: | |
file_origin: |
Object to represent an event occurring at a particular time. Useful for managing trigger, stimulus, ...
Usage:
time: | (quantity): |
---|---|
label: | (str): |
name: | |
---|---|
description: | |
file_origin: |
Array of events. Introduced for performance reasons. An EventArray is prefered to a list of Event objects.
times: | (quantity array 1D) |
---|---|
labels: | (numpy.array 1D dtype=’S’) |
name: | |
---|---|
description: | |
file_origin: |
Similar to Event but with a duration. Useful for describing a period, the state of a subject, ...
time: | (quantity) |
---|---|
duration: | (quantity) |
label: | (str) |
name: | |
---|---|
description: | |
file_origin: |
Array of epochs. Introduced for performance reason. An EpochArray is prefered to a list of Epoch objects.
times: | (quantity array 1D) |
---|---|
durations: | (quantity array 1D) |
labels: | (numpy.array 1D dtype=’S’) ) |
name: | |
---|---|
description: | |
file_origin: |
A Unit regroups all the SpikeTrain objects that were emitted by a neuron during a Block. The spikes may come from different Segment objects within the Block, so this object is not contained in the usual Block/Segment /SpikeTrain hierarchy.
A Unit is linked to RecordingChannelGroup objects from which it was detected. With tetrodes, for instance, multiple channels may record the same unit.
This replaces the Neuron class in the previous version of Neo.
Usage:
# Store the spike times from a pyramidal neuron recorded on channel 0
u = neo.Unit(name='pyramidal neuron')
# first segment
st1 = neo.SpikeTrain(times=[.01, 3.3, 9.3], units='sec')
u.spiketrains.append(st1)
# second segment
st2 = neo.SpikeTrain(times=[100.01, 103.3, 109.3], units='sec')
u.spiketrains.append(st2)
name: | |
---|---|
description: | |
file_origin: |
Object to represent one spike emitted by a Unit and represented by its time occurence and optional waveform.
time: | (quantity) |
---|
waveform: | (quantity 2D (channel_index X time)) |
---|---|
sampling_rate: | |
left_sweep: | |
name: | |
description: | |
file_origin: |
right_sweep: | |
---|---|
duration: |
SpikeTrain is a Quantity array of spike times.
It is an ensemble of action potentials (spikes) emitted by the same unit in a period of time.
times: | a list, 1d numpy array, or quantity array, containing the times of each spike. |
---|---|
t_stop: | time at which SpikeTrain ends. This will be converted to the same units as the data. This argument is required because it specifies the period of time over which spikes could have occurred. Note that t_start is highly recommended for the same reason. |
Your spike times must have units. Preferably, times is a Quantity array with units of time. Otherwise, you must specify the keyword argument units.
If times contains values outside of the range [t_start, t_stop], an Exception is raised.
t_start: | time at which SpikeTrain began. This will be converted to the same units as the data. Default is zero seconds. |
---|---|
waveforms: | the waveforms of each spike |
sampling_rate: | the sampling rate of the waveforms |
left_sweep: | Quantity, in units of time. Time from the beginning of the waveform to the trigger time of the spike. |
sort: | if True, the spike train will be sorted |
name: | string |
description: | string |
file_origin: | string |
Any other keyword arguments are stored in the self.annotations dict.
dtype : data type (float32, float64, etc) copy : boolean, whether to copy the data or use a view.
These arguments, as well as units, are simply passed to the Quantity constructor.
Note that copy must be True when you request a change of units or dtype.
>>> st = SpikeTrain([3,4,5] * pq.s, t_stop=10.0)
>>> st2 = st[1:3]
>>> st.t_start
array(0.0) * s
>>> st2
<SpikeTrain(array([ 4., 5.]) * s, [0.0 s, 10.0 s])>