DelayComparison#

class braintools.cogtask.DelayComparison(t_fixation=Quantity(500., 'ms'), t_sample=Quantity(500., 'ms'), t_delay=Quantity(1000., 'ms'), t_response=Quantity(500., 'ms'), value_range=(0.0, 1.0), num_features=10, value_encoding='scalar', sigma=0.1, centers=None, noise_sigma=Quantity(0.1, 'ms^0.5'), cue_dim=1, non_response_cue=None, response_cue=None, **kwargs)[source]#

Delayed Comparison task.

Agent compares the magnitudes of two stimuli separated by a delay, and must indicate whether the later comparison stimulus is greater or less than the sample stimulus.

Structure: Fixation >> Sample >> Delay >> Response

In the response phase, the comparison stimulus is presented together with the response cue, and the agent must decide whether test > sample or test < sample.

Parameters:
  • t_fixation (Quantity) – Fixation duration (default: 500ms).

  • t_sample (Quantity) – Sample presentation duration (default: 500ms).

  • t_delay (Quantity) – Delay duration (default: 1000ms).

  • t_response (Quantity) – Response duration, during which the comparison stimulus is shown and the agent makes its decision (default: 500ms).

  • value_range (tuple) – Range (min, max) from which sample and test values are drawn (default: (0.0, 1.0)).

  • num_features (int) – Number of stimulus features used when the encoding produces a population code, e.g. Gaussian encoding (default: 10).

  • value_encoding (str) – Encoding scheme for continuous stimulus values. Supported values: ‘scalar’, ‘gaussian’, ‘identity’ (default: ‘scalar’).

  • sigma (float) – Width parameter for Gaussian value encoding (default: 0.1).

  • centers (Any) – Optional Gaussian centers for value encoding (default: None).

  • noise_sigma (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – Stimulus noise level (default: 0.1 * u.ms**0.5).

  • cue_dim (int) – Dimensionality of the fixation/response cue vector (default: 1).

  • non_response_cue (array-like, optional) – Cue vector used during fixation, sample, and delay phases. Defaults to a zero vector of length cue_dim.

  • response_cue (array-like, optional) – Cue vector used during response phase. Defaults to [1, 0, …, 0].

  • seed (int, optional) – Random seed.

Examples

>>> task = DelayComparison()
>>> X, Y, info = task.sample_trial(0)
define_features()[source]#

Define input and output features.

Override in subclass for class-based task definition.

Return type:

Tuple

Returns:

  • input_features (Feature or FeatureSet) – Input feature definitions.

  • output_features (Feature or FeatureSet) – Output feature definitions.

define_phases()[source]#

Define the phase structure.

Override in subclass for class-based task definition.

Returns:

The task phase structure (single phase or composition).

Return type:

Phase

trial_init(ctx)[source]#

Initialize trial-level state.

Override in subclass to set up trial parameters like ground_truth, stimulus indices, etc.

Parameters:

ctx (Context) – Trial context to populate with state.

Return type:

None