DirectionMonitor class

Monitor the mouse/finger direction.

This class also maintains some information about curves in the trajectory.

Methods and properties:

class trajtracker.movement.DirectionMonitor(min_distance=0, angle_units=<Units.Degrees: 1>, zero_angle=0, min_angle_change_per_curve=0)
__init__(min_distance=0, angle_units=<Units.Degrees: 1>, zero_angle=0, min_angle_change_per_curve=0)

Constructor - invoked when you create a new object by writing DirectionMonitor()

Parameters:
angle_units

Units for specifying angles (Units.Degrees or Units.Radians)

curr_angle

The angle where the finger/mouse is now going at

curr_curve_direction

The direction of the current curve (i.e., to which direction the mouse/finger currently turns) 1 = clockwise, -1 = counter clockwise

curr_curve_start_angle

The finger/mouse angle at the beginning of the current curve

curr_curve_start_xyt

The coordinates and time at the beginning of the current curve

log_level

Logging level of this object: trajtracker.log_none, log_error (default), log_warn, log_info, log_debug, log_trace

min_angle_change_per_curve

A curve must change the finger/mouse direction by at least this amount. Smaller changes do not count as curves.

min_distance

The minimal distance between points required for calculating direction

n_curves

The number of curves since the last call to reset()

reset()

Called when a trial starts - reset any previous movement

update_xyt(position, time_in_trial, time_in_session=None)

Call this method whenever the finger/mouse moves

Parameters:time_in_session – ignored
zero_angle

The angle that counts as zero (0=up). This means that: - the value returned from curr_angle will be rotated by this value - The counting of left/right curves will be relatively to this zero angle