Debian Codegraph @

docs/source/examples/rangeDimensionLink.py

raw symbols SCIP
1 import nixio
2 import numpy as np
3
4
5 def create_data(duration, interval):
6 times = np.around(np.cumsum(np.random.poisson(2.0 * 1000, int(1.5 * duration / interval))) / 1000., 3)
7 times = times[times < duration]
8 return times
9
10
11 def main():
12 event_times = create_data(10., 1.0)
13 nixfile = nixio.File.open("range_link.nix", nixio.FileMode.Overwrite)
14 b = nixfile.create_block("session", "nix.session")
15
16 data_array = b.create_data_array("event times", "nix.event.times", data=event_times, label="time", unit="s")
17 data_array.append_range_dimension_using_self()
18
19 nixfile.close()
20
21
22 if __name__ == "__main__":
23 main()