How to define custom stimuli

Navigation

How to define custom stimuli#

In all of our tutorials, we created stimuli with jx.step_current(i_delay, i_dur, i_amp, dt, t_max). This creates a vector of input stimuli, where the n-th entry of the vector will be the stimulus at the n-th simultion time point. As such, you can simply create stimuli as numpy arrays.

⚠️ IMPORTANT!
If you change jx.integrate(..., delta_t=0.025), then you also have to customize your stimulus. The n-th entry of the stimulus will be the input to the cell at the n-th simulation step, regardless of dt

Example#

import jax.numpy as jnp

t_max = 100.0  # ms
dt = 0.025  # ms
time_values = jnp.arange(0, t_max, dt)
custom_stimulus = jnp.sin(time_value)

cell.branch(0).comp(0).stimulate(custom_stimulus)
cell.branch(0).comp(0).record()
v = jx.integrate(cell, delta_t=dt)