expyfun.stimuli.TrackerDealer#

class expyfun.stimuli.TrackerDealer(callback, trackers, max_lag=1, pace_rule='reversals', rand=None)[source]#

Class for selecting and pacing independent simultaneous trackers

Parameters:
callbackcallable | ExperimentController | None

The function that will be used to print the data, usually to the experiment .tab file. It should follow the prototype of ExperimentController.write_data_line. If an instance of ExperimentController is given, then it will take that object’s write_data_line function. If None is given, then it will not write the data anywhere.

trackersarray-like

The trackers to use. Must be instances of expyfun.stimuli.TrackerUD or expyfun.stimuli.TrackerBinom.

max_lagint

The number of reversals or trials by which the leading tracker may lead the lagging one. The pace_rule dictates whether reversals or trials are used.

pace_rulestr

Must be reversals or trials.

randnumpy.random.RandomState | None

The random process used to deal the trackers. If None, the process is seeded based on the current time.

Attributes:
shape
stopped

Are all the trackers stopped

trackers

All of the tracker objects in the container

Methods

history([include_skips])

The history of the dealt trials and the responses

next()

Selects the tracker from which the next trial should be run

respond(correct)

Update the current tracker based on the last response

Returns:
dealerinstance of TrackerDealer

The tracker dealer object.

Notes

The trackers can be accessed like a numpy array through the trackers property, e.g. dealer.trackers[0, 1, :].

If dealing from TrackerBinom objects (which is probably not a good idea), stop_early must be False or else they cannot be ensured to keep pace.

history(include_skips=False)[source]#

The history of the dealt trials and the responses

Parameters:
include_skipsbool

Whether or not to include trials where a tracker was dealt but no response was made.

Returns:
tracker_historylist of int

The index of which tracker was dealt on each trial. Note that the ints in this list correspond the the raveled index.

x_historylist of float

The level of the dealt tracker on each trial.

response_historylist of bool

The response history (i.e., correct or incorrect)

next()[source]#

Selects the tracker from which the next trial should be run

Returns:
subscriptslist-like

The position of the selected tracker.

x_currentfloat

The level of the selected tracker.

respond(correct)[source]#

Update the current tracker based on the last response

Parameters:
correctboolean

Was the most recent subject response correct?

property stopped#

Are all the trackers stopped

property trackers#

All of the tracker objects in the container

Examples using expyfun.stimuli.TrackerDealer#

Adaptive tracking from above and below

Adaptive tracking from above and below

Adaptive tracking for two trial types and tracker reconstruction from .tab

Adaptive tracking for two trial types and tracker reconstruction from .tab