LocationsValidator class

This validator gets an image, and validates that the mouse/finger would be placed only on pixels of certain color(s).

You can define either the valid colors or the invalid colors.

Methods and properties:

class trajtracker.validators.LocationsValidator(image, enabled=True, position=None, default_valid=False)
__init__(image, enabled=True, position=None, default_valid=False)

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

Parameters:
  • image – Name of a BMP file, or the actual image (rectangular matrix of colors)
  • enabled – See enabled
  • position – See position
  • default_valid – See default_valid
default_valid

Indicates whether by default, all points are valid or not. If True: use invalid_colors() to indicate exceptions If False: use valid_colors() to indicate exceptions

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
log_level

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

position

The position of the image: (x,y) tuple/list, indicating the image center For even-sized images, use the Expyriment standard. The position is used to align the image’s coordinate space with that of update_xyt()

update_xyt(position, time_in_trial=None, time_in_session=None)

Check whether the given coordinate is a valid one

Parameters:
  • time_in_trial – ignored
  • time_in_session – ignored
Returns:

None if all OK, ExperimentError if error