superstats.simulation.cognitive.cdm#
Circular Diffusion Model simulator.
Functions
|
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_angle
np.ndarrayofshape(num_trials,) Direction of the drift vector (in radians) for each trial.
- v_length
np.ndarrayofshape(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).
- a
np.ndarrayofshape(num_trials,) Radius of the circular decision boundary for each trial.
- tau
np.ndarrayofshape(num_trials,) Non-decision times for each trial.
- sigma
float,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.
- dt
float,optional, default: 0.001 Time step size.
- max_steps
int,optional, default: 10000 Maximum number of diffusion steps per trial before timing out.
- v_angle
- Returns:
- data
dictofnp.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,).
- data
- Parameters:
- Return type: