def parse_phase(self, l): # Only store the sample_stim and wmdelay phases, and downsample the # samples to 100 Hz. if self.current_phase in ('target', 'fixation') or \ 'target' in l or 'fixation' in l: EyeLinkParser.parse_phase(self, l)
def parse_phase(self, l): if self.current_phase in ('cue', 'retention', 'preAttProbe') \ or 'cue' in l or 'retention' in l or 'preAttProbe' in l: s = sample(l) if s is None or s.t % DOWNSAMPLE == 0: EyeLinkParser.parse_phase(self, l)
def end_phase(self, l): EyeLinkParser.end_phase(self, l) del self.trialdm.fixetlist_phase del self.trialdm.fixstlist_phase del self.trialdm.fixxlist_phase del self.trialdm.fixylist_phase
def end_phase(self): if len(self.ptrace) > MAXDEPTH: warnings.warn('Very long trace, truncating to 5000: %s (%d)' \ % (self.current_phase, len(self.ptrace))) self.ptrace = self.ptrace[:MAXDEPTH] self.xtrace = self.xtrace[:MAXDEPTH] self.ytrace = self.ytrace[:MAXDEPTH] EyeLinkParser.end_phase(self)
def split(self, line): l = EyeLinkParser.split(self, line) # Convert samples to EyeLink format. The IDF encodes like this: # 00 Time # 01 Type # 02 Trial # 03 L Dia X [px] # 04 L Dia Y [px] # 05 L Mapped Diameter [mm] # 06 R Dia X [px] # 07 R Dia Y [px] # 08 R Mapped Diameter [mm] # 09 L POR X [px] # 10 L POR Y [px] # 11 R POR X [px] # 12 R POR Y [px] # 13 Timing # 14 Latency # 15 L Validity # 16 R Validity # 17 Pupil Confidence # 18 L Plane # 19 R Plane # 20 L EPOS X # 21 L EPOS Y # 22 L EPOS Z # 23 R EPOS X # 24 R EPOS Y # 25 R EPOS Z # 26 L GVEC X # 27 L GVEC Y # 28 L GVEC Z # 29 R GVEC X # 30 R GVEC Y # 31 R GVEC Z # 32 Aux1 (seems to be missing in actual data. Maybe an extra field?) if not l or len(l) < 32 or l[1] != u'SMP': # Not a sample! return l x = .5 * l[20] + .5 * l[23] y = .5 * l[21] + .5 * l[24] ps = .5 * l[5] + .5 * l[8] t = l[0] return [t, x, y, ps, u'...']
def split(self, line): l = EyeLinkParser.split(self, line) if not l: return l # Convert messages to EyeLink format if l[0] == u'MSG': l = l[3:] l.insert(0, u'MSG') return l # Convert samples to EyeLink format: if len(l) == 24: x, y, ps = l[7:10] t = l[2] fix = l[3] == 'True' if fix: if not self.infix: self.xlist = [] self.ylist = [] self.tlist = [] self.pslist = [] self.xlist.append(x) self.ylist.append(y) self.tlist.append(t) self.pslist.append(ps) elif self.infix: mx = np.nanmean(self.xlist) my = np.nanmean(self.ylist) mps = np.nanmean(self.pslist) st = self.tlist[0] et = self.tlist[-1] self.parse_phase(['EFIX', 'R', st, et, et - st, mx, my, mps]) self.infix = fix l = [l[2], x, y, ps, u'...'] return l return l
def __init__(self, **kwargs): if u'ext' not in kwargs: kwargs[u'ext'] = [u'.tar.xz', u'.tsv'] self.on_start_trial = chain(self.init_infix, self.on_start_trial) EyeLinkParser.__init__(self, **kwargs)
def __init__(self, **kwargs): if u'ext' not in kwargs: kwargs[u'ext'] = [u'.tar.xz', u'.txt'] EyeLinkParser.__init__(self, **kwargs)
def parse_sample(self, s): if s.pupil_size == '#': return EyeLinkParser.parse_sample(self, s)