bluecellulab 2.6.65__tar.gz → 2.6.66__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of bluecellulab might be problematic. Click here for more details.
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/PKG-INFO +1 -1
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/analysis/analysis.py +64 -39
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/simulation/neuron_globals.py +12 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/tools.py +11 -4
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/validation/validation.py +84 -35
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab.egg-info/PKG-INFO +1 -1
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.compile_mod.sh +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.gitattributes +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.github/dependabot.yml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.github/workflows/release.yml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.github/workflows/test.yml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.gitignore +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.gitlab-ci.yml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.readthedocs.yml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/.zenodo.json +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/AUTHORS.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/CHANGELOG.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/CITATION.cff +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/CONTRIBUTING.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/LICENSE +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/MANIFEST.in +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/Makefile +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/README.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/analysis/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/analysis/inject_sequence.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/analysis/plotting.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/analysis/utils.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/ballstick/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/ballstick/emodel.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/ballstick/morphology.asc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/cell_dict.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/core.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/injector.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/plotting.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/random.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/recording.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/section_distance.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/serialized_sections.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/sonata_proxy.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/stimuli_generator.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/cell/template.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/circuit_access/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/circuit_access/bluepy_circuit_access.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/circuit_access/definition.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/circuit_access/sonata_circuit_access.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/bluepy_simulation_config.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/definition.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/sections.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/sonata_simulation_config.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/format.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/iotools.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/node_id.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/simulation_access.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/synapse_properties.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/validate.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit_simulation.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/connection.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/dendrogram.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/exceptions.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/graph.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/hoc/Cell.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/hoc/RNGSettings.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/hoc/TDistFunc.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/hoc/TStim.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/hoc/fileUtils.hoc +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/importer.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/neuron_interpreter.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/plotwindow.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/psection.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/psegment.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/manager.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/utils.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/writers/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/writers/base_writer.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/writers/compartment.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/reports/writers/spikes.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/rngsettings.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/simulation/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/simulation/parallel.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/simulation/report.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/simulation/simulation.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/stimulus/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/stimulus/circuit_stimulus_definitions.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/stimulus/factory.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/stimulus/stimulus.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/synapse/__init__.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/synapse/synapse_factory.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/synapse/synapse_types.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/type_aliases.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/utils.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/verbosity.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab.egg-info/SOURCES.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab.egg-info/dependency_links.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab.egg-info/requires.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab.egg-info/top_level.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/Makefile +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/images/voltage-readme.png +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/make.bat +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/requirements_docs.txt +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/_static/.gitkeep +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/api.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/changelog.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/compiling-mechanisms.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/conf.py +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/contributing.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/index.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/list_of_stim.rst +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/docs/source/logo/BlueCelluLabBanner.jpg +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/pyproject.toml +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/setup.cfg +0 -0
- {bluecellulab-2.6.65 → bluecellulab-2.6.66}/tox.ini +0 -0
|
@@ -20,6 +20,7 @@ from bluecellulab.analysis.inject_sequence import run_stimulus
|
|
|
20
20
|
from bluecellulab.analysis.plotting import plot_iv_curve, plot_fi_curve
|
|
21
21
|
from bluecellulab.analysis.utils import exp_decay
|
|
22
22
|
from bluecellulab.simulation import Simulation
|
|
23
|
+
from bluecellulab.simulation.neuron_globals import set_neuron_globals
|
|
23
24
|
from bluecellulab.stimulus import StimulusFactory
|
|
24
25
|
from bluecellulab.stimulus.circuit_stimulus_definitions import Hyperpolarizing
|
|
25
26
|
from bluecellulab.tools import calculate_rheobase
|
|
@@ -43,7 +44,9 @@ def compute_plot_iv_curve(cell,
|
|
|
43
44
|
save_figure=False,
|
|
44
45
|
output_dir="./",
|
|
45
46
|
output_fname="iv_curve.pdf",
|
|
46
|
-
n_processes=None
|
|
47
|
+
n_processes=None,
|
|
48
|
+
celsius=None,
|
|
49
|
+
v_init=None):
|
|
47
50
|
"""Compute and plot the Current-Voltage (I-V) curve for a given cell by
|
|
48
51
|
injecting a range of currents.
|
|
49
52
|
|
|
@@ -78,6 +81,8 @@ def compute_plot_iv_curve(cell,
|
|
|
78
81
|
n_processes (int, optional): The number of processes to use for parallel execution.
|
|
79
82
|
If None or if it is higher than the number of steps,
|
|
80
83
|
it will use the number of steps as the number of processes.
|
|
84
|
+
celsius (float, optional): Temperature in Celsius.
|
|
85
|
+
v_init (float, optional): Initial membrane potential.
|
|
81
86
|
|
|
82
87
|
Returns:
|
|
83
88
|
tuple: A tuple containing:
|
|
@@ -103,7 +108,7 @@ def compute_plot_iv_curve(cell,
|
|
|
103
108
|
|
|
104
109
|
if n_processes is None or n_processes > len(steps):
|
|
105
110
|
n_processes = len(steps)
|
|
106
|
-
with Pool(n_processes) as p:
|
|
111
|
+
with Pool(n_processes, initializer=set_neuron_globals, initargs=(celsius, v_init)) as p:
|
|
107
112
|
recordings = p.starmap(
|
|
108
113
|
run_stimulus,
|
|
109
114
|
zip(
|
|
@@ -162,7 +167,9 @@ def compute_plot_fi_curve(cell,
|
|
|
162
167
|
save_figure=False,
|
|
163
168
|
output_dir="./",
|
|
164
169
|
output_fname="fi_curve.pdf",
|
|
165
|
-
n_processes=None
|
|
170
|
+
n_processes=None,
|
|
171
|
+
celsius=None,
|
|
172
|
+
v_init=None):
|
|
166
173
|
"""Compute and plot the Frequency-Current (F-I) curve for a given cell by
|
|
167
174
|
injecting a range of currents.
|
|
168
175
|
|
|
@@ -199,6 +206,8 @@ def compute_plot_fi_curve(cell,
|
|
|
199
206
|
n_processes (int, optional): The number of processes to use for parallel execution.
|
|
200
207
|
If None or if it is higher than the number of steps,
|
|
201
208
|
it will use the number of steps as the number of processes.
|
|
209
|
+
celsius (float, optional): Temperature in Celsius.
|
|
210
|
+
v_init (float, optional): Initial membrane potential.
|
|
202
211
|
|
|
203
212
|
Returns:
|
|
204
213
|
tuple: A tuple containing:
|
|
@@ -220,7 +229,7 @@ def compute_plot_fi_curve(cell,
|
|
|
220
229
|
|
|
221
230
|
if n_processes is None or n_processes > len(steps):
|
|
222
231
|
n_processes = len(steps)
|
|
223
|
-
with Pool(n_processes) as p:
|
|
232
|
+
with Pool(n_processes, initializer=set_neuron_globals, initargs=(celsius, v_init)) as p:
|
|
224
233
|
recordings = p.starmap(
|
|
225
234
|
run_stimulus,
|
|
226
235
|
zip(
|
|
@@ -365,43 +374,55 @@ class BPAP:
|
|
|
365
374
|
except RuntimeError:
|
|
366
375
|
return None, True
|
|
367
376
|
|
|
368
|
-
def validate(self, soma_amp, dend_amps, dend_dist, apic_amps, apic_dist):
|
|
377
|
+
def validate(self, soma_amp, dend_amps, dend_dist, apic_amps, apic_dist, validate_with_fit=True):
|
|
369
378
|
"""Check that the exponential fit is decaying."""
|
|
370
379
|
validated = True
|
|
371
380
|
notes = ""
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
381
|
+
if validate_with_fit:
|
|
382
|
+
popt_dend, dend_fit_error = self.fit(soma_amp, dend_amps, dend_dist)
|
|
383
|
+
popt_apic, apic_fit_error = self.fit(soma_amp, apic_amps, apic_dist)
|
|
384
|
+
if dend_fit_error or apic_fit_error:
|
|
385
|
+
logger.debug("Fitting error occurred.")
|
|
386
|
+
validated = False
|
|
387
|
+
notes += "Validation failed: Fitting error occurred.\n"
|
|
388
|
+
return validated, notes
|
|
389
|
+
if popt_dend is None:
|
|
390
|
+
logger.debug("No dendritic recordings found.")
|
|
391
|
+
notes += "No dendritic recordings found.\n"
|
|
392
|
+
elif popt_dend[1] <= 0 or popt_dend[0] <= 0:
|
|
393
|
+
logger.debug("Dendritic fit is not decaying.")
|
|
394
|
+
validated = False
|
|
395
|
+
notes += "Dendritic fit is not decaying.\n"
|
|
396
|
+
else:
|
|
397
|
+
notes += "Dendritic validation passed: dendritic amplitude is decaying with distance relative to soma.\n"
|
|
398
|
+
if popt_apic is None:
|
|
399
|
+
logger.debug("No apical recordings found.")
|
|
400
|
+
notes += "No apical recordings found.\n"
|
|
401
|
+
elif popt_apic[1] <= 0 or popt_apic[0] <= 0:
|
|
402
|
+
logger.debug("Apical fit is not decaying.")
|
|
403
|
+
validated = False
|
|
404
|
+
notes += "Apical fit is not decaying.\n"
|
|
405
|
+
else:
|
|
406
|
+
notes += "Apical validation passed: apical amplitude is decaying with distance relative to soma.\n"
|
|
394
407
|
else:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
408
|
+
if dend_amps and dend_dist:
|
|
409
|
+
furthest_dend_idx = np.argmax(dend_dist)
|
|
410
|
+
if dend_amps[furthest_dend_idx] < soma_amp[0]:
|
|
411
|
+
notes += "Dendritic validation passed: dendritic amplitude is decaying with distance relative to soma.\n"
|
|
412
|
+
else:
|
|
413
|
+
validated = False
|
|
414
|
+
notes += "Dendritic validation failed: dendritic amplitude is not decaying with distance relative to soma.\n"
|
|
415
|
+
else:
|
|
416
|
+
notes += "No dendritic recordings found.\n"
|
|
417
|
+
if apic_amps and apic_dist:
|
|
418
|
+
furthest_apic_idx = np.argmax(apic_dist)
|
|
419
|
+
if apic_amps[furthest_apic_idx] < soma_amp[0]:
|
|
420
|
+
notes += "Apical validation passed: apical amplitude is decaying with distance relative to soma.\n"
|
|
421
|
+
else:
|
|
422
|
+
validated = False
|
|
423
|
+
notes += "Apical validation failed: apical amplitude is not decaying with distance relative to soma.\n"
|
|
424
|
+
else:
|
|
425
|
+
notes += "No apical recordings found.\n"
|
|
405
426
|
|
|
406
427
|
return validated, notes
|
|
407
428
|
|
|
@@ -416,10 +437,14 @@ class BPAP:
|
|
|
416
437
|
save_figure=False,
|
|
417
438
|
output_dir="./",
|
|
418
439
|
output_fname="bpap.pdf",
|
|
440
|
+
do_fit=True,
|
|
419
441
|
):
|
|
420
442
|
"""Plot the results of the BPAP analysis."""
|
|
421
|
-
popt_dend
|
|
422
|
-
popt_apic
|
|
443
|
+
popt_dend = None
|
|
444
|
+
popt_apic = None
|
|
445
|
+
if do_fit:
|
|
446
|
+
popt_dend, _ = self.fit(soma_amp, dend_amps, dend_dist)
|
|
447
|
+
popt_apic, _ = self.fit(soma_amp, apic_amps, apic_dist)
|
|
423
448
|
|
|
424
449
|
outpath = pathlib.Path(output_dir) / output_fname
|
|
425
450
|
fig, ax1 = plt.subplots(figsize=(10, 6))
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
"""Module that handles the global NEURON parameters."""
|
|
15
15
|
|
|
16
|
+
from typing import Optional
|
|
16
17
|
from typing import NamedTuple
|
|
17
18
|
import neuron
|
|
18
19
|
from bluecellulab.circuit.config.sections import Conditions, MechanismConditions
|
|
@@ -109,3 +110,14 @@ class NeuronGlobals:
|
|
|
109
110
|
def load_params(self, params: NeuronGlobalParams) -> None:
|
|
110
111
|
self.temperature = params.temperature
|
|
111
112
|
self.v_init = params.v_init
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def set_neuron_globals(temperature: Optional[float] = 34.0, v_init: Optional[float] = -80.0) -> None:
|
|
116
|
+
"""Set the global NEURON parameters."""
|
|
117
|
+
if temperature is None and v_init is None:
|
|
118
|
+
return
|
|
119
|
+
neuron_globals = NeuronGlobals.get_instance()
|
|
120
|
+
if temperature is not None:
|
|
121
|
+
neuron_globals.temperature = temperature
|
|
122
|
+
if v_init is not None:
|
|
123
|
+
neuron_globals.v_init = v_init
|
|
@@ -26,7 +26,7 @@ import bluecellulab
|
|
|
26
26
|
from bluecellulab.cell import Cell
|
|
27
27
|
from bluecellulab.circuit.circuit_access import EmodelProperties
|
|
28
28
|
from bluecellulab.exceptions import UnsteadyCellError
|
|
29
|
-
from bluecellulab.simulation.neuron_globals import
|
|
29
|
+
from bluecellulab.simulation.neuron_globals import set_neuron_globals
|
|
30
30
|
from bluecellulab.simulation.parallel import IsolatedProcess
|
|
31
31
|
from bluecellulab.utils import CaptureOutput
|
|
32
32
|
from bluecellulab.type_aliases import NeuronSection
|
|
@@ -394,6 +394,15 @@ def check_empty_topology() -> bool:
|
|
|
394
394
|
return stdout == ['', '']
|
|
395
395
|
|
|
396
396
|
|
|
397
|
+
def section_exists(name: str) -> bool:
|
|
398
|
+
"""Check if a section exists in the NEURON simulator.
|
|
399
|
+
|
|
400
|
+
Args:
|
|
401
|
+
name (str): The name of the section to check.
|
|
402
|
+
"""
|
|
403
|
+
return bool(neuron.h.section_exists(name))
|
|
404
|
+
|
|
405
|
+
|
|
397
406
|
def calculate_max_thresh_current(cell: Cell,
|
|
398
407
|
threshold_voltage: float = -20.0,
|
|
399
408
|
section: str = "soma[0]",
|
|
@@ -608,9 +617,7 @@ def compute_memodel_properties(
|
|
|
608
617
|
celsius (float, optional): Temperature in Celsius. Default is 34.0 C.
|
|
609
618
|
"""
|
|
610
619
|
# set initial voltage and temperature
|
|
611
|
-
|
|
612
|
-
neuron_globals.temperature = celsius
|
|
613
|
-
neuron_globals.v_init = v_init
|
|
620
|
+
set_neuron_globals(temperature=celsius, v_init=v_init)
|
|
614
621
|
|
|
615
622
|
# get me-model properties
|
|
616
623
|
holding_current = cell.hypamp if cell.hypamp else 0.0
|
|
@@ -25,11 +25,13 @@ from bluecellulab.analysis.analysis import compute_plot_iv_curve
|
|
|
25
25
|
from bluecellulab.analysis.inject_sequence import run_multirecordings_stimulus
|
|
26
26
|
from bluecellulab.analysis.inject_sequence import run_stimulus
|
|
27
27
|
from bluecellulab.cell.core import Cell
|
|
28
|
-
from bluecellulab.simulation.neuron_globals import
|
|
28
|
+
from bluecellulab.simulation.neuron_globals import set_neuron_globals
|
|
29
29
|
from bluecellulab.stimulus.factory import IDRestTimings
|
|
30
30
|
from bluecellulab.stimulus.factory import StimulusFactory
|
|
31
31
|
from bluecellulab.tools import calculate_input_resistance
|
|
32
32
|
from bluecellulab.tools import calculate_rheobase
|
|
33
|
+
from bluecellulab.tools import section_exists
|
|
34
|
+
from bluecellulab.utils import NestedPool
|
|
33
35
|
|
|
34
36
|
logger = logging.getLogger(__name__)
|
|
35
37
|
|
|
@@ -83,10 +85,10 @@ def plot_traces(recordings, out_dir, fname, title, labels=None, xlim=None):
|
|
|
83
85
|
return outpath
|
|
84
86
|
|
|
85
87
|
|
|
86
|
-
def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-
|
|
88
|
+
def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-40.):
|
|
87
89
|
"""Spiking test: cell should spike."""
|
|
88
90
|
stim_factory = StimulusFactory(dt=1.0)
|
|
89
|
-
step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=
|
|
91
|
+
step_stimulus = stim_factory.idrest(threshold_current=rheobase, threshold_percentage=130)
|
|
90
92
|
recording = run_stimulus(
|
|
91
93
|
template_params,
|
|
92
94
|
step_stimulus,
|
|
@@ -103,7 +105,7 @@ def spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20
|
|
|
103
105
|
recording,
|
|
104
106
|
out_dir,
|
|
105
107
|
fname="spiking_test.pdf",
|
|
106
|
-
title="Spiking Test - Step at
|
|
108
|
+
title="Spiking Test - Step at 130% of Rheobase",
|
|
107
109
|
)
|
|
108
110
|
|
|
109
111
|
notes = "Validation passed: Spikes detected." if passed else "Validation failed: No spikes detected."
|
|
@@ -135,6 +137,7 @@ def depolarization_block_test(template_params, rheobase, out_dir):
|
|
|
135
137
|
"stim_start": [IDRestTimings.PRE_DELAY.value],
|
|
136
138
|
"stim_end": [IDRestTimings.PRE_DELAY.value + IDRestTimings.DURATION.value],
|
|
137
139
|
}
|
|
140
|
+
efel.set_setting("depol_block_min_duration", 150)
|
|
138
141
|
features_results = efel.get_feature_values([trace], ["depol_block_bool"])
|
|
139
142
|
depol_block = bool(features_results[0]["depol_block_bool"][0])
|
|
140
143
|
|
|
@@ -167,7 +170,14 @@ def bpap_test(template_params, rheobase, out_dir="./"):
|
|
|
167
170
|
bpap = BPAP(Cell.from_template_parameters(template_params))
|
|
168
171
|
bpap.run(duration=1500, amplitude=amplitude)
|
|
169
172
|
soma_amp, dend_amps, dend_dist, apic_amps, apic_dist = bpap.get_amplitudes_and_distances()
|
|
170
|
-
validated, notes = bpap.validate(
|
|
173
|
+
validated, notes = bpap.validate(
|
|
174
|
+
soma_amp,
|
|
175
|
+
dend_amps,
|
|
176
|
+
dend_dist,
|
|
177
|
+
apic_amps,
|
|
178
|
+
apic_dist,
|
|
179
|
+
validate_with_fit=False
|
|
180
|
+
)
|
|
171
181
|
outpath_amp_dist = bpap.plot_amp_vs_dist(
|
|
172
182
|
soma_amp,
|
|
173
183
|
dend_amps,
|
|
@@ -177,7 +187,8 @@ def bpap_test(template_params, rheobase, out_dir="./"):
|
|
|
177
187
|
show_figure=False,
|
|
178
188
|
save_figure=True,
|
|
179
189
|
output_dir=out_dir,
|
|
180
|
-
output_fname="bpap.pdf"
|
|
190
|
+
output_fname="bpap.pdf",
|
|
191
|
+
do_fit=False,
|
|
181
192
|
)
|
|
182
193
|
outpath_recordings = bpap.plot_recordings(
|
|
183
194
|
show_figure=False,
|
|
@@ -194,11 +205,11 @@ def bpap_test(template_params, rheobase, out_dir="./"):
|
|
|
194
205
|
}
|
|
195
206
|
|
|
196
207
|
|
|
197
|
-
def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-
|
|
208
|
+
def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage=-40.):
|
|
198
209
|
"""AIS spiking test: axon should spike before soma."""
|
|
199
210
|
name = "Simulatable Neuron AIS Spiking Validation"
|
|
200
211
|
# Check that the cell has an axon
|
|
201
|
-
if len(Cell.from_template_parameters(template_params).axonal) == 0:
|
|
212
|
+
if len(Cell.from_template_parameters(template_params).axonal) == 0 or not section_exists("axon[0]"):
|
|
202
213
|
return {
|
|
203
214
|
"name": name,
|
|
204
215
|
"passed": True,
|
|
@@ -216,8 +227,7 @@ def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage
|
|
|
216
227
|
0.5,
|
|
217
228
|
add_hypamp=True,
|
|
218
229
|
recording_locations=[("axon[0]", 0.5), ("soma[0]", 0.5)],
|
|
219
|
-
enable_spike_detection=
|
|
220
|
-
threshold_spike_detection=spike_threshold_voltage,
|
|
230
|
+
enable_spike_detection=False,
|
|
221
231
|
)
|
|
222
232
|
axon_recording, soma_recording = recordings
|
|
223
233
|
|
|
@@ -238,23 +248,37 @@ def ais_spiking_test(template_params, rheobase, out_dir, spike_threshold_voltage
|
|
|
238
248
|
xlim=(IDRestTimings.PRE_DELAY.value, IDRestTimings.PRE_DELAY.value + 100),
|
|
239
249
|
)
|
|
240
250
|
|
|
241
|
-
#
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
# Extract spike times using efel
|
|
252
|
+
traces = [
|
|
253
|
+
{
|
|
254
|
+
"T": axon_recording.time,
|
|
255
|
+
"V": axon_recording.voltage,
|
|
256
|
+
"stim_start": [IDRestTimings.PRE_DELAY.value],
|
|
257
|
+
"stim_end": [IDRestTimings.PRE_DELAY.value + IDRestTimings.DURATION.value],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"T": soma_recording.time,
|
|
261
|
+
"V": soma_recording.voltage,
|
|
262
|
+
"stim_start": [IDRestTimings.PRE_DELAY.value],
|
|
263
|
+
"stim_end": [IDRestTimings.PRE_DELAY.value + IDRestTimings.DURATION.value],
|
|
264
|
+
}
|
|
265
|
+
]
|
|
266
|
+
efel.set_setting("Threshold", spike_threshold_voltage)
|
|
267
|
+
features_results = efel.get_feature_values(traces, ["peak_time"])
|
|
268
|
+
axon_spike_time = features_results[0]["peak_time"]
|
|
269
|
+
soma_spike_time = features_results[1]["peak_time"]
|
|
250
270
|
|
|
251
271
|
# Check if axon spike happens before soma spike
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
"Validation
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
272
|
+
if axon_spike_time is None or soma_spike_time is None or len(axon_spike_time) == 0 or len(soma_spike_time) == 0:
|
|
273
|
+
passed = False
|
|
274
|
+
notes = "Validation failed: Could not determine spike times for axon or soma."
|
|
275
|
+
else:
|
|
276
|
+
passed = bool(axon_spike_time[0] <= soma_spike_time[0])
|
|
277
|
+
notes = (
|
|
278
|
+
"Validation passed: Axon spikes before soma."
|
|
279
|
+
if passed
|
|
280
|
+
else "Validation failed: Axon does not spike before soma."
|
|
281
|
+
)
|
|
258
282
|
return {
|
|
259
283
|
"name": name,
|
|
260
284
|
"passed": passed,
|
|
@@ -337,7 +361,15 @@ def rin_test(rin):
|
|
|
337
361
|
}
|
|
338
362
|
|
|
339
363
|
|
|
340
|
-
def iv_test(
|
|
364
|
+
def iv_test(
|
|
365
|
+
template_params,
|
|
366
|
+
rheobase,
|
|
367
|
+
out_dir,
|
|
368
|
+
spike_threshold_voltage=-40.,
|
|
369
|
+
n_processes=None,
|
|
370
|
+
celsius=None,
|
|
371
|
+
v_init=None
|
|
372
|
+
):
|
|
341
373
|
"""IV curve should have a positive slope."""
|
|
342
374
|
name = "Simulatable Neuron IV Curve Validation"
|
|
343
375
|
amps, steady_states = compute_plot_iv_curve(
|
|
@@ -350,6 +382,8 @@ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20., n_
|
|
|
350
382
|
output_dir=out_dir,
|
|
351
383
|
output_fname="iv_curve.pdf",
|
|
352
384
|
n_processes=n_processes,
|
|
385
|
+
celsius=celsius,
|
|
386
|
+
v_init=v_init,
|
|
353
387
|
)
|
|
354
388
|
|
|
355
389
|
outpath = pathlib.Path(out_dir) / "iv_curve.pdf"
|
|
@@ -377,12 +411,21 @@ def iv_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20., n_
|
|
|
377
411
|
}
|
|
378
412
|
|
|
379
413
|
|
|
380
|
-
def fi_test(
|
|
414
|
+
def fi_test(
|
|
415
|
+
template_params,
|
|
416
|
+
rheobase,
|
|
417
|
+
out_dir,
|
|
418
|
+
spike_threshold_voltage=-40.,
|
|
419
|
+
n_processes=None,
|
|
420
|
+
celsius=None,
|
|
421
|
+
v_init=None,
|
|
422
|
+
):
|
|
381
423
|
"""FI curve should have a positive slope."""
|
|
382
424
|
name = "Simulatable Neuron FI Curve Validation"
|
|
383
425
|
amps, spike_counts = compute_plot_fi_curve(
|
|
384
426
|
Cell.from_template_parameters(template_params),
|
|
385
427
|
rheobase=rheobase,
|
|
428
|
+
max_current=3. * rheobase,
|
|
386
429
|
threshold_voltage=spike_threshold_voltage,
|
|
387
430
|
nb_bins=5,
|
|
388
431
|
show_figure=False,
|
|
@@ -390,6 +433,8 @@ def fi_test(template_params, rheobase, out_dir, spike_threshold_voltage=-20., n_
|
|
|
390
433
|
output_dir=out_dir,
|
|
391
434
|
output_fname="fi_curve.pdf",
|
|
392
435
|
n_processes=n_processes,
|
|
436
|
+
celsius=celsius,
|
|
437
|
+
v_init=v_init,
|
|
393
438
|
)
|
|
394
439
|
|
|
395
440
|
outpath = pathlib.Path(out_dir) / "fi_curve.pdf"
|
|
@@ -449,7 +494,7 @@ def thumbnail_test(template_params, rheobase, out_dir):
|
|
|
449
494
|
def run_validations(
|
|
450
495
|
cell,
|
|
451
496
|
cell_name,
|
|
452
|
-
spike_threshold_voltage=-
|
|
497
|
+
spike_threshold_voltage=-40,
|
|
453
498
|
v_init=-80.0,
|
|
454
499
|
celsius=34.0,
|
|
455
500
|
output_dir="./memodel_validation_figures",
|
|
@@ -461,6 +506,7 @@ def run_validations(
|
|
|
461
506
|
cell (Cell): The cell to validate.
|
|
462
507
|
cell_name (str): The name of the cell, used in the output directory.
|
|
463
508
|
spike_threshold_voltage (float): The voltage threshold for spike detection.
|
|
509
|
+
Default value in this module is -40 mV because some cells do not reach -20 mv.
|
|
464
510
|
v_init: Initial membrane potential. Default is -80.0 mV.
|
|
465
511
|
celsius: Temperature in Celsius. Default is 34.0.
|
|
466
512
|
output_dir (str): The directory to save the validation figures.
|
|
@@ -472,9 +518,7 @@ def run_validations(
|
|
|
472
518
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
473
519
|
|
|
474
520
|
# set initial voltage and temperature
|
|
475
|
-
|
|
476
|
-
neuron_globals.temperature = celsius
|
|
477
|
-
neuron_globals.v_init = v_init
|
|
521
|
+
set_neuron_globals(temperature=celsius, v_init=v_init)
|
|
478
522
|
|
|
479
523
|
# get me-model properties
|
|
480
524
|
holding_current = cell.hypamp if cell.hypamp else 0.0
|
|
@@ -493,9 +537,10 @@ def run_validations(
|
|
|
493
537
|
)
|
|
494
538
|
|
|
495
539
|
logger.debug("Running validations...")
|
|
496
|
-
from bluecellulab.utils import NestedPool
|
|
497
540
|
val_n_processes = n_processes if n_processes is not None else 7
|
|
498
|
-
with NestedPool(
|
|
541
|
+
with NestedPool(
|
|
542
|
+
processes=val_n_processes, initializer=set_neuron_globals, initargs=(celsius, v_init)
|
|
543
|
+
) as pool:
|
|
499
544
|
# Validation 1: Spiking Test
|
|
500
545
|
spiking_test_result_future = pool.apply_async(
|
|
501
546
|
spiking_test,
|
|
@@ -551,10 +596,14 @@ def run_validations(
|
|
|
551
596
|
|
|
552
597
|
# IV and FI tests are outside of nestedpool, because they use multiprocessing internaly
|
|
553
598
|
# Validation 8: IV Test
|
|
554
|
-
iv_test_result = iv_test(
|
|
599
|
+
iv_test_result = iv_test(
|
|
600
|
+
cell.template_params, rheobase, out_dir, spike_threshold_voltage, n_processes, celsius, v_init
|
|
601
|
+
)
|
|
555
602
|
|
|
556
603
|
# Validation 9: FI Test
|
|
557
|
-
fi_test_result = fi_test(
|
|
604
|
+
fi_test_result = fi_test(
|
|
605
|
+
cell.template_params, rheobase, out_dir, spike_threshold_voltage, n_processes, celsius, v_init
|
|
606
|
+
)
|
|
558
607
|
|
|
559
608
|
return {
|
|
560
609
|
"memodel_properties": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/circuit_access/definition.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/bluepy_simulation_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/circuit/config/sonata_simulation_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bluecellulab-2.6.65 → bluecellulab-2.6.66}/bluecellulab/stimulus/circuit_stimulus_definitions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|