Package pype :: Module events
[frames] | no frames]

Source Code for Module pype.events

  1  # -*- Mode: Python; tab-width: 4; py-indent-offset: 4; -*- 
  2   
  3  """Events and result codes 
  4   
  5  Event definitions, based on the encode tags used by the 
  6  ORTEX program from Bob Desimone's lab at NIMH. 
  7   
  8  Author -- James A. Mazer (mazerj@gmail.com) 
  9   
 10  """ 
 11   
 12  #################################################################### 
 13  # Result Codes -- Trial Outcome 
 14  #################################################################### 
 15   
 16  # standard trial result codes (try to use these if possible!!) 
 17  # result codes are single letter -- additional (task-specfic) info 
 18  # can be appended, if required. 
 19   
 20  ANY_RESPONSE                    = None 
 21  CORRECT_RESPONSE                = 'C' 
 22  USER_ABORT                              = 'A' 
 23  UNINITIATED_TRIAL               = 'U' 
 24  MAXRT_EXCEEDED                  = 'M' 
 25  EARLY_RELEASE                   = 'E' 
 26  ERROR_RESPONSE                  = 'X' 
 27   
 28  # this is for trials where there's really no 'correct' or 'incorrect' 
 29  # response possible -- like spontaneous data or freeviewing.. 
 30  NA_RESPONSE                             = 'N' 
 31   
 32  rcodes = { 
 33          'C': 'CORRECT_RESPONSE', 
 34          'A': 'USER_ABORT', 
 35          'U': 'UNITIATED_TRIAL', 
 36          'M': 'MAXRT_EXCEEDED', 
 37          'E': 'EARLY_RELEASE' 
 38  } 
 39   
40 -def iscorrect(code):
41 if code[0] == CORRECT_RESPONSE: 42 return 1 43 else: 44 return 0
45
46 -def isabort(code):
47 if code[0] == ABORT: 48 return 1 49 else: 50 return 0
51
52 -def isui(code):
53 if code[0] == UNINITIATED_TRIAL: 54 return 1 55 else: 56 return 0
57
58 -def ismaxrt_exceeded(code):
59 if code[0] == MAXRT_EXCEEDED: 60 return 1 61 else: 62 return 0
63
64 -def isearly_release(code):
65 if code[0] == EARLY_RELEASE: 66 return 1 67 else: 68 return 0
69 70 #################################################################### 71 # Event Codes -- timestamped and put in the encode buffer 72 #################################################################### 73 74 # internal use only by pype 75 76 EYESHIFT = 'eyeshift' # F8 key (or something similar) 77 ABORT = 'abort' # user hit ESC key 78 79 # semi internal -- generated automatically by pype, but ok to count on.. 80 81 MARKFLIP = 'INT_MARKFLIP' 82 83 # for general (task) use: 84 85 86 START_ITI = 'start_iti' 87 END_ITI = 'end_iti' 88 89 START_PRE_TRIAL = 'start_pre_trial' 90 END_PRE_TRIAL = 'end_pre_trial' 91 92 START_POST_TRIAL = 'start_post_trial' 93 END_POST_TRIAL = 'end_post_trial' 94 95 START_WAIT_FIXATION = 'start_wait_fixation' 96 END_WAIT_FIXATION = 'end_wait_fixation' 97 FIXATION_OCCURS = 'fixation_occurs' 98 99 START_WAIT_BAR = 'start_wait_bar' 100 END_WAIT_BAR = 'end_wait_bar' 101 BAR_UP = 'bar_up' 102 BAR_DOWN = 'bar_down' 103 BAR_CHANGE = 'bar_change' 104 105 TEST_ON = 'test_on' 106 TEST_OFF = 'test_off' 107 108 FIX_ON = 'fix_on' 109 FIX_OFF = 'fix_off' 110 111 FIX_ACQUIRED = 'fix_acquired' 112 OLD_FIX_ACQUIRED = 'fix_acuired' 113 FIX_LOST = 'fix_lost' 114 FIX_DONE = 'fix_done' 115 116 TARGET_ACQUIRED = 'target_acquired' 117 TARGET_LOST = 'target_lost' 118 119 START_SPONT = 'start_spont' 120 STOP_SPONT = 'stop_spont' 121 122 REWARD = 'reward' 123 124 SPIKE1 = '_s1' 125 SPIKE2 = '_s2' 126 SPIKE3 = '_s3' 127 SPIKE4 = '_s4' 128 SPIKE5 = '_s5' 129 SPIKE6 = '_s6' 130 SPIKE7 = '_s7' 131 SPIKE8 = '_s8' 132 SPIKE9 = '_s9' 133 SPIKE10 = '_s10' 134 SPIKE11 = '_s11' 135 SPIKE12 = '_s12' 136 SPIKE13 = '_s13' 137 SPIKE14 = '_s14' 138 SPIKE15 = '_s15' 139 SPIKE16 = '_s16' 140 141 # DMTS constants 142 SAMPLE_ON = 'sample_on' 143 SAMPLE_OFF = 'sample_off' 144 TARGETS_ON = 'targets_on' 145 TARGETS_OFF = 'targets_off' 146 mod_MATCH = ' match' # modifier only 147 mod_NON_MATCH = ' non-match' # modifier only 148 149 150 # for internal use: 151 START = 'start' 152 STOP = 'stop' 153 EYE_START = 'eye_start' 154 EYE_STOP = 'eye_stop' 155 EYE_OVERFLOW = 'eye_overflow' 156 157 # new events for non-cortex-like stuff... add below: 158 FLIP = 'flip' 159 160 # debugging mark 161 MARK = 'mark' 162 163 # trigger event for automatic psth 164 PSTH_TRIG = 'psth_trig' 165 166 #################################################################### 167 # label tags for pickled datafiles 168 #################################################################### 169 170 ENCODE = 'ENCODE' 171 NOTE = 'NOTE' 172 WARN = 'WARN' 173 ANNOTATION = 'ANNOTATION' 174 175 176 if __name__=='__main__' : 177 pass 178