superstats.simulation.cognitive.cdm#

Circular Diffusion Model simulator.

Functions

sample_cdm(v_angle, v_length, a, tau[, ...])

Sample from the Circular Diffusion Model (CDM).

superstats.simulation.cognitive.cdm.sample_cdm(v_angle, v_length, a, tau, sigma=1.0, dt=0.001, max_steps=10000)[source]#

Sample from the Circular Diffusion Model (CDM).

Simulates a 2D diffusion process starting from the origin, with a constant drift specified in polar form, evolving until it crosses a circular boundary of radius a. The crossing point determines the response angle and the number of steps determines the response time. On each trial the drift vector has length v_length and points in direction v_angle; the two Cartesian components diffuse independently with noise SD sigma until the squared radius reaches a ** 2.

Parameters:
v_anglenp.ndarray of shape (num_trials,)

Direction of the drift vector (in radians) for each trial.

v_lengthnp.ndarray of shape (num_trials,)

Magnitude of the drift vector for each trial. The Cartesian drift components are v_length * cos(v_angle) and v_length * sin(v_angle).

anp.ndarray of shape (num_trials,)

Radius of the circular decision boundary for each trial.

taunp.ndarray of shape (num_trials,)

Non-decision times for each trial.

sigmafloat, optional, default: 1.0

Diffusion noise standard deviation, shared by both Cartesian components. Fixed (not estimated per trial) for identifiability, since the boundary radius a and drift set the overall scale.

dtfloat, optional, default: 0.001

Time step size.

max_stepsint, optional, default: 10000

Maximum number of diffusion steps per trial before timing out.

Returns:
datadict of np.ndarray

Named decision data. “response_time” contains response times (or -5.0 on timeout) and “choice” contains response angles in radians (or -5.0 on timeout). Each array has shape (num_trials,).

Parameters:
Return type:

dict[str, ndarray]