pynapple.core.time_series.TsdTensor.save#

TsdTensor.save(filename)[source]#

Save TsdTensor object in npz format. The file will contain the timestamps, the data and the time support.

The main purpose of this function is to save small/medium sized time series objects. For example, you extracted several channels from your recording and filtered them. You can save the filtered channels as a npz to avoid reprocessing it.

You can load the object with nap.load_file. Keys are ‘t’, ‘d’, ‘start’, ‘end’, ‘type’ and ‘columns’ for columns names.

Parameters:

filename (str) – The filename

Examples

>>> import pynapple as nap
>>> import numpy as np
>>> tsdtensor = nap.TsdTensor(t=np.array([0., 1.]), d = np.zeros((2,3,4)))
>>> tsdtensor.save("my_path/my_tsdtensor.npz")

To load you file, you can use the nap.load_file function :

>>> tsdtensor = nap.load_file("my_path/my_tsdtensor.npz")
Raises:

RuntimeError – If filename is not str, path does not exist or filename is a directory.