Skip to content

Commit

Permalink
Removed spelling mistake (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomahawkuru committed Jul 12, 2021
1 parent 1ec222b commit 6a9a1e6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
44 changes: 22 additions & 22 deletions calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def saccade(x, y, v, time, events, printing):
x - numpy array of x positions
y - numpy array of y positions
v - numpy array of velocities
time - numpy array of tracker timestamps in milliseconds
time - numpy array of trafcker timestamps in milliseconds
events - numpy array of of detected gaze events
returns
Expand Down Expand Up @@ -136,9 +136,9 @@ def saccade(x, y, v, time, events, printing):
return Saccades


def persuit(x, y, v, time, events, printing):
def pursuit(x, y, v, time, events, printing):
"""
Calculates Persuit measures
Calculates Pursuit measures
arguments
x - numpy array of x positions
Expand All @@ -148,10 +148,10 @@ def persuit(x, y, v, time, events, printing):
events - numpy array of of detected gaze events
returns
Persuits - list of lists, each containing [starttime, endtime, duration, startx, starty, endx, endy, amplitude, meanvel, maxvel])]
Pursuits - list of lists, each containing [starttime, endtime, duration, startx, starty, endx, endy, amplitude, meanvel, maxvel])]
"""
# empty list to contain data
Persuits = []
Pursuits = []

# check where the missing samples are
idx = numpy.array(events == 'SP', dtype=int)
Expand All @@ -169,7 +169,7 @@ def persuit(x, y, v, time, events, printing):
if len(starts) > len(ends):
ends = np.append(ends, len(idx) - 1)

# compile persuit starts and ends
# compile pursuit starts and ends
for i in range(len(starts)):
# get starting index
s = starts[i]
Expand All @@ -187,22 +187,22 @@ def persuit(x, y, v, time, events, printing):
meanvel = sum(v[s:e]) / len(v[s:e])
maxvel = max(v[s:e])

Persuits.append([time[s], time[e], duration, x[s], y[s], x[e], y[e], amplitude, meanvel, maxvel])

Persuits = numpy.array(Persuits)
if Persuits.any() and printing:
numSP = len(Persuits)
avgSPT = 1000 * sum(Persuits[:, 2]) / numSP
avgSPA = sum(Persuits[:, 7]) / numSP
avgSPV = sum(Persuits[:, 8]) / numSP
avgSPMV = sum(Persuits[:, 9]) / numSP
print('Number of Smooth Persuits: ' + str(numSP))
print(' Average persuit duration: ' + str(avgSPT) + 'ms')
print(' Average persuit Amplitude: ' + str(avgSPA) + ' deg')
print(' Average persuit velocity: ' + str(avgSPV) + ' deg/s')
print(' Average max persuit velocity: ' + str(avgSPMV) + ' deg/s')

return Persuits
Pursuits.append([time[s], time[e], duration, x[s], y[s], x[e], y[e], amplitude, meanvel, maxvel])

Pursuits = numpy.array(Pursuits)
if Pursuits.any() and printing:
numSP = len(Pursuits)
avgSPT = 1000 * sum(Pursuits[:, 2]) / numSP
avgSPA = sum(Pursuits[:, 7]) / numSP
avgSPV = sum(Pursuits[:, 8]) / numSP
avgSPMV = sum(Pursuits[:, 9]) / numSP
print('Number of Smooth Pursuits: ' + str(numSP))
print(' Average pursuit duration: ' + str(avgSPT) + 'ms')
print(' Average pursuit Amplitude: ' + str(avgSPA) + ' deg')
print(' Average pursuit velocity: ' + str(avgSPV) + ' deg/s')
print(' Average max pursuit velocity: ' + str(avgSPMV) + ' deg/s')

return Pursuits


def blink(time, events, printing):
Expand Down
2 changes: 1 addition & 1 deletion functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def fill_blink_gaps(Tx, Ty, t, s):

def save_events(data, fname, datapath):
"""
saves detections and their measures csv files (fixations, saccades, persuits and blinks).
saves detections and their measures csv files (fixations, saccades, pursuits and blinks).
Each row of the csv, is one gaze event. It includes measures such as :
["t_start", 't_end', 'duration', 'x_start', 'y_start', 'x_end', 'y_end', 'amplitude', 'mean_vel', 'max_vel']
Expand Down
24 changes: 12 additions & 12 deletions plotters.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Functions for helping with plotting of various figures and data
"""

def detection(x, y, t, v, fixations, saccades, persuits, blinks, trials, trial, axs):
def detection(x, y, t, v, fixations, saccades, pursuits, blinks, trials, trial, axs):
if trials > 1:
axs1 = axs[trial - 1]
else:
Expand All @@ -29,15 +29,15 @@ def detection(x, y, t, v, fixations, saccades, persuits, blinks, trials, trial,
axs1.axvspan(fixations[i, 0], fixations[i, 1], color='g', alpha=.1, label = "_"*i + "Fixations")
for i in range(len(saccades)):
axs1.axvspan(saccades[i, 0], saccades[i, 1], color='r', alpha=.1, label = "_"*i + "Saccades")
for i in range(len(persuits)):
axs1.axvspan(persuits[i, 0], persuits[i, 1], color='y', alpha=.1, label = "_"*i + "Persuits")
for i in range(len(pursuits)):
axs1.axvspan(pursuits[i, 0], pursuits[i, 1], color='y', alpha=.1, label = "_"*i + "Pursuits")
for i in range(len(blinks)):
axs1.axvspan(blinks[i, 0], blinks[i, 1], color='b', alpha=.1, label = "_"*i + "Blinks")

axs1.legend(loc='upper left')
axs2.legend(loc='upper right')

def calculation(fixations, saccades, persuits, blinks, trial, participant):
def calculation(fixations, saccades, pursuits, blinks, trial, participant):
plt.figure(trial + 1, figsize=[25.60, 14.40])
plt.subplot(4, 4, 1)
histogramreighley(fixations[:, 2])
Expand All @@ -62,21 +62,21 @@ def calculation(fixations, saccades, persuits, blinks, trial, participant):
plt.xlabel('Velocity [deg/s]')

plt.subplot(4, 4, 9)
histogramreighley(persuits[:, 2])
plt.title("Persuit duration")
histogramreighley(pursuits[:, 2])
plt.title("Pursuit duration")
plt.xlabel('Time [s]')
plt.subplot(4, 4, 10)
histogramreighley(persuits[:, 7])
plt.title("Persuit amplitude")
histogramreighley(pursuits[:, 7])
plt.title("Pursuit amplitude")
plt.xlabel('Amplitude [deg]')
plt.subplot(4, 4, 11)
plt.xlabel('Amplitude [deg]')
histogramreighley(persuits[:, 8])
plt.title("Persuit mean velocity")
histogramreighley(pursuits[:, 8])
plt.title("Pursuit mean velocity")
plt.xlabel('Velocity [deg/s]')
plt.subplot(4, 4, 12)
histogramreighley(persuits[:, 9])
plt.title("Persuit max velocity")
histogramreighley(pursuits[:, 9])
plt.title("Pursuit max velocity")
plt.xlabel('Velocity [deg/s]')

plt.subplot(4, 4, 13)
Expand Down
2 changes: 1 addition & 1 deletion run_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def DetectGazeEvents(gazedata, verbose):
fixparam["VERBOSE"] = verbose # debug mode
gazedata = FixationDetector(fixparam, gazedata)

# Smooth Persuit detection-------------------------------------------------------------------------------------------
# Smooth Pursuit detection-------------------------------------------------------------------------------------------
SPparam = dict()
SPparam["MIN_PTS"] = 1 # minimum points for a neighborhood (default value, e.g. 160) * (N_observers / 46.9) * (F_hz / 250)
SPparam["EPS_DEG"] = 4 # deg
Expand Down

0 comments on commit 6a9a1e6

Please sign in to comment.