Simulation
add_clamps(externals, external_inds, data_clamps=None)
¶
Adds clamps to the external inputs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
externals
|
Dict
|
Current external inputs. |
required |
external_inds
|
Dict
|
Current external indices. |
required |
data_clamps
|
Optional[Tuple[str, ndarray, DataFrame]]
|
Additional data clamps. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Tuple[Dict, Dict]
|
Tuple[Dict, Dict]: Updated external inputs and indices. |
Source code in jaxley/integrate.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
add_stimuli(externals, external_inds, data_stimuli=None)
¶
Extends the external inputs with the stimuli.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
externals
|
Dict
|
Current external inputs. |
required |
external_inds
|
Dict
|
Current external indices. |
required |
data_stimuli
|
Optional[Tuple[ndarray, DataFrame]]
|
Additional data stimuli. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
Tuple[Dict, Dict]
|
Tuple[Dict, Dict]: Updated external inputs and indices. |
Source code in jaxley/integrate.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
build_init_and_step_fn(module, voltage_solver='jaxley.stone', solver='bwd_euler')
¶
This function returns the init_fn
and step_fn
which initialize the
parameters and states of the neuron model and then step through the model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module
|
Module
|
A |
required |
voltage_solver
|
str
|
Voltage solver used in step. Defaults to “jaxley.stone”. |
'jaxley.stone'
|
solver
|
str
|
ODE solver. Defaults to “bwd_euler”. |
'bwd_euler'
|
Returns:
Type | Description |
---|---|
Tuple[Callable, Callable]
|
init_fn, step_fn: Functions that initialize the state and parameters, and perform a single integration step, respectively. |
Source code in jaxley/integrate.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
|
integrate(module, params=[], *, param_state=None, data_stimuli=None, data_clamps=None, t_max=None, delta_t=0.025, solver='bwd_euler', voltage_solver='jaxley.stone', checkpoint_lengths=None, all_states=None, return_states=False)
¶
Solves ODE and simulates neuron model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params
|
List[Dict[str, ndarray]]
|
Trainable parameters returned by |
[]
|
param_state
|
Optional[List[Dict]]
|
Parameters returned by |
None
|
data_stimuli
|
Optional[Tuple[ndarray, DataFrame]]
|
Outputs of |
None
|
data_clamps
|
Optional[Tuple[str, ndarray, DataFrame]]
|
Outputs of |
None
|
t_max
|
Optional[float]
|
Duration of the simulation in milliseconds. If |
None
|
delta_t
|
float
|
Time step of the solver in milliseconds. |
0.025
|
solver
|
str
|
Which ODE solver to use. Either of [“fwd_euler”, “bwd_euler”, “crank_nicolson”]. |
'bwd_euler'
|
tridiag_solver
|
Algorithm to solve tridiagonal systems. The different options
only affect |
required | |
checkpoint_lengths
|
Optional[List[int]]
|
Number of timesteps at every level of checkpointing. The
|
None
|
all_states
|
Optional[Dict]
|
An optional initial state that was returned by a previous
|
None
|
return_states
|
bool
|
If True, it returns all states such that the current state of
the |
False
|
Source code in jaxley/integrate.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
exponential_euler(x, dt, x_inf, x_tau)
¶
An exact solver for the linear dynamical system dx = -(x - x_inf) / x_tau
.
Source code in jaxley/solver_gate.py
36 37 38 39 40 41 42 43 44 |
|
save_exp(x, max_value=20.0)
¶
Clip the input to a maximum value and return its exponential.
Source code in jaxley/solver_gate.py
7 8 9 10 |
|
solve_inf_gate_exponential(x, dt, s_inf, tau_s)
¶
solves dx/dt = (s_inf - x) / tau_s via exponential Euler
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
ndarray
|
gate variable |
required |
dt
|
float
|
time_delta |
required |
s_inf
|
ndarray
|
description |
required |
tau_s
|
ndarray
|
description |
required |
Returns:
Name | Type | Description |
---|---|---|
_type_ |
updated gate |
Source code in jaxley/solver_gate.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
step_voltage_explicit(voltages, voltage_terms, constant_terms, axial_conductances, internal_node_inds, sinks, sources, types, ncomp_per_branch, par_inds, child_inds, nbranches, solver, delta_t, idx, debug_states)
¶
Solve one timestep of branched nerve equations with explicit (forward) Euler.
Source code in jaxley/solver_voltage.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
step_voltage_implicit_with_jaxley_spsolve(voltages, voltage_terms, constant_terms, axial_conductances, internal_node_inds, sinks, sources, types, ncomp_per_branch, par_inds, child_inds, nbranches, solver, delta_t, idx, debug_states)
¶
Solve one timestep of branched nerve equations with implicit (backward) Euler.
Source code in jaxley/solver_voltage.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|