Browse Source

Various updates to reachgrasp docstrings, and added useful block annotations

Michael Denker 11 months ago
parent
commit
9e5bcdedbd
1 changed files with 42 additions and 3 deletions
  1. 42 3
      code/reachgraspio/reachgraspio.py

+ 42 - 3
code/reachgraspio/reachgraspio.py

@@ -1247,7 +1247,8 @@ class ReachGraspIO(BlackrockIO):
                         of trial types presented to the subject during a
                         segment of the recording) present during the recording.
                         For a mapping of condition codes to trial types, see
-                        the condition_str attribute of the ReachGraspIO class.
+                        the condition_str attribute of the ReachGraspIO class
+                        or corresponding Block annotations.
                     subject_name (str):
                         Name of the recorded subject.
                     subject_gender (bool):
@@ -1295,13 +1296,41 @@ class ReachGraspIO(BlackrockIO):
                     rec_pauses (bool):
                         True if the session contains a recording pause (i.e.,
                         multiple segments).
+                    event_labels_str (dict):
+                        Provides a text label for each digital event code returned as
+                        events by the parent BlackrockIO. For example,
+                        event_labels_str['65296'] contains the string 'TS-ON'.
+                    event_labels_codes (dict):
+                        Reverse of `event_labels_str`: Provides a list of event codes
+                        related to a specific text label for a trial event. For example,
+                        event_labels_codes['TS-ON'] contains the list ['65296']. In
+                        addition to the detailed codes, for convenience the meta codes
+                        'CUE/GO', 'RW-ON', and 'SR' summarizing a set of digital events are
+                        defined for easier access.
+                    trial_const_sequence_str (dict):
+                        Dictionary contains the ordering of selected constant trial events
+                        for correct trials, e.g., as TS is the first trial event in a
+                        correct trial, trial_const_sequence_codes['TS'] is 0.
+                    trial_const_sequence_codes (dict):
+                        Reverse of trial_const_sequence_str: Dictionary contains the
+                        ordering of selected constant trial events for correct trials,
+                        e.g., trial_const_sequence_codes[0] is 'TS'.
+                    performance_str (dict):
+                        Text strings to help interpret the performance code of a trial. For
+                        example, correct trials have a performance code of 255, and thus
+                        performance_str[255] == 'correct_trial'
+                    performance_codes (dict):
+                        Reverse of performance_const_sequence_str. Returns the performance
+                        code of a given text string indicating trial performance. For
+                        example, performance_str['correct_trial'] == 255
 
                 Segment annotations:
                     condition (int):
                         Condition code (describing the set of trial types
                         presented to the subject) of this segment. For a
                         mapping of condition codes to trial types, see the
-                        condition_str attribute of the ReachGraspIO class.
+                        condition_str attribute of the ReachGraspIO class
+                        or corresponding Block annotations.
 
                 ChannelIndex annotations:
                     connector_aligned_id (int):
@@ -1516,7 +1545,8 @@ class ReachGraspIO(BlackrockIO):
                     performance_in_trial (list of int):
                         Performance code of the trial that the event belongs
                         to. Compare to the performance_codes and
-                        performance_str attributes of ReachGraspIO class.
+                        performance_str attributes of ReachGraspIO class
+                        or corresponding Block annotations.
                     trial_reject_XXX:
                         For different filter ranges XXX (defined in the odML
                         file), if True this variable indicates whether the
@@ -1576,6 +1606,15 @@ class ReachGraspIO(BlackrockIO):
             self.__annotate_channel_infos(bl)
             self.__annotate_units_with_odml(bl.groups)
 
+        # Add annotations for general performance codes and generic information
+        bl.annotate(performance_str=self.performance_str)
+        bl.annotate(performance_codes=self.performance_codes)
+        bl.annotate(condition_str=self.condition_str)
+        bl.annotate(event_labels_str=self.event_labels_str)
+        bl.annotate(event_labels_codes=self.event_labels_codes)
+        bl.annotate(trial_const_sequence_str=self.trial_const_sequence_str)
+        bl.annotate(trial_const_sequence_codes=self.trial_const_sequence_codes)
+
         return bl
 
     def read_segment(