Browse Source

Update RGIO for usage with NixIO and add more array annotations

Julia Sprenger 4 years ago
parent
commit
c733ce1cf0
1 changed files with 13 additions and 2 deletions
  1. 13 2
      code/reachgraspio/reachgraspio.py

+ 13 - 2
code/reachgraspio/reachgraspio.py

@@ -758,9 +758,15 @@ class ReachGraspIO(BlackrockIO):
         events.array_annotate(belongs_to_trialtype=belongs_to_trialtype)
 
         # add modified trial_performance_codes to annotations
-        performance_in_trial = [
-            trialsequence[tid] for tid in trial_timestamp_ID]
+        performance_in_trial = [trialsequence[tid] for tid in trial_timestamp_ID]
+        performance_in_trial_str = []
+        for pit in performance_in_trial:
+            if pit in self.performance_str:
+                performance_in_trial_str.append(self.performance_str[pit])
+            else:
+                performance_in_trial_str.append('unknown')
         events.array_annotate(performance_in_trial=performance_in_trial)
+        events.array_annotate(performance_in_trial_str=performance_in_trial_str)
 
     def __annotate_units_with_odml(self, units):
         """
@@ -1440,6 +1446,10 @@ class ReachGraspIO(BlackrockIO):
                 self.__annotate_channelindex_with_odml(chidx)
                 self.__annotate_units_with_odml(chidx.units)
 
+        for chidx in bl.channel_indexes:
+            if isinstance(chidx.index, int):
+                chidx.index = [chidx.index]
+
         return bl
 
     def read_segment(
@@ -1523,6 +1533,7 @@ class ReachGraspIO(BlackrockIO):
             cascade=cascade)
 
         for asig in seg.analogsignals:
+            asig.name = str(asig.name)
             self.__annotate_analogsignals_with_odml(asig)
             if correct_filter_shifts:
                 self.__correct_filter_shifts(asig)