def _parse_tal_channel(tal_channel_data):
 tals = bytearray()
 for chan in tal_channel_data:
  for s in chan:
   i = int(s)
   tals.extend(np.uint8([(i % 256), (i // 256)]))
 regex_tal = '([+-]\\d+\\.?\\d*)(\x15(\\d+\\.?\\d*))?(\x14.*?)\x14\x00'
 tal_list = re.findall(regex_tal, tals.decode('latin-1'))
 events = []
 for ev in tal_list:
  onset = float(ev[0])
  duration = (float(ev[2]) if ev[2] else 0)
  for annotation in ev[3].split('\x14')[1:]:
   if annotation:
    events.append([onset, duration, annotation])
 return events

def _parse_tal_channel ( tal_channel_data ) : tals = bytearray ( ) for chan in tal_channel_data : for s in chan : i = int ( s ) tals . extend ( np . uint8 ( [ ( i % 256 ) , ( i // 256 ) ] ) ) regex_tal = '([+-]\\d+\\.?\\d*)(\x15(\\d+\\.?\\d*))?(\x14.*?)\x14\x00' tal_list = re . findall ( regex_tal , tals . decode ( 'latin-1' ) ) events = [ ] for ev in tal_list : onset = float ( ev [ 0 ] ) duration = ( float ( ev [ 2 ] ) if ev [ 2 ] else 0 ) for annotation in ev [ 3 ] . split ( '\x14' ) [ 1 : ] : if annotation : events . append ( [ onset , duration , annotation ] ) return events
parse time-stamped annotation lists in stim_channel .