API Reference¶
neo.core provides classes for storing common electrophysiological data
types. Some of these classes contain raw data, such as spike trains or
analog signals, while others are containers to organize other classes
(including both data classes and other container classes).
Classes from neo.io return nested data structures containing one
or more class from this module.
Classes:
-
class
neo.core.Block(name=None, description=None, file_origin=None, file_datetime=None, rec_datetime=None, index=None, **annotations)¶ Main container for data.
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:
>>> from neo.core import (Block, Segment, RecordingChannelGroup, ... AnalogSignalArray) >>> from quantities import nA, kHz >>> import numpy as np >>> >>> # create a Block with 3 Segment and 2 RecordingChannelGroup objects ,,, blk = Block() >>> for ind in range(3): ... seg = Segment(name='segment %d' % ind, index=ind) ... blk.segments.append(seg) ... >>> for ind in range(2): ... rcg = RecordingChannelGroup(name='Array probe %d' % ind, ... channel_indexes=np.arange(64)) ... blk.recordingchannelgroups.append(rcg) ... >>> # Populate the Block with AnalogSignalArray objects ... for seg in blk.segments: ... for rcg in blk.recordingchannelgroups: ... a = AnalogSignalArray(np.random.randn(10000, 64)*nA, ... sampling_rate=10*kHz) ... rcg.analogsignalarrays.append(a) ... seg.analogsignalarrays.append(a)
- Required attributes/properties:
- None
- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. file_datetime: (datetime) The creation date and time of the original data file. rec_datetime: (datetime) The date and time of the original recording. index: (int) You can use this to define an ordering of your Block. It is not used by Neo in any way. - Properties available on this object:
list_units: descends through hierarchy and returns a list of Unitobjects existing in the block. This shortcut exists because a common analysis case is analyzing all neurons that you recorded in a session.list_recordingchannels: descends through hierarchy and returns a list of RecordingChannelobjects existing in the block.- Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Container of:
SegmentRecordingChannelGroup
-
class
neo.core.Segment(name=None, description=None, file_origin=None, file_datetime=None, rec_datetime=None, index=None, **annotations)¶ A container for data sharing a common time basis.
A
Segmentis 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::
>>> from neo.core import Segment, SpikeTrain, AnalogSignal >>> from quantities import Hz, s >>> >>> seg = Segment(index=5) >>> >>> train0 = SpikeTrain(times=[.01, 3.3, 9.3], units='sec', t_stop=10) >>> seg.spiketrains.append(train0) >>> >>> train1 = SpikeTrain(times=[100.01, 103.3, 109.3], units='sec', ... t_stop=110) >>> seg.spiketrains.append(train1) >>> >>> sig0 = AnalogSignal(signal=[.01, 3.3, 9.3], units='uV', ... sampling_rate=1*Hz) >>> seg.analogsignals.append(sig0) >>> >>> sig1 = AnalogSignal(signal=[100.01, 103.3, 109.3], units='nA', ... sampling_period=.1*s) >>> seg.analogsignals.append(sig1)
- Required attributes/properties:
- None
- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. file_datetime: (datetime) The creation date and time of the original data file. rec_datetime: (datetime) The date and time of the original recording index: (int) You can use this to define a temporal ordering of your Segment. For instance you could use this for trial numbers. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
all_data: (list) A list of all child objects in the Segment.- Container of:
EpochEpochArrayEventEventArrayAnalogSignalAnalogSignalArrayIrregularlySampledSignalSpikeSpikeTrain
-
class
neo.core.RecordingChannelGroup(channel_names=None, channel_indexes=None, name=None, description=None, file_origin=None, **annotations)¶ A container for multiple data channels.
- This container have sereval purpose:
- Grouping all
AnalogSignalArrayinside aBlockacrossSegment - Grouping
RecordingChannelinside aBlock. This case is many to many relation. It mean that aRecordingChannelcan belong to several group. A typical use case is tetrode (4 XRecordingChannelinside aRecordingChannelGroup). - Container of
Unit. A neuron decharge (Unit) can be seen by several electrodes (4 in tetrode case).
- Grouping all
Usage 1 multi
Segmentrecording with 2 electrode array:>>> from neo.core import (Block, Segment, RecordingChannelGroup, ... AnalogSignalArray) >>> from quantities import nA, kHz >>> import numpy as np >>> >>> # create a Block with 3 Segment and 2 RecordingChannelGroup objects ,,, blk = Block() >>> for ind in range(3): ... seg = Segment(name='segment %d' % ind, index=ind) ... blk.segments.append(seg) ... >>> for ind in range(2): ... rcg = RecordingChannelGroup(name='Array probe %d' % ind, ... channel_indexes=np.arange(64)) ... blk.recordingchannelgroups.append(rcg) ... >>> # Populate the Block with AnalogSignalArray objects ... for seg in blk.segments: ... for rcg in blk.recordingchannelgroups: ... a = AnalogSignalArray(np.random.randn(10000, 64)*nA, ... sampling_rate=10*kHz) ... rcg.analogsignalarrays.append(a) ... seg.analogsignalarrays.append(a)
Usage 2 grouping channel:
>>> from neo.core import (Block, RecordingChannelGroup, ... RecordingChannel) >>> import numpy as np >>> >>> # Create a Block ,,, blk = Block() >>> >>> # Create a new RecordingChannelGroup and add it to the Block ... rcg = RecordingChannelGroup(channel_names=np.array(['ch0', ... 'ch1', ... 'ch2'])) >>> rcg.channel_indexes = np.array([0, 1, 2]) >>> blk.recordingchannelgroups.append(rcg) >>> >>> # Create 3 RecordingChannel objects and add them to the Block ... for ind in range(3): ... chan = RecordingChannel(index=ind) ... rcg.recordingchannels.append(chan) # <- many to many ,,, # relationship ... chan.recordingchannelgroups.append(rcg) # <- many to many ... # relationship
Usage 3 dealing with
Unitobjects:>>> from neo.core import Block, RecordingChannelGroup, Unit >>> >>> # Create a Block ... blk = Block() >>> >>> # Create a new RecordingChannelGroup and add it to the Block ... rcg = RecordingChannelGroup(name='octotrode A') >>> blk.recordingchannelgroups.append(rcg) >>> >>> # create several Unit objects and add them to the >>> # RecordingChannelGroup ... for ind in range(5): ... unit = Unit(name = 'unit %d' % ind, description= ... 'after a long and hard spike sorting') ... rcg.units.append(unit)
- Required attributes/properties:
- None
- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. channel_names: (numpy.array 1D dtype=’S’) Names for each RecordingChannel.channel_indexes: (numpy.array 1D dtype=’i’) Index of each RecordingChannel.- Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Container of:
RecordingChannelAnalogSignalArrayUnit
-
class
neo.core.RecordingChannel(index=0, coordinate=None, name=None, description=None, file_origin=None, **annotations)¶ A container for recordings coming from a single data channel.
A
RecordingChannelis a container forAnalogSignalandIrregularlySampledSignal`objects that come from the same logical and/or physical channel inside a :class:`Block.Note that a
RecordingChannelcan belong to severalRecordingChannelGroupobjects.Usage one
Blockwith 3Segmentobjects, 16RecordingChannelobjects, and 48AnalogSignalobjects:>>> from neo.core import (Block, Segment, RecordingChannelGroup, ... RecordingChannel, AnalogSignal) >>> from quantities import mA, Hz >>> import numpy as np >>> >>> # Create a Block ... blk = Block() >>> >>> # Create a new RecordingChannelGroup and add it to the Block ... rcg = RecordingChannelGroup(name='all channels') >>> blk.recordingchannelgroups.append(rcg) >>> >>> # Create 3 Segment and 16 RecordingChannel objects and add them to ... # the Block ... for ind in range(3): ... seg = Segment(name='segment %d' % ind, index=ind) ... blk.segments.append(seg) ... >>> for ind in range(16): ... chan = RecordingChannel(index=ind) ... rcg.recordingchannels.append(chan) # <- many to many ... # relationship ... chan.recordingchannelgroups.append(rcg) # <- many to many ... # relationship ... >>> # Populate the Block with AnalogSignal objects ... for seg in blk.segments: ... for chan in rcg.recordingchannels: ... sig = AnalogSignal(np.random.rand(100000)*mA, ... sampling_rate=20*Hz) ... seg.analogsignals.append(sig) ... chan.analogsignals.append(sig)
- Required attributes/properties:
index: (int) You can use this to order RecordingChannelobjects in an way you want.- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. coordinate: (quantity array 1D (x, y, z)) Coordinates of the channel in the brain. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Container of:
AnalogSignalIrregularlySampledSignal
-
class
neo.core.Unit(name=None, description=None, file_origin=None, channel_indexes=None, **annotations)¶ A container of
SpikeandSpikeTrainobjects from a unit.A
Unitregroups all theSpikeTrainandSpikeobjects that were emitted by a single spike source during aBlock. A spike source is often a single neuron but doesn’t have to be. The spikes may come from differentSegmentobjects within theBlock, so this object is not contained in the usualBlock/Segment/SpikeTrainhierarchy.A
Unitis linked toRecordingChannelGroupobjects from which it was detected. With tetrodes, for instance, multiple channels may record the sameUnit.Usage:
>>> from neo.core import Unit, SpikeTrain >>> >>> unit = Unit(name='pyramidal neuron') >>> >>> train0 = SpikeTrain(times=[.01, 3.3, 9.3], units='sec', t_stop=10) >>> unit.spiketrains.append(train0) >>> >>> train1 = SpikeTrain(times=[100.01, 103.3, 109.3], units='sec', ... t_stop=110) >>> unit.spiketrains.append(train1)
- Required attributes/properties:
- None
- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. channel_index: (numpy array 1D dtype=’i’) You can use this to order Unitobjects in an way you want. It can have any number of elements.AnalogSignalandAnalogSignalArrayobjects can be given indexes as well so related objects can be linked together.- Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Container of:
SpikeTrainSpike
-
class
neo.core.AnalogSignal(signal, units=None, dtype=None, copy=True, t_start=array(0.0) * s, sampling_rate=None, sampling_period=None, name=None, file_origin=None, description=None, channel_index=None, **annotations)¶ A continuous analog signal.
A representation of a continuous, analog signal acquired at time
t_startat a certain sampling rate.Inherits from
quantities.Quantity, which in turn inherits fromnumpy.ndarray.Usage:
>>> from neo.core import AnalogSignal >>> from quantities import kHz, ms, nA, s, uV >>> import numpy as np >>> >>> sig0 = AnalogSignal([1, 2, 3], sampling_rate=0.42*kHz, ... units='mV') >>> sig1 = AnalogSignal([4, 5, 6]*nA, sampling_period=42*ms) >>> sig2 = AnalogSignal(np.array([1.0, 2.0, 3.0]), t_start=42*ms, ... sampling_rate=0.42*kHz, units=uV) >>> sig3 = AnalogSignal([1], units='V', day='Monday', ... sampling_period=1*s) >>> >>> sig3 <AnalogSignal(array([1]) * V, [0.0 s, 1.0 s], sampling rate: 1.0 1/s)> >>> sig3.annotations['day'] 'Monday' >>> sig3[0] array(1) * V >>> sig3[::2] <AnalogSignal(array([1]) * V, [0.0 s, 2.0 s], sampling rate: 0.5 1/s)>
- Required attributes/properties:
signal: (quantity array 1D, numpy array 1D, or list) The data itself. units: (quantity units) Required if the signal is a list or NumPy array, not if it is a Quantitysampling_rate: or :sampling_period: (quantity scalar) Number of samples per unit time or interval between two samples. If both are specified, they are checked for consistency. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. t_start: (quantity scalar) Time when signal begins. Default: 0.0 seconds channel_index: (int) You can use this to order AnalogSignalobjects in an way you want.AnalogSignalArrayandUnitobjects can be given indexes as well so related objects can be linked together.- Optional attributes/properties:
dtype: (numpy dtype or str) Override the dtype of the signal array. copy: (bool) True by default. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
sampling_rate: (quantity scalar) Number of samples per unit time. (1/ sampling_period)sampling_period: (quantity scalar) Interval between two samples. (1/ sampling_rate)duration: (quantity scalar) Signal duration, read-only. ( size*sampling_period)t_stop: (quantity scalar) Time when signal ends, read-only. ( t_start+duration)times: (quantity 1D) The time points of each sample of the signal, read-only. ( t_start+ arange(shape)/sampling_rate)- Slicing:
AnalogSignalobjects can be sliced. When this occurs, a newAnalogSignal(actually a view) is returned, with the same metadata, except thatsampling_periodis changed if the step size is greater than 1, andt_startis changed if the start index is greater than 0. Getting a single item returns aQuantityscalar.- Operations available on this object:
- == != + * /
-
class
neo.core.AnalogSignalArray(signal, units=None, dtype=None, copy=True, t_start=array(0.0) * s, sampling_rate=None, sampling_period=None, name=None, file_origin=None, description=None, channel_index=None, **annotations)¶ Several continuous analog signals
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 fromnumpy.ndarray.Usage:
>>> from neo.core import AnalogSignalArray >>> import quantities as pq >>> >>> sigarr = AnalogSignalArray([[1, 2, 3], [4, 5, 6]], units='V', ... sampling_rate=1*pq.Hz) >>> >>> sigarr <AnalogSignalArray(array([[1, 2, 3], [4, 5, 6]]) * mV, [0.0 s, 2.0 s], sampling rate: 1.0 Hz)> >>> sigarr[:,1] <AnalogSignal(array([2, 5]) * V, [0.0 s, 2.0 s], sampling rate: 1.0 Hz)> >>> sigarr[1, 1] array(5) * V
- Required attributes/properties:
signal: (quantity array 2D, numpy array 2D, or list (data, chanel)) The data itself. units: (quantity units) Required if the signal is a list or NumPy array, not if it is a Quantityt_start: (quantity scalar) Time when signal begins sampling_rate: or :sampling_period: (quantity scalar) Number of samples per unit time or interval between two samples. If both are specified, they are checked for consistency. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. channel_index: (numpy array 1D dtype=’i’) You can use this to order the columns of the signal in any way you want. It should have the same number of elements as the signal has columns. AnalogSignalandUnitobjects can be given indexes as well so related objects can be linked together.- Optional attributes/properties:
dtype: (numpy dtype or str) Override the dtype of the signal array. copy: (bool) True by default. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
sampling_rate: (quantity scalar) Number of samples per unit time. (1/ sampling_period)sampling_period: (quantity scalar) Interval between two samples. (1/ quantity scalar)duration: (Quantity) Signal duration, read-only. (size * sampling_period)t_stop: (quantity scalar) Time when signal ends, read-only. ( t_start+duration)times: (quantity 1D) The time points of each sample of the signal, read-only. ( t_start+ arange(shape`[0])/:attr:`sampling_rate)channel_indexes: (numpy array 1D dtype=’i’) The same as channel_index, read-only.- Slicing:
AnalogSignalArrayobjects can be sliced. When taking a single row (dimension 1, e.g. [:, 0]), aAnalogSignalis returned. When taking a single element, aQuantityis returned. Otherwise aAnalogSignalArray(actually a view) is returned, with the same metadata, except thatt_startis changed if the start index along dimension 1 is greater than 1. Getting a single item returns aQuantityscalar.- Operations available on this object:
- == != + * /
-
class
neo.core.IrregularlySampledSignal(times, signal, units=None, time_units=None, dtype=None, copy=True, name=None, description=None, file_origin=None, **annotations)¶ An analog signal with samples taken at arbitrary time points.
A representation of a continuous, analog signal acquired at time
t_startwith a varying sampling interval.Usage:
>>> from neo.core import IrregularlySampledSignal >>> from quantities import s, nA >>> >>> irsig0 = IrregularlySampledSignal([0.0, 1.23, 6.78], [1, 2, 3], ... units='mV', time_units='ms') >>> irsig1 = IrregularlySampledSignal([0.01, 0.03, 0.12]*s, ... [4, 5, 6]*nA)
- Required attributes/properties:
times: (quantity array 1D, numpy array 1D, or list) The data itself. signal: (quantity array 1D, numpy array 1D, or list) The time of each data point. Must have the same size as times.units: (quantity units) Required if the signal is a list or NumPy array, not if it is a Quantity.time_units: (quantity units) Required if :attr`times` is a list or NumPy array, not if it is a Quantity.- Recommended attributes/properties:.
name: (str) A label for the dataset description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. - Optional attributes/properties:
dtype: (numpy dtype or str) Override the dtype of the signal array. (times are always floats). copy: (bool) True by default. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
sampling_intervals: (quantity array 1D) Interval between each adjacent pair of samples. ( times[1:]- :attr:`times`[:-1])duration: (quantity scalar) Signal duration, read-only. (:attr:`times`[-1] - :attr:`times`[0]) t_start: (quantity scalar) Time when signal begins, read-only. (:attr:`times`[0]) t_stop: (quantity scalar) Time when signal ends, read-only. (:attr:`times`[-1]) - Slicing:
IrregularlySampledSignalobjects can be sliced. When this occurs, a newIrregularlySampledSignal(actually a view) is returned, with the same metadata, except thattimesis also sliced in the same way.- Operations available on this object:
- == != + * /
-
class
neo.core.Event(time, label, name=None, description=None, file_origin=None, **annotations)¶ An event occuring at a particular point in time.
Useful for managing trigger, stimulus, comment, etc.
Usage:
>>> from neo.core import Event >>> from quantities import s >>> >>> evt = Event(50*s, label='trigger') >>> >>> evt.time array(50.0) * s >>> evt.label 'trigger'
- Required attributes/properties:
time: (quantity scalar) The time of the event. label: (str) Name or label for the event. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations.
-
class
neo.core.EventArray(times=None, labels=None, name=None, description=None, file_origin=None, **annotations)¶ Array of events. Introduced for performance reasons.
An
EventArrayis prefered to a list ofEventobjects.Usage:
>>> from neo.core import EventArray >>> from quantities import s >>> import numpy as np >>> >>> evtarr = EventArray(np.arange(0, 30, 10)*s, ... labels=np.array(['trig0', 'trig1', 'trig2'], ... dtype='S')) >>> >>> evtarr.times array([ 0., 10., 20.]) * s >>> evtarr.labels array(['trig0', 'trig1', 'trig2'], dtype='|S5')
- Required attributes/properties:
times: (quantity array 1D) The time of the events. labels: (numpy.array 1D dtype=’S’) Names or labels for the events. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations.
-
class
neo.core.Epoch(time, duration, label, name=None, description=None, file_origin=None, **annotations)¶ A period of time with a start point and duration.
Similar to
Eventbut with a duration. Useful for describing a period, the state of a subject, etc.Usage:
>>> from neo.core import Epoch >>> from quantities import s, ms >>> >>> epc = Epoch(time=50*s, duration=200*ms, label='button pressed') >>> >>> epc.time array(50.0) * s >>> epc.duration array(200.0) * ms >>> epc.label 'button pressed'
- Required attributes/properties:
time: (quantity scalar) The start of the time period. duration: (quantity scalar) The length of the time period. label: (str) A name or label for the time period. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations.
-
class
neo.core.EpochArray(times=None, durations=None, labels=None, name=None, description=None, file_origin=None, **annotations)¶ Array of epochs. Introduced for performance reason.
An
EpochArrayis prefered to a list ofEpochobjects.Usage:
>>> from neo.core import EpochArray >>> from quantities import s, ms >>> import numpy as np >>> >>> epcarr = EpochArray(times=np.arange(0, 30, 10)*s, ... durations=[10, 5, 7]*ms, ... labels=np.array(['btn0', 'btn1', 'btn2'], ... dtype='S')) >>> >>> epcarr.times array([ 0., 10., 20.]) * s >>> epcarr.durations array([ 10., 5., 7.]) * ms >>> epcarr.labels array(['btn0', 'btn1', 'btn2'], dtype='|S4')
- Required attributes/properties:
times: (quantity array 1D) The starts of the time periods. durations: (quantity array 1D) The length of the time period. labels: (numpy.array 1D dtype=’S’) Names or labels for the time periods. - Recommended attributes/properties:
name: (str) A label for the dataset, description: (str) Text description, file_origin: (str) Filesystem path or URL of the original data file. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations,
-
class
neo.core.Spike(time=array(0.0) * s, waveform=None, sampling_rate=None, left_sweep=None, name=None, description=None, file_origin=None, **annotations)¶ A single spike.
Object to represent one spike emitted by a
Unitand represented by its time occurence and optional waveform.- Usage::
>>> from quantities import s >>> spk = Spike(3*s) >>> spk.time array(3.0) * s
- Required attributes/properties:
time: (quantity) The time of the spike. - Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. waveforms: (quantity array 2D (channel_index, time)) The waveform of the spike. sampling_rate: (quantity scalar) Number of samples per unit time for the waveform. left_sweep: (quantity scalar) Time from the beginning of the waveform to the trigger time of the spike. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
sampling_period: (quantity scalar) Interval between two samples. (1/ sampling_rate)duration: (quantity scalar) Duration of waveform, read-only. (waveform.shape[1] *sampling_period)right_sweep: (quantity scalar) Time from the trigger time of the spike to the end of the waveform, read-only. (left_sweep+duration)
-
class
neo.core.SpikeTrain(times, t_stop, units=None, dtype=<type 'float'>, copy=True, sampling_rate=array(1.0) * Hz, t_start=array(0.0) * s, waveforms=None, left_sweep=None, name=None, file_origin=None, description=None, **annotations)¶ SpikeTrainis aQuantityarray of spike times.It is an ensemble of action potentials (spikes) emitted by the same unit in a period of time.
Usage:
>>> from neo.core import SpikeTrain >>> from quantities import s >>> >>> train = SpikeTrain([3, 4, 5]*s, t_stop=10.0) >>> train2 = train[1:3] >>> >>> train.t_start array(0.0) * s >>> train.t_stop array(10.0) * s >>> train <SpikeTrain(array([ 3., 4., 5.]) * s, [0.0 s, 10.0 s])> >>> train2 <SpikeTrain(array([ 4., 5.]) * s, [0.0 s, 10.0 s])>
- Required attributes/properties:
times: (quantity array 1D, numpy array 1D, or list) The times of each spike. units: (quantity units) Required if timesis a list orndarray, not if it is aQuantity.t_stop: (quantity scalar, numpy scalar, or float) Time at which SpikeTrainended. This will be converted to the same units astimes. This argument is required because it specifies the period of time over which spikes could have occurred. Note thatt_startis highly recommended for the same reason.
Note: If
timescontains values outside of the range [t_start, t_stop], an Exception is raised.- Recommended attributes/properties:
name: (str) A label for the dataset. description: (str) Text description. file_origin: (str) Filesystem path or URL of the original data file. t_start: (quantity scalar, numpy scalar, or float) Time at which SpikeTrainbegan. This will be converted to the same units astimes. Default: 0.0 seconds.waveforms: (quantity array 3D (spike, channel_index, time)) The waveforms of each spike. sampling_rate: (quantity scalar) Number of samples per unit time for the waveforms. left_sweep: (quantity array 1D) Time from the beginning of the waveform to the trigger time of the spike. sort: (bool) If True, the spike train will be sorted by time. - Optional attributes/properties:
dtype: (numpy dtype or str) Override the dtype of the signal array. copy: (bool) Whether to copy the times array. True by default. Must be True when you request a change of units or dtype. - Note: Any other additional arguments are assumed to be user-specific
- metadata and stored in
annotations. - Properties available on this object:
sampling_period: (quantity scalar) Interval between two samples. (1/ sampling_rate)duration: (quantity scalar) Duration over which spikes can occur, read-only. ( t_stop-t_start)spike_duration: (quantity scalar) Duration of a waveform, read-only. ( waveform.shape[2] *sampling_period)right_sweep: (quantity scalar) Time from the trigger times of the spikes to the end of the waveforms, read-only. ( left_sweep+spike_duration)times: ( SpikeTrain) Returns theSpikeTrainwithout modification or copying.- Slicing:
SpikeTrainobjects can be sliced. When this occurs, a newSpikeTrain(actually a view) is returned, with the same metadata, except thatwaveformsis also sliced in the same way (along dimension 0). Note that t_start and t_stop are not changed automatically, although you can still manually change them.