Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
bazilinskyy committed Jan 1, 2025
1 parent b187d3a commit d399621
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
24 changes: 13 additions & 11 deletions trust/analysis/heroku.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,28 +472,28 @@ def points(self, df, save_csv=True):
point = Point(given_x[val]*norm_x,
given_y[val]*norm_y)

# check if point is within a polygon in the middle
# check if point is within a polygon in the middle
if polygon.contains(point):
# point in the middle detected
detected += 1
# Check if for the worker there were more than
# allowed limit of points in the middle
if detected / length_points > allowed_percentage:
if detected / length_points > allowed_percentage:
break
if detected / length_points < allowed_percentage:
for value in range(length_points):
if detected / length_points < allowed_percentage:
for value in range(length_points):
t_step = round(given_t[value]/hm_resolution)
if duration == t_step:
if id_video not in points_duration[duration]:
if id_video not in points_duration[duration]:
points_duration[duration][id_video] = [[given_x[value]*norm_x,
given_y[value]*norm_y]]
else:
points_duration[duration][id_video].append([given_x[value]*norm_x,
given_y[value]*norm_y])
if duration < t_step:
break
# start adding points to the points_duration list
# iterate over all values given by the participand
# start adding points to the points_duration list
# iterate over all values given by the participand
# for val in range(len(given_y)-1):
# # add coordinates
# if id_video not in points:
Expand All @@ -502,7 +502,7 @@ def points(self, df, save_csv=True):
# else:
# points[id_video].append([(coords[0]),
# (coords[1])])
# if stim_from_df.index[pp] not in points_worker:
# if stim_from_df.index[pp] not in points_worker:
# points_worker[stim_from_df.index[pp]] = [[(coords[0]),
# (coords[1])]]
# else:
Expand Down Expand Up @@ -624,23 +624,25 @@ def process_kp(self, filter_length=True):
if rt - self.res < data <= rt:
# if data is found, up bin counter
bin_counter = bin_counter + 1
kp_raw.append(rt)
kp_raw.append(data)
if counter_data:
percentage = bin_counter / counter_data
kp.append(round(percentage * 100))
else:
kp.append(0)
kp_raw.append(0)
# store keypresses from repetition
video_kp.append(kp)
# store raw data from repetition
video_kp_raw.append(kp_raw)
print(video_kp_raw)
break
# calculate mean keypresses from all repetitions
kp_mean = [*map(mean, zip(*video_kp))]
kp_mean_raw = [*map(mean, zip(*video_kp_raw))]
# kp_mean_raw = [*map(mean, zip(*video_kp_raw))]
# append data from one video to the mapping array
mapping_rt.append(kp_mean)
mapping_rt_raw.append(kp_mean_raw)
mapping_rt_raw.append(video_kp_raw)
if filter_length:
logger.info('Filtered out keypress data from {} videos with unexpected length.', counter_filtered)
# update own mapping to include keypress data
Expand Down
7 changes: 4 additions & 3 deletions trust/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
CALC_COORDS = False # extract points from heroku data
UPDATE_MAPPING = True # update mapping with keypress data
SHOW_OUTPUT = True # should figures be plotted
SHOW_OUTPUT_KP = True # should figures with keypress data be plotted-
SHOW_OUTPUT_ST = True # should figures with stimulus data to be plotted
SHOW_OUTPUT_PP = True # should figures with info about participants
SHOW_OUTPUT_KP = False # should figures with keypress data be plotted-
SHOW_OUTPUT_ST = False # should figures with stimulus data to be plotted
SHOW_OUTPUT_PP = False # should figures with info about participants
SHOW_OUTPUT_ET = False # should figures for eye tracking

# for debugging, skip processing
Expand Down Expand Up @@ -239,6 +239,7 @@
# signal_2 = signal_ego = list of int, eg: [1,1,0,0]
# signal_3 = signal_kp = list of lists, eg: [[1,1,1,1], [1,1,1,1], [1,1,1,1], [1,1,1,1]]
# prepare signals to compare with ANOVA
# todo: signals for ANOVA
anova_signals = {'signal_1': df.loc['video_' + str(ids[0])]['kp'],
'signal_2': df.loc['video_' + str(ids[0])]['kp'],
'signal_3': df.loc['video_' + str(ids[0])]['kp']}
Expand Down

0 comments on commit d399621

Please sign in to comment.