class documentation

class UpDownDetector: (source)

View In Hierarchy

UpDownDetector

A class for handling an x-up y-down experiment setup Detects and counts reversals and whether the stimulus parameter should be increased or decreased

Method __init__ No summary
Method __len__ Undocumented
Method get_from_log Returns the log for the given parameter.
Method get_mean_parameter_value No summary
Method next Takes the answer, can be anything, but should be either equal to `correct` or `wrong`, provided in `__init__` (default is int(1) for correct and int(0) for wrong).
Method reset Reset the internal counters, as if a new experiment is started
Instance Variable consecutive_correct Undocumented
Instance Variable consecutive_wrong Undocumented
Instance Variable correct Undocumented
Instance Variable entry Undocumented
Instance Variable experiment_log Undocumented
Instance Variable last_parameter_change Undocumented
Instance Variable number_of_reversals Undocumented
Instance Variable response_sequence_dict Undocumented
Instance Variable wrong Undocumented
Method _update_experiment_log Undocumented
def __init__(self, entry=2, correct=1, wrong=0): (source)
Parameters
entry:intrefers to the "Entry" column in Table 1 of Levitt 1971 (default: 2)
correctresponse that represents a correct answer
wrongresponse that represents an incorrect answer
def __len__(self): (source)

Undocumented

def get_from_log(self, parameter): (source)

Returns the log for the given parameter.

If log is empty, None is returned

Parameters
parameterparameter to return from log
Raises
ValueErrorif parameter is not in log keys
def get_mean_parameter_value(self, n_reversals=1): (source)
Parameters
n_reversalsnumber of reversals to include
Returns
the mean parameter value from the last n_reversals
def next(self, answer, parameter_value=None): (source)

Takes the answer, can be anything, but should be either equal to `correct` or `wrong`, provided in `__init__` (default is int(1) for correct and int(0) for wrong).

Parameters
answerAny type, but must be compatible with `answer == self.correct` and `answer == self.correct`
parameter_valueAny type that can be summed and calculated the mean of.
Returns
0 : whether the stimulus parameter should be updated up or down (1 or -1), or kept as is (0) 1 : whether a reversal occurred (True or False)
def reset(self): (source)

Reset the internal counters, as if a new experiment is started

Note that this also clears the internal experiment log

consecutive_correct: int = (source)

Undocumented

consecutive_wrong: int = (source)

Undocumented

Undocumented

Undocumented

experiment_log = (source)

Undocumented

last_parameter_change = (source)

Undocumented

number_of_reversals: int = (source)

Undocumented

response_sequence_dict: dict = (source)

Undocumented

Undocumented

def _update_experiment_log(self, answer, parameter_change, reversal_detected, parameter_value): (source)

Undocumented