psychophysics.Detect - dstolz/epsych_v1.1 GitHub Wiki

Detect Class

Analyzes psychophysical detection task data, decodes trial outcomes, and computes performance metrics such as d-prime and bias.

Overview

The Detect class processes trial data from psychophysical experiments, extracting, decoding, and summarizing key outcomes and performance statistics. It uses information from the trial structure and parameter definitions to provide detailed performance analysis for a specified trial type.

Example Usage

% Suppose you have RUNTIME.TRIALS and a parameter object "param"
D = psychophysics.Detect(RUNTIME.TRIALS, param, epsych.BitMask.TrialType_0);

% Get the total number of stimulus trials
numTrials = D.trialCount;

% Get hit and false alarm rates for each stimulus value
rates = D.Rate;

% Get d-prime and bias values
dprimes = D.DPrime;
biases = D.Bias;

% Get summary count of hits/misses/etc. for each value
counts = D.Count;


% Recompute for TrialType_1 (typically catch trials; see epsych.BitMask)
D.targetTrialType = epsych.BitMask.TrialType_1;
catchTrials = D.Rate;

Properties

Main Properties

  • TRIALS: Structure containing trial data (e.g., RUNTIME.TRIALS).
  • Parameter: The parameter object that defines trial parameters (e.g., a stimulus property).
  • infCorrection: Correction bounds for infinite z-scores, as [lower upper]. Default: [0.05 0.95].
  • targetTrialType: The trial type to analyze (as a BitMask).
  • ttStimulus: BitMask for stimulus trials.
  • ttCatch: BitMask for catch trials.
  • Bits: Array of BitMask values for responses.
  • BitColors: Colors for each outcome type.
  • Helper: Helper object (for event management and utilities).

Dependent Properties (read-only, calculated automatically)

  • DATA: Extracted trial data from TRIALS.
  • trialCount: Number of trials matching targetTrialType.
  • trialType: Array of trial types in DATA.
  • trialValues: Parameter values for targetTrialType trials.
  • uniqueValues: Unique parameter values among trialValues.
  • countUniqueValues: Count of each unique parameter value.
  • Count: Struct with counts of trial outcomes (e.g., Hit, Miss).
  • Rate: Struct with rates of trial outcomes (proportion).
  • DPrime: d-prime values for each unique parameter value.
  • Bias: Bias values for each unique parameter value.

Read-only/Protected

  • decodedTrials: Decoded trial outcomes (as a decodeTrials object).

Key Methods

  • Constructor:
    obj = Detect(TRIALS, Parameter, targetTrialType)
    Initializes the Detect object with the given trial data, parameter object, and target trial type.

  • update_data:
    Updates trial data and decoded outcomes on new data events.

  • d_prime (static):
    Computes d-prime given hit and false alarm rates.

  • bias (static):
    Computes bias given hit and false alarm rates.

  • norminv (static):
    Bounded inverse normal transform to avoid infinite values.