-
Notifications
You must be signed in to change notification settings - Fork 0
Add kinematics functions for eye/cursor #301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
aopy/postproc.py
Outdated
| 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) |
There was a problem hiding this comment.
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=''): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| def assign_zone(pos, target, target_radius): | |
| def assign_zone(pos, target, target_radius): |
| 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): |
There was a problem hiding this comment.
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.
Functions added to postproc, visualizations, analysis, utils
Tests haven't yet been made