def calc_rel_angles(self, fixdata): """returns the relative angles between a sequence of "Fixation"s that build a scan path in Radiant Relative angle for each saccade is the angle between that saccade and the previous saccade. Args: fixdata: a list of "Fixation"s Returns: a list of relative angles for the saccades formed by the given sequence of "Fixation"s in Radiant """ rel_angles = [] lastx = fixdata[0].mappedfixationpointx lasty = fixdata[0].mappedfixationpointy for i in xrange(1, len(fixdata)-1): x = fixdata[i].mappedfixationpointx y = fixdata[i].mappedfixationpointy nextx = fixdata[i+1].mappedfixationpointx nexty = fixdata[i+1].mappedfixationpointy (dist, theta) = geometry.vector_difference((x,y), (lastx, lasty)) (dist, nextheta) = geometry.vector_difference((x,y), (nextx, nexty)) theta = abs(theta-nextheta) rel_angles.append(theta) lastx=x lasty=y return rel_angles
def calc_rel_angles(self, fixdatalists): """returns the relative angles between a sequence of "Fixation"s that build a scan path in Radiant Relative angle for each saccade is the angle between that saccade and the previous saccade. Args: fixdatalists: a list of lists of "Fixation"s Returns: a list of relative angles for the saccades formed by the given sequence of "Fixation"s in Radiant """ rel_angles = [] for fixdata in fixdatalists: if not(fixdata): continue lastx = fixdata[0].mappedfixationpointx lasty = fixdata[0].mappedfixationpointy for i in xrange(1, len(fixdata)-1): x = fixdata[i].mappedfixationpointx y = fixdata[i].mappedfixationpointy nextx = fixdata[i+1].mappedfixationpointx nexty = fixdata[i+1].mappedfixationpointy (_, theta) = geometry.vector_difference((x,y), (lastx, lasty)) (_, nextheta) = geometry.vector_difference((x,y), (nextx, nexty)) theta = abs(theta-nextheta) rel_angles.append(theta) lastx=x lasty=y return rel_angles
def calc_abs_angles(self, fixdatalists): """returns the absolute angles between a sequence of "Fixation"s that build a scan path. Abosolute angle for each saccade is the angle between that saccade and the horizental axis Args: fixdatalists: a list of lists of "Fixation"s Returns: a list of absolute angles for the saccades formed by the given sequence of "Fixation"s in Radiant """ abs_angles = [] for fixdata in fixdatalists: if not(fixdata): continue lastx = fixdata[0].mappedfixationpointx lasty = fixdata[0].mappedfixationpointy for i in xrange(1,len(fixdata)): x = fixdata[i].mappedfixationpointx y = fixdata[i].mappedfixationpointy (_, theta) = geometry.vector_difference((lastx,lasty), (x, y)) abs_angles.append(abs(theta)) lastx=x lasty=y return abs_angles
def calc_rel_angles(self, fixdata): rel_angles = [] lastx = fixdata[0].mappedfixationpointx lasty = fixdata[0].mappedfixationpointy for i in xrange(1, len(fixdata)-1): x = fixdata[i].mappedfixationpointx y = fixdata[i].mappedfixationpointy nextx = fixdata[i+1].mappedfixationpointx nexty = fixdata[i+1].mappedfixationpointy (dist, theta) = geometry.vector_difference((x,y), (lastx, lasty)) (dist, nextheta) = geometry.vector_difference((x,y), (nextx, nexty)) theta = abs(theta-nextheta) rel_angles.append(theta) lastx=x lasty=y return rel_angles
def calc_abs_angles(self, fixdata): abs_angles = [] lastx = fixdata[0].mappedfixationpointx lasty = fixdata[0].mappedfixationpointy for i in xrange(1,len(fixdata)): x = fixdata[i].mappedfixationpointx y = fixdata[i].mappedfixationpointy (dist, theta) = geometry.vector_difference((lastx,lasty), (x, y)) abs_angles.append(abs(theta)) lastx=x lasty=y return abs_angles
def calc_abs_angles(fixdata): """returns the absolute angles between a sequence of "Fixation"s that build a scan path. Abosolute angle for each saccade is the angle between that saccade and the horizental axis Args: fixdata: a list of fixation datapoints Returns: a list of absolute angles for the saccades formed by the given sequence of "Fixation"s in Radiant """ abs_angles = [] lastx = fixdata[0][0] lasty = fixdata[0][1] for i in xrange(1,len(fixdata)): x = fixdata[i][0] y = fixdata[i][1] (dist, theta) = geometry.vector_difference((lastx,lasty), (x, y)) abs_angles.append(abs(theta)) lastx = x lasty = y return abs_angles