QuestPlus

QuestPlus

A QUEST+ staircase procedure.

QuestPlusWeibull

A QUEST+ staircase procedure.

class questplus.qp.QuestPlus(*, stim_domain, param_domain, outcome_domain, prior=None, func, stim_scale, stim_selection_method='min_entropy', stim_selection_options=None, param_estimation_method='mean')

Bases: object

A QUEST+ staircase procedure.

Parameters
  • stim_domain (dict) – Specification of the stimulus domain: dictionary keys correspond to the names of the stimulus dimensions, and values describe the respective possible stimulus values (e.g., intensities, contrasts, or orientations).

  • param_domain (dict) – Specification of the parameter domain: dictionary keys correspond to the names of the parameter dimensions, and values describe the respective possible parameter values (e.g., threshold, slope, lapse rate.

  • outcome_domain (dict) – Specification of the outcome domain: dictionary keys correspond to the names of the outcome dimensions, and values describe the respective possible outcome values (e.g., “Yes”, “No”, “Correct”, “Incorrect”). This argument typically describes the responses a participant can provide.

  • prior (Optional[dict]) – A-priori probabilities of parameter values.

  • func (str) – The psychometric function whose parameters to estimate. Currently supported are the Weibull function, weibull, and the spatio- temporal contrast sensitivity function, csf.

  • stim_scale (str) – The scale on which the stimuli are provided. Currently supported are the decadic logarithm, log10; and decibels, dB.

  • stim_selection_method (str) – How to select the next stimulus. min_entropy picks the stimulus that will minimize the expected entropy. min_n_entropy randomly selects a stimulus from the set of stimuli that will yield the n smallest entropies. n has to be specified via the stim_selection_options keyword argument.

  • stim_selection_options (Optional[dict]) – Use this argument to specify options for the stimulus selection method specified via stim_selection_method. Currently, this can be used to specify the number of n stimuli that will yield the n smallest entropies if stim_selection_method=min_n_entropy, and max_consecutive_reps, the number of times the same stimulus can be presented consecutively. A random number generator seed may be passed via random_seed=12345.

  • param_estimation_method (str) – The method to use when deriving the final parameter estimate. Possible values are mean (mean of each parameter, weighted by the posterior probabilities) and mode (the parameters at the peak of the posterior distribution).

static from_json(data)

Load and recreate a QuestPlus instance from a JSON string.

Parameters

data (str) – The JSON string, generated via to_json().

Returns

A QuestPlus instance, generated from the JSON string.

Return type

QuestPlus

See also

to_json()

property marginal_posterior

Retrieve the a dictionary of marginal posterior probability density functions (PDFs).

This returns a dictionary of marginal PDFs, where the dictionary keys correspond to the parameter names.

Return type

dict

property next_stim

Retrieve the stimulus to present next.

The stimulus will be selected based on the method in self.stim_selection.

Return type

dict

property param_estimate

Retrieve the final parameter estimates after the QUEST+ run.

The parameters will be calculated according to self.param_estimation_method.

This returns a dictionary of parameter estimates, where the dictionary keys correspond to the parameter names.

Return type

dict

to_json()

Dump this QuestPlus instance as a JSON string which can be loaded again later.

Returns

A JSON dump of the current QuestPlus instance.

Return type

str

See also

from_json()

update(*, stim, outcome)

Inform QUEST+ about a newly gathered measurement outcome for a given stimulus parameter set, and update the posterior accordingly.

Parameters
  • stim (dict) – The stimulus that was used to generate the given outcome.

  • outcome (dict) – The observed outcome.

Return type

None

class questplus.qp.QuestPlusWeibull(*, intensities, thresholds, slopes, lower_asymptotes, lapse_rates, prior=None, responses=('Yes', 'No'), stim_scale='log10', stim_selection_method='min_entropy', stim_selection_options=None, param_estimation_method='mean')

Bases: questplus.qp.QuestPlus

A QUEST+ staircase procedure.

Parameters
  • stim_domain – Specification of the stimulus domain: dictionary keys correspond to the names of the stimulus dimensions, and values describe the respective possible stimulus values (e.g., intensities, contrasts, or orientations).

  • param_domain – Specification of the parameter domain: dictionary keys correspond to the names of the parameter dimensions, and values describe the respective possible parameter values (e.g., threshold, slope, lapse rate.

  • outcome_domain – Specification of the outcome domain: dictionary keys correspond to the names of the outcome dimensions, and values describe the respective possible outcome values (e.g., “Yes”, “No”, “Correct”, “Incorrect”). This argument typically describes the responses a participant can provide.

  • prior (Optional[dict]) – A-priori probabilities of parameter values.

  • func – The psychometric function whose parameters to estimate. Currently supported are the Weibull function, weibull, and the spatio- temporal contrast sensitivity function, csf.

  • stim_scale (str) – The scale on which the stimuli are provided. Currently supported are the decadic logarithm, log10; and decibels, dB.

  • stim_selection_method (str) – How to select the next stimulus. min_entropy picks the stimulus that will minimize the expected entropy. min_n_entropy randomly selects a stimulus from the set of stimuli that will yield the n smallest entropies. n has to be specified via the stim_selection_options keyword argument.

  • stim_selection_options (Optional[dict]) – Use this argument to specify options for the stimulus selection method specified via stim_selection_method. Currently, this can be used to specify the number of n stimuli that will yield the n smallest entropies if stim_selection_method=min_n_entropy, and max_consecutive_reps, the number of times the same stimulus can be presented consecutively. A random number generator seed may be passed via random_seed=12345.

  • param_estimation_method (str) – The method to use when deriving the final parameter estimate. Possible values are mean (mean of each parameter, weighted by the posterior probabilities) and mode (the parameters at the peak of the posterior distribution).

property intensities

Stimulus intensity or contrast domain.

Return type

ndarray

property lapse_rates

The lapse rate parameter domain.

Return type

ndarray

property lower_asymptotes

The lower asymptote parameter domain.

Return type

ndarray

property next_intensity

The intensity or contrast to present next.

Return type

float

property responses

The response (outcome) domain.

Return type

ndarray

property slopes

The slope parameter domain.

Return type

ndarray

property thresholds

The threshold parameter domain.

Return type

ndarray

update(*, intensity, response)

Inform QUEST+ about a newly gathered measurement outcome for a given stimulus intensity or contrast, and update the posterior accordingly.

Parameters
  • intensity (float) – The intensity or contrast of the presented stimulus.

  • response (str) – The observed response.

Return type

None