pynapple.core.time_series.TsdFrame.save#

TsdFrame.save(filename)[source]#

Save TsdFrame 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
>>> tsdframe = nap.TsdFrame(t=np.array([0., 1.]), d = np.array([[2, 3],[4,5]]), columns=['a', 'b'])
>>> tsdframe.save("my_path/my_tsdframe.npz")

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

>>> tsdframe = nap.load_file("my_path/my_tsdframe.npz")
>>> tsdframe
          a  b
Time (s)
0.0       2  3
1.0       4  5
Raises:

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