cubie.systemmodels.systems.decays
Exponential decay ODE system for testing.
This module provides a simple ODE system where each state variable decays exponentially at a rate proportional to its position.
Classes
|
Exponential decay system for testing purposes. |
- class cubie.systemmodels.systems.decays.Decays(precision=<class 'numpy.float64'>, **kwargs)[source]
Bases:
GenericODE
Exponential decay system for testing purposes.
A system where each state variable decays exponentially at a rate proportional to its position. Observables are the same as state variables * parameters (coefficients) + index.
- Parameters:
precision (numpy.dtype, optional) – Data type for calculations, by default np.float64.
**kwargs (dict) – Must contain ‘coefficients’ key with list of decay coefficients.
Notes
If coefficients = [c1, c2, c3], then the system will have three state variables x0, x1, x2, and:
dx[0] = -x[0]/1, dx[1] = x[1]/2, dx[2] = x[2]/3
obs[0] = dx[0]*c1 + 1 + step_count, obs[1] = dx[1]*c2 + 2 + step_count, obs[2] = dx[2]*c3 + 3 + step_count.
Really just exists for testing.
- __init__(precision=<class 'numpy.float64'>, **kwargs)[source]
Initialize the decay system.
- Parameters:
precision (numpy.dtype, optional) – Data type for calculations, by default np.float64.
**kwargs (dict) – Must contain ‘coefficients’ key with list of decay coefficients.
- build()[source]
Build the CUDA device function for the decay system.
- Returns:
Compiled CUDA device function implementing the decay dynamics.
- Return type:
function
- correct_answer_python(states, parameters, drivers)[source]
Python testing function.
Do it in python and compare results with CUDA implementation.
- Parameters:
states (numpy.ndarray) – Current state values.
parameters (numpy.ndarray) – Parameter values.
drivers (numpy.ndarray) – Driver values.
- Returns:
A tuple containing (dxdt, observables) arrays.
- Return type: