Skip to content

Commit a1fd08d

Browse files
authored
Add noise stimuli in StimulusFactory (#8)
* fix error msg * refactor factory + add threshold based ramp * add noise protocols (OU, shot, step) * add unit-tests for noise protocols * update 5-stimuli example * Standardised parameter names to use sigma instead of variance
1 parent 143f846 commit a1fd08d

File tree

7 files changed

+1486
-518
lines changed

7 files changed

+1486
-518
lines changed

bluecellulab/analysis/inject_sequence.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Recording(NamedTuple):
3030
current: np.ndarray
3131
voltage: np.ndarray
3232
time: np.ndarray
33-
spike: np.ndarray | None
33+
spike: Optional[np.ndarray] = None
3434

3535

3636
StimulusRecordings = Dict[str, Recording]
@@ -46,7 +46,7 @@ def run_stimulus(
4646
recording_section: str = "soma[0]",
4747
recording_segment: float = 0.5,
4848
enable_spike_detection: bool = False,
49-
threshold_spike_detection: float = -30,
49+
threshold_spike_detection: float = -30.0,
5050
) -> Recording:
5151
"""Creates a cell from template parameters, applies a stimulus, and records
5252
the response.
@@ -135,9 +135,9 @@ def apply_multiple_stimuli(
135135
stimulus_name: StimulusName,
136136
amplitudes: Sequence[float],
137137
threshold_based: bool = True,
138-
section_name: str | None = None,
138+
section_name: Optional[str] = None,
139139
segment: float = 0.5,
140-
n_processes: int | None = None,
140+
n_processes: Optional[int] = None,
141141
cvode: bool = True,
142142
add_hypamp: bool = True,
143143
) -> StimulusRecordings:

bluecellulab/cell/injector.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def _get_ornstein_uhlenbeck_rand(self, stim_count, seed):
280280
rng = neuron.h.Random()
281281
rng.Random123(seed1, seed2, seed3)
282282
else:
283-
raise BluecellulabError("Shot noise stimulus requires Random123")
283+
raise BluecellulabError("Ornstein-Uhlenbeck noise stimulus requires Random123")
284284

285285
self.persistent.append(rng)
286286
return rng

0 commit comments

Comments
 (0)