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