Skip to content

Add method to calculate angular velocity and save it to the csv #13

@lauraporta

Description

@lauraporta

Is your feature request related to a problem? Please describe.
It would be useful to know the angular velocity of the mouse head at every frame

Describe the solution you'd like
I made this draft method:

def get_angular_velocity(angles, sampling_rate):
    #  angles are in degrees
    # angles = np.deg2rad(angles)
    diffs = np.diff(angles)
    #  remove outliers
    diffs = np.where(np.abs(diffs) > 0.05, 0, diffs)
    angular_velocity = diffs / sampling_rate

    return angular_velocity, diffs


angles_array = derotate.interpolated_angles
sampling_rate = 1 / 179200  # 1 / Hz

angular_velocity, diffs = get_angular_velocity(angles_array, sampling_rate)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions