Skip to content

Conversation

@jasfouri2
Copy link
Contributor

@jasfouri2 jasfouri2 commented Jul 1, 2022

Functions added to postproc, visualizations, analysis, utils
Tests haven't yet been made

@jasfouri2 jasfouri2 changed the title add plot_window_around_event Add kinematics functions for eye/cursor Jul 11, 2022
@jasfouri2 jasfouri2 requested a review from leoscholl July 11, 2022 17:17
aopy/postproc.py Outdated
Comment on lines 575 to 586
def get_average_eye_position(eye_pos):
'''
Get the average x,y position data between left and right eyes

Args:
eye_pos (nt, 4): array of eye position data for one trial, as output by exp_data

Returns:
(nt, 2): array of x,y position data averaged between both eyes
'''

return np.stack([(eye_pos[:,0]+eye_pos[:,2])/2, (eye_pos[:,1]+eye_pos[:,3])/2], axis=1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we incorporate the eye_labels into the input of this function so it knows exactly what indices to average?

aopy/postproc.py Outdated

return np.stack([(eye_pos[:,0]+eye_pos[:,2])/2, (eye_pos[:,1]+eye_pos[:,3])/2], axis=1)

def plot_hist_and_get_threshold(data, num_sd = 0, xlabel=''):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's slightly weird to have a function that computes something and also plots something. maybe you can make an optional argument to plot the histogram, but by default this function only computes the threshold?

aopy/postproc.py Outdated

return threshold

def downsample_timestamps(old_event_timestamps, new_samplerate, in_samples = True):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplified to

new_event_timestamps = np.round(old_event_timestamps * new_samplerate, 0) / new_samplerate

or something like that. i would change the name to get_nearest_timestamps or similar

aopy/postproc.py Outdated
else:
return new_event_timestamps / new_samplerate # in seconds

def assign_zone(pos, target, target_radius):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def assign_zone(pos, target, target_radius):
def assign_zone(pos, target, target_radius):
Suggested change
def assign_zone(pos, target, target_radius):
def assign_ja_zone(pos, target, target_radius):

aopy/analysis.py Outdated

return cursor_dists, cursor_vels, dist_slope, dist_avg, vel_slope, vel_avg

def compute_directional_error(pos, target, use_initial_direction = False):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s an existing function get_inst_target_dir which I think does the same thing as this. Maybe take a look before writing any tests for this one.

@leoscholl leoscholl mentioned this pull request Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants