pynapple.io.NeoSignalInterface#
- class pynapple.io.NeoSignalInterface(signal, block, time_support=None, sig_num=0)[source]#
Bases:
objectInterface for lazy-loading Neo analog signals into pynapple objects.
This class provides lazy access to Neo analog signals (AnalogSignal, IrregularlySampledSignal), loading data only when requested. It acts as a pseudo memory-mapped array that can be passed directly to Tsd, TsdFrame, or TsdTensor initialization with load_array=False.
The interface is array-like (has shape, dtype, ndim, supports indexing and iteration) so it can be used as a drop-in replacement for numpy arrays in pynapple time series constructors.
- Parameters:
signal (neo signal object) – A Neo analog signal (AnalogSignal or IrregularlySampledSignal)
block (neo.Block) – The parent block containing the signal
time_support (IntervalSet) – Time support for the data
sig_num (int, optional) – Index of the signal within the segment
- nap_type#
The pynapple type this signal will be converted to (Tsd, TsdFrame, or TsdTensor)
- Type:
- dtype#
Data type of the signal
- Type:
- times#
Pre-loaded timestamps for all segments (in seconds)
- Type:
Examples
>>> interface = NeoSignalInterface(signal, block, time_support, sig_num=0) >>> # Use as array-like for lazy loading >>> tsd = nap.Tsd(t=interface.times, d=interface, load_array=False) >>> # Data is only loaded when accessed >>> chunk = tsd[0:1000] # Loads only first 1000 samples
Methods
__init__(signal, block[, time_support, sig_num])Attributes
- property ndim#
Number of dimensions.
- property times#
Pre-loaded timestamps for all segments (in seconds).