Protocols¶
Stimulus builders for current- and voltage-clamp simulations. The dispatchers
(build_current_protocol, build_voltage_protocol) select a generator by name;
the generators can also be called directly for single-sweep stimuli.
Dispatchers¶
neuroclamp.build_current_protocol ¶
build_current_protocol(protocol_type, sampling_frequency, pre_stimulus_duration=10.0, stimulus_duration=30.0, post_stimulus_duration=10.0, min_stimulus=10.0, max_stimulus=10.0, stimulus_step=0.0, start_current=0.0, end_current=15.0, pulse_amplitude=10.0, pulse_width=2.0, pulse_interval=10.0, dc_offset=8.0, amplitude=4.0, frequency=50.0, start_frequency=1.0, end_frequency=100.0, mean_current=8.0, std_current=2.0)
Build current clamp protocol arrays from explicit parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol_type
|
str
|
One of "Step", "Ramp", "Pulse Train", "Sinusoidal", "Chirp", or "Noise". |
required |
sampling_frequency
|
float
|
Sampling frequency in Hz. |
required |
pre_stimulus_duration
|
float
|
Duration before the stimulus in ms. |
10.0
|
stimulus_duration
|
float
|
Duration of the stimulus in ms. |
30.0
|
post_stimulus_duration
|
float
|
Duration after the stimulus in ms. |
10.0
|
min_stimulus
|
float
|
Step current amplitude in µA/cm² for a single-step, or minimum current when running a multi-sweep range. |
10.0
|
max_stimulus
|
float
|
Maximum current for multi-sweep range in µA/cm². Must be >= min_stimulus. |
10.0
|
stimulus_step
|
float
|
Step size for multi-sweep range in µA/cm². Use 0.0 (or set min_stimulus == max_stimulus) for a single-step protocol. |
0.0
|
start_current
|
float
|
Ramp start current in µA/cm². |
0.0
|
end_current
|
float
|
Ramp end current in µA/cm². |
15.0
|
pulse_amplitude
|
float
|
Pulse amplitude in µA/cm². |
10.0
|
pulse_width
|
float
|
Pulse width in ms. |
2.0
|
pulse_interval
|
float
|
Interval between pulse starts in ms. |
10.0
|
dc_offset
|
float
|
DC offset for sinusoidal/chirp in µA/cm². |
8.0
|
amplitude
|
float
|
AC amplitude for sinusoidal/chirp in µA/cm². |
4.0
|
frequency
|
float
|
Sinusoidal frequency in Hz. |
50.0
|
start_frequency
|
float
|
Chirp start frequency in Hz. |
1.0
|
end_frequency
|
float
|
Chirp end frequency in Hz. |
100.0
|
mean_current
|
float
|
Noise mean current in µA/cm². |
8.0
|
std_current
|
float
|
Noise standard deviation in µA/cm². |
2.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
2-D array of shape |
ndarray
|
return shape |
ndarray
|
row per current level. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If protocol_type is unrecognized or parameters are invalid. |
Source code in neuroclamp/protocols/builders.py
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 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 | |
neuroclamp.build_voltage_protocol ¶
build_voltage_protocol(protocol_type, sampling_frequency, pre_stimulus_duration=10.0, stimulus_duration=30.0, post_stimulus_duration=10.0, holding_voltage=-70.0, start_voltage=-70.0, end_voltage=40.0, pulse_amplitude=20.0, pulse_width=2.0, pulse_interval=10.0, test_pulse_voltage=0.0, min_stimulus=0.0, max_stimulus=0.0, stimulus_step=0.0)
Build voltage clamp protocol arrays from explicit parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol_type
|
str
|
One of "Step", "Ramp", "Pulse Train", or "Inactivation". |
required |
sampling_frequency
|
float
|
Sampling frequency in Hz. |
required |
pre_stimulus_duration
|
float
|
Duration before the stimulus in ms. For the "Inactivation" protocol this is the conditioning prepulse duration. |
10.0
|
stimulus_duration
|
float
|
Duration of the stimulus in ms. For the "Inactivation" protocol this is the fixed test-pulse duration. |
30.0
|
post_stimulus_duration
|
float
|
Duration after the stimulus in ms. |
10.0
|
holding_voltage
|
float
|
Holding voltage in mV. Ignored by the "Inactivation" protocol, which uses each sweep's conditioning prepulse as the holding level. |
-70.0
|
start_voltage
|
float
|
Ramp start voltage in mV. |
-70.0
|
end_voltage
|
float
|
Ramp end voltage in mV. |
40.0
|
pulse_amplitude
|
float
|
Pulse amplitude in mV. |
20.0
|
pulse_width
|
float
|
Pulse width in ms. |
2.0
|
pulse_interval
|
float
|
Interval between pulse starts in ms. |
10.0
|
test_pulse_voltage
|
float
|
Fixed test-pulse voltage in mV for the
"Inactivation" two-pulse protocol. The swept |
0.0
|
min_stimulus
|
float
|
Step voltage amplitude in mV for a single-step, or minimum voltage when running a multi-sweep range. For the "Inactivation" protocol this is the most-hyperpolarized prepulse. |
0.0
|
max_stimulus
|
float
|
Maximum voltage for multi-sweep range in mV. Must be >= min_stimulus. For the "Inactivation" protocol this is the most-depolarized prepulse. |
0.0
|
stimulus_step
|
float
|
Step size for multi-sweep range in mV. Use 0.0 (or set min_stimulus == max_stimulus) for a single-step protocol. Must be > 0.0 for the "Inactivation" protocol, which is inherently multi-sweep. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
2-D array of shape |
ndarray
|
return shape |
ndarray
|
row per voltage level; the "Inactivation" protocol returns one row per |
ndarray
|
conditioning prepulse voltage. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If protocol_type is unrecognized or parameters are invalid. |
Source code in neuroclamp/protocols/builders.py
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 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 | |
Current-clamp generators¶
neuroclamp.step_current ¶
step_current(duration, current_amplitude, step_start=0.0, step_duration=None, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a step current protocol.
Creates a current protocol with a rectangular step of specified amplitude and duration, useful for studying action potential threshold and firing patterns.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
current_amplitude
|
float
|
Amplitude of the current step in uA/cm^2. |
required |
step_start
|
float
|
Time when the step begins in milliseconds. Default is 0.0. |
0.0
|
step_duration
|
float | None
|
Duration of the current step in milliseconds. If None, the step lasts for the entire duration. |
None
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.py
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 | |
neuroclamp.ramp_current ¶
ramp_current(duration, start_current, end_current, ramp_start=0.0, ramp_duration=None, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a ramp current protocol.
Creates a current protocol with a linear ramp from start to end current, useful for studying firing frequency adaptation and rheobase determination.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
start_current
|
float
|
Starting current amplitude in uA/cm^2. |
required |
end_current
|
float
|
Ending current amplitude in uA/cm^2. |
required |
ramp_start
|
float
|
Time when the ramp begins in milliseconds. Default is 0.0. |
0.0
|
ramp_duration
|
float | None
|
Duration of the ramp in milliseconds. If None, the ramp lasts for the entire duration. |
None
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.py
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 | |
neuroclamp.pulse_train ¶
pulse_train(duration, pulse_amplitude, pulse_width, pulse_interval, train_start=0.0, num_pulses=None, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a pulse train current protocol.
Creates a series of rectangular current pulses with specified amplitude, width, and interval, useful for studying synaptic integration and temporal summation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
pulse_amplitude
|
float
|
Amplitude of each pulse in uA/cm^2. |
required |
pulse_width
|
float
|
Width of each pulse in milliseconds. |
required |
pulse_interval
|
float
|
Time between pulse onsets in milliseconds. |
required |
train_start
|
float
|
Time when the pulse train begins in milliseconds. Default is 0.0. |
0.0
|
num_pulses
|
int | None
|
Number of pulses in the train. If None, pulses continue until the end of the duration. |
None
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.py
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 | |
neuroclamp.sinusoidal_current ¶
sinusoidal_current(duration, dc_offset, amplitude, frequency, phase=0.0, stimulus_start=0.0, stimulus_duration=0.0, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a sinusoidal current protocol.
Creates a sinusoidal current waveform with specified DC offset, amplitude, and frequency, useful for studying frequency response and impedance.
The waveform starts at stimulus_start and lasts for stimulus_duration.
The pre- and post-stimulus periods are filled with 0 current. When both
stimulus_start and stimulus_duration are 0.0, the waveform fills the
entire duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
dc_offset
|
float
|
DC offset current in uA/cm^2. |
required |
amplitude
|
float
|
Amplitude of the sinusoidal component in uA/cm^2. |
required |
frequency
|
float
|
Frequency of the sinusoid in Hz. |
required |
phase
|
float
|
Phase offset in radians. Default is 0.0. |
0.0
|
stimulus_start
|
float
|
Time when the waveform begins in milliseconds. Default is 0.0. |
0.0
|
stimulus_duration
|
float
|
Duration of the sinusoidal stimulus in milliseconds. Default is 0.0, which fills the recording from stimulus_start to the end of duration. |
0.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
neuroclamp.chirp_current ¶
chirp_current(duration, dc_offset, amplitude, start_frequency, end_frequency, stimulus_start=0.0, stimulus_duration=0.0, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a chirp (frequency sweep) current protocol.
Creates a sinusoidal current with linearly increasing frequency, useful for measuring frequency response characteristics.
The waveform starts at stimulus_start and lasts for stimulus_duration.
The pre- and post-stimulus periods are filled with 0 current. The frequency
sweep spans start_frequency to end_frequency over stimulus_duration.
When both stimulus_start and stimulus_duration are 0.0, the waveform
fills the entire duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
dc_offset
|
float
|
DC offset current in uA/cm^2. |
required |
amplitude
|
float
|
Amplitude of the chirp in uA/cm^2. |
required |
start_frequency
|
float
|
Starting frequency in Hz. |
required |
end_frequency
|
float
|
Ending frequency in Hz. |
required |
stimulus_start
|
float
|
Time when the waveform begins in milliseconds. Default is 0.0. |
0.0
|
stimulus_duration
|
float
|
Duration of the chirp stimulus in milliseconds. Default is 0.0, which fills the recording from stimulus_start to the end of duration. |
0.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.py
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 | |
neuroclamp.noise_current ¶
noise_current(duration, mean_current, std_current, stimulus_start=0.0, stimulus_duration=0.0, sampling_frequency=SIM_SAMPLING_FREQ, seed=None)
Generate a Gaussian white noise current protocol.
Creates a current protocol with Gaussian-distributed random values, useful for studying stochastic resonance and noise effects.
The noise starts at stimulus_start and lasts for stimulus_duration.
The pre- and post-stimulus periods are filled with 0 current. When both
stimulus_start and stimulus_duration are 0.0, the noise fills the
entire duration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
mean_current
|
float
|
Mean current value in uA/cm^2. |
required |
std_current
|
float
|
Standard deviation of current in uA/cm^2. |
required |
stimulus_start
|
float
|
Time when the noise begins in milliseconds. Default is 0.0. |
0.0
|
stimulus_duration
|
float
|
Duration of the noise stimulus in milliseconds. Default is 0.0, which fills the recording from stimulus_start to the end of duration. |
0.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
seed
|
int | None
|
Random seed for reproducibility. If None, uses random seed. |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of current values in uA/cm^2. |
Source code in neuroclamp/protocols/current.py
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 | |
Voltage-clamp generators¶
neuroclamp.step_voltage ¶
step_voltage(duration, voltage_amplitude, step_start=0.0, step_duration=None, holding_voltage=-70.0, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a step voltage protocol for voltage clamp experiments.
Creates a voltage protocol with a rectangular step of specified amplitude and duration, useful for studying ionic currents and gating kinetics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
voltage_amplitude
|
float
|
Amplitude of the voltage step in mV. |
required |
step_start
|
float
|
Time when the step begins in milliseconds. Default is 0.0. |
0.0
|
step_duration
|
float | None
|
Duration of the voltage step in milliseconds. If None, the step lasts for the entire duration. |
None
|
holding_voltage
|
float
|
Holding voltage in mV. Default is -70.0 mV. |
-70.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of voltage values in mV. |
Source code in neuroclamp/protocols/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 | |
neuroclamp.ramp_voltage ¶
ramp_voltage(duration, start_voltage, end_voltage, ramp_start=0.0, ramp_duration=None, holding_voltage=-70.0, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a ramp voltage protocol for voltage clamp experiments.
Creates a voltage protocol with a linear ramp from start to end voltage, useful for studying voltage-dependent activation and I-V relationships.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
start_voltage
|
float
|
Starting voltage in mV. |
required |
end_voltage
|
float
|
Ending voltage in mV. |
required |
ramp_start
|
float
|
Time when the ramp begins in milliseconds. Default is 0.0. |
0.0
|
ramp_duration
|
float | None
|
Duration of the ramp in milliseconds. If None, the ramp lasts for the entire duration. |
None
|
holding_voltage
|
float
|
Holding voltage in mV. Default is -70.0 mV. |
-70.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of voltage values in mV. |
Source code in neuroclamp/protocols/voltage.py
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 | |
neuroclamp.pulse_train_voltage ¶
pulse_train_voltage(duration, pulse_amplitude, pulse_width, pulse_interval, train_start=0.0, num_pulses=None, holding_voltage=-70.0, sampling_frequency=SIM_SAMPLING_FREQ)
Generate a pulse train voltage protocol for voltage clamp experiments.
Creates a series of rectangular voltage pulses with specified amplitude, width, and interval, useful for studying synaptic currents and channel inactivation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
duration
|
float
|
Total duration of the protocol in milliseconds. |
required |
pulse_amplitude
|
float
|
Amplitude of each pulse in mV. |
required |
pulse_width
|
float
|
Width of each pulse in milliseconds. |
required |
pulse_interval
|
float
|
Time between pulse onsets in milliseconds. |
required |
train_start
|
float
|
Time when the pulse train begins in milliseconds. Default is 0.0. |
0.0
|
num_pulses
|
int | None
|
Number of pulses in the train. If None, pulses continue until the end of the duration. |
None
|
holding_voltage
|
float
|
Holding voltage in mV. Default is -70.0 mV. |
-70.0
|
sampling_frequency
|
float
|
Sampling frequency in Hz; default SIM_SAMPLING_FREQ. |
SIM_SAMPLING_FREQ
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of voltage values in mV. |
Source code in neuroclamp/protocols/voltage.py
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 | |