InstantaneousSpeedValidator class

Validator for momentary (instantanesous) speed: make sure that at each given moment, the movement speed is within the valid boundaries

Methods and properties:

class trajtracker.validators.InstantaneousSpeedValidator(axis=<ValidationAxis.y: 2>, enabled=True, min_speed=None, max_speed=None, max_stop_duration=None, grace_period=0, calculation_interval=0, movement_monitor=None)
__init__(axis=<ValidationAxis.y: 2>, enabled=True, min_speed=None, max_speed=None, max_stop_duration=None, grace_period=0, calculation_interval=0, movement_monitor=None)

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

Parameters:
axis

The ValidationAxis on which speed is validated ValidationAxis.x or ValidationAxis.y: limit the speed in the relevant axis. ValidationAxis.xy: limit the diagonal speed

calculation_interval

Time interval (in seconds) for testing speed: the speed is calculated according to the difference in (x,y) coordinates over a time interval at least this long.

disable_event

The event on which the object should be disabled. This will work only when the object is registered to an EventManager

Note: This property is deprecated, use disable_events instead

Type:Event
disable_events

The events on which the object should be disabled. This will work only when the object is registered to an EventManager

Type:collection of Event objects
enable_event

The event on which the object should be enabled. This will work only when the object is registered to an EventManager

Note: This property is deprecated, use enable_events instead

Type:Event
enable_events

The events on which the object should be enabled. This will work only when the object is registered to an EventManager

Type:collection of Event objects
enabled

Whether the object is currently functioning or disabled

Type:bool
grace_period

The grace period in the beginning of each trial, during which speed is not validated (in seconds).

log_level

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

max_speed

The maximal valid instantaneous speed (coords/sec). Only positive values are valid. None = maximal speed will not be enforced.

max_stop_duration

The maximal allowed duration of a finger/mouse stop in mid-trial

Type:Number
min_speed

The minimal valid instantaneous speed (coords/sec). Only positive values are valid. None = minimal speed will not be enforced.

If the finger completely stopped moving, speed information is N/A and this validation will not be triggered. To disallow full stops, use max_stop_duration

reset(time0=None)

Called when a trial starts - reset any previous movement

Parameters:time0 – The time when the trial starts. The grace period will be determined according to this time.
update_xyt(position, time_in_trial, time_in_session=None)

Given a current position, check whether the movement complies with the speed limits.

Parameters:
  • position – Current (x,y) coordinates
  • time_in_trial – Time, in seconds. The zero point doesn’t matter, as long as you’re consistent until reset() is called.
  • time_in_session – ignored
Returns:

None if all OK, ExperimentError if error