DelayDirectionReproduction#

class braintools.cogtask.DelayDirectionReproduction(t_fixation=Quantity(300., 'ms'), t_sample=Quantity(500., 'ms'), t_delay=Quantity(1000., 'ms'), t_response=Quantity(500., 'ms'), num_stimuli=8, noise_sigma=Quantity(0., 'ms^0.5'), base_value=0.0, feature_per_direction=1, IfVon=True, kappa=2.0, cue_dim=2, non_response_cue=None, response_cue=None, **kwargs)[source]#

Delay Direction Reproduction task.

The agent observes a sample direction, maintains it over a delay period, and then reproduces the remembered direction during the response phase. The target output is a continuous 2D direction vector encoded as [cos(theta), sin(theta)], together with a fixation/output-gating signal.

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

Parameters:
  • t_fixation (Duration) – Fixation duration before stimulus onset (default: 300ms).

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

  • t_delay (Duration) – Delay period duration during which the direction must be maintained in memory (default: 1000ms).

  • t_response (Duration) – Response duration during which the agent must reproduce the stored direction (default: 500ms).

  • num_stimuli (int) – Number of discrete sample directions uniformly distributed on the circle (default: 8).

  • noise_sigma (Data) – Input stimulus noise level (default: 0.0 * u.ms**0.5).

  • base_value (float) – Baseline value used by the stimulus encoder (default: 0.0).

  • feature_per_direction (int) – Number of repeated encoding features per direction. For von Mises encoding, the total stimulus dimension is num_stimuli * feature_per_direction. For cos/sin encoding, the total stimulus dimension is 2 * feature_per_direction (default: 1).

  • IfVon (bool) – Whether to use von Mises population encoding for the input stimulus. If False, use repeated cos/sin encoding instead (default: True).

  • kappa (float) – Concentration parameter for von Mises stimulus encoding (default: 2.0).

  • cue_dim (int) – Dimensionality of the fixation / task-state cue input (default: 2).

  • non_response_cue (array-like, optional) – Cue vector used during fixation, sample, and delay phases. If None, defaults to [1, 0, …, 0].

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

Notes

Input consists of: - a cue vector indicating task phase (non-response vs response), - a stimulus representation encoding the sample direction.

Output consists of: - fixation_out: a scalar indicating whether fixation / withholding

should be maintained,

  • direction: a 2D continuous report of the remembered sample direction in [cos(theta), sin(theta)] form.

This task is a continuous-report working memory task, unlike DMS-style tasks that require categorical decisions.

Examples

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

Define input and output features.

Override in subclass for class-based task definition.

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.