pynapple.io.NeoSignalInterface#

class pynapple.io.NeoSignalInterface(signal, block, time_support=None, sig_num=0)[source]#

Bases: object

Interface 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:

type

is_analog#

Whether this is a regularly sampled analog signal

Type:

bool

dt#

Sampling interval (for analog signals)

Type:

float

shape#

Shape of the data (total samples across all segments, channels, …)

Type:

tuple

dtype#

Data type of the signal

Type:

numpy.dtype

ndim#

Number of dimensions

Type:

int

times#

Pre-loaded timestamps for all segments (in seconds)

Type:

numpy.ndarray

start_time#

Start time

Type:

float

end_time#

End time

Type:

float

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
__init__(signal, block, time_support=None, sig_num=0)[source]#

Methods

__init__(signal, block[, time_support, sig_num])

Attributes

ndim

Number of dimensions.

times

Pre-loaded timestamps for all segments (in seconds).

property ndim#

Number of dimensions.

property times#

Pre-loaded timestamps for all segments (in seconds).