Browse Source

gin commit from Ivory

New files: 1
Modified files: 2
Achilleas Koutsou 5 years ago
parent
commit
90cd64ba68
3 changed files with 34 additions and 3 deletions
  1. 1 1
      EEG for MNE/LED_28_06_2012_104.nix
  2. 2 2
      mnetonix.py
  3. 31 0
      plotnix.py

+ 1 - 1
EEG for MNE/LED_28_06_2012_104.nix

@@ -1 +1 @@
-/annex/objects/MD5-s151337389--b357aa9c43f50b0031b3550717a672e6
+/annex/objects/MD5-s151338429--12314688ea11c6ab7ee47405cf4b02ac

+ 2 - 2
mnetonix.py

@@ -105,8 +105,8 @@ def write_multi_da(mneraw, block):
 
 def write_stim_tags(mneraw, block):
     stimuli = mneraw.annotations
-    positions = stimuli.onset
-    extents = stimuli.duration
+    positions = [(p,) for p in stimuli.onset]
+    extents = [(e,) for e in stimuli.duration]
     labels = stimuli.description
 
     posda = block.create_data_array("Stimuli onset", "Stimuli Positions",

+ 31 - 0
plotnix.py

@@ -0,0 +1,31 @@
+import sys
+import matplotlib.pyplot as plt
+import nixio as nix
+
+
+fname = sys.argv[1]
+nixfile = nix.File(fname, mode=nix.FileMode.ReadOnly)
+block = nixfile.blocks[0]
+
+nda = len(block.data_arrays)
+nda = min(nda, 3)
+mtag = block.multi_tags[0]
+
+for idx, da in enumerate(block.data_arrays):
+    print(f"Plotting signal {idx}")
+    plt.subplot(nda, 1, idx+1)
+    plt.plot(da[:])
+
+    # for npos in range(len(mtag.positions)):
+    #     mtagdata = mtag.retrieve_data(npos, idx)
+    #     plt.plot(mtagdata[:])
+
+    mtagdata = mtag.retrieve_data(0, idx)
+    print(mtagdata)
+
+    if idx == nda-1:
+        break
+
+plt.show()
+
+nixfile.close()