pynapple.core.time_series.Ts.save#

Ts.save(filename)[source]#

Save Ts object in npz format. The file will contain the timestamps and the time support.

The main purpose of this function is to save small/medium sized timestamps object.

You can load the object with nap.load_file. Keys are ‘t’, ‘start’ and ‘end’ and ‘type’. See the example below.

Parameters:

filename (str) – The filename

Examples

>>> import pynapple as nap
>>> import numpy as np
>>> ts = nap.Ts(t=np.array([0., 1., 1.5]))
>>> ts.save("my_path/my_ts.npz")

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

>>> ts = nap.load_file("my_path/my_ts.npz")
>>> ts
Time (s)
0.0
1.0
1.5
Raises:

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