plotnix.py 631 B

12345678910111213141516171819202122232425262728293031
  1. import sys
  2. import matplotlib.pyplot as plt
  3. import nixio as nix
  4. fname = sys.argv[1]
  5. nixfile = nix.File(fname, mode=nix.FileMode.ReadOnly)
  6. block = nixfile.blocks[0]
  7. nda = len(block.data_arrays)
  8. nda = min(nda, 3)
  9. mtag = block.multi_tags[0]
  10. for idx, da in enumerate(block.data_arrays):
  11. print(f"Plotting signal {idx}")
  12. plt.subplot(nda, 1, idx+1)
  13. plt.plot(da[:])
  14. # for npos in range(len(mtag.positions)):
  15. # mtagdata = mtag.retrieve_data(npos, idx)
  16. # plt.plot(mtagdata[:])
  17. mtagdata = mtag.retrieve_data(0, idx)
  18. print(mtagdata)
  19. if idx == nda-1:
  20. break
  21. plt.show()
  22. nixfile.close()