Skip to content

Commit

Permalink
fix arbor-related functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaquier Aurélien Tristan committed Aug 20, 2024
1 parent 0373e39 commit f400cbb
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 42 deletions.
13 changes: 10 additions & 3 deletions bluepyopt/ephys/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,12 @@ def instantiate_iclamp_stimuli(self, decor, use_labels=False):
for i, stim in enumerate(self.stimuli):
if not isinstance(stim, stimuli.SynapticStimulus):
if hasattr(stim, 'envelope'):
arb_iclamp = arbor.iclamp(stim.envelope())
envelope = stim.envelope()
envelope = [
(t * arbor.units.ms, curr * arbor.units.nA)
for (t, curr) in envelope
]
arb_iclamp = arbor.iclamp(envelope)
else:
raise ValueError('Stimulus must provide envelope method '
' or be of type NrnNetStimStimulus to be'
Expand Down Expand Up @@ -631,7 +636,7 @@ def instantiate_recordings(self, cell_model, use_labels=False):
"""Instantiate recordings"""

# Attach voltage probe sampling at 10 kHz (every 0.1 ms)
for i, rec in enumerate(self.recordings):
for _, rec in enumerate(self.recordings):
# alternatively arbor.cable_probe_membrane_voltage
arb_loc = rec.location.acc_label()
if isinstance(arb_loc, list) and len(arb_loc) != 1:
Expand All @@ -648,7 +653,9 @@ def instantiate_recordings(self, cell_model, use_labels=False):

cell_model.probe('voltage',
arb_loc.ref if use_labels else arb_loc.loc,
frequency=10) # could be a parameter
"0", # tag: default is '0'
# frequency could be a parameter
frequency=10 * arbor.units.kHz)

return cell_model

Expand Down
6 changes: 4 additions & 2 deletions bluepyopt/ephys/simulators.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,11 @@ def run(self, arb_cell_model, tstop=None, dt=None):
dt = dt if dt is not None else self.dt

if dt is not None:
return arb_cell_model.run(tfinal=tstop, dt=dt)
return arb_cell_model.run(
tfinal=tstop * arbor.units.ms, dt=dt * arbor.units.ms
)
else:
return arb_cell_model.run(tfinal=tstop)
return arb_cell_model.run(tfinal=tstop * arbor.units.ms)


class ArbSimulatorException(Exception):
Expand Down
6 changes: 3 additions & 3 deletions bluepyopt/ephys/templates/acc/decor_acc_template.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{%- endif %}
{%- else %}
{%- for param in params %}
(default ({{ param.name }} {{ param.value }}))
(default ({{ param.name }} {{ param.value }} (scalar 1.0)))
{%- endfor %}
{%- endif %}
{%- endfor %}
Expand All @@ -27,13 +27,13 @@
{%- endif %}
{%- else %}
{%- for param in params %}
(paint {{loc.ref}} ({{ param.name }} {{ param.value }}))
(paint {{loc.ref}} ({{ param.name }} {{ param.value }} (scalar 1.0)))
{%- endfor %}
{%- endif %}
{%- endfor %}

{%- for synapse_name, mech_params in pprocess_mechs[loc].items() %}
(place {{loc.ref}} (synapse (mechanism "{{ mech_params.mech }}" {%- for param in mech_params.params %} ("{{ param.name }}" {{ param.value }}){%- endfor %})) "{{ synapse_name }}")
(place {{loc.ref}} (synapse (mechanism "{{ mech_params.mech }}" {%- for param in mech_params.params %} ("{{ param.name }}" {{ param.value }} (scalar 1.0)){%- endfor %})) "{{ synapse_name }}")
{%- endfor %}

{%- endfor %}))
10 changes: 5 additions & 5 deletions bluepyopt/tests/test_ephys/testdata/acc/CCell/CCell_decor.acc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(arbor-component
(meta-data (version "0.9-dev"))
(decor
(default (gSKv3_1bar_SKv3_1 65))
(paint (region "soma") (gSKv3_1bar_SKv3_1 65))
(paint (region "soma") (gSKv3_1bar_SKv3_1 65))
(default (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "soma") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "soma") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "dend") (density (mechanism "BBP::Ih")))
(paint (region "apic") (gSKv3_1bar_SKv3_1 65))
(paint (region "apic") (gSKv3_1bar_SKv3_1 65))
(paint (region "apic") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "apic") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
(paint (region "apic") (density (mechanism "BBP::Ih")))))
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(arbor-component
(meta-data (version "0.9-dev"))
(decor
(paint (region "soma") (membrane-capacitance 0.01))
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
(paint (region "soma") (density (mechanism "default::pas")))
(place (locset "somacenter") (synapse (mechanism "default::expsyn" ("tau" 10))) "expsyn")))
(place (locset "somacenter") (synapse (mechanism "default::expsyn" ("tau" 10 (scalar 1.0)))) "expsyn")))
24 changes: 12 additions & 12 deletions bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
(arbor-component
(meta-data (version "0.9-dev"))
(decor
(default (membrane-potential -65))
(default (temperature-kelvin 307.14999999999998))
(default (membrane-capacitance 0.01))
(default (axial-resistivity 100))
(default (membrane-potential -65 (scalar 1.0)))
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
(default (membrane-capacitance 0.01 (scalar 1.0)))
(default (axial-resistivity 100 (scalar 1.0)))
(paint (region "all") (density (mechanism "default::pas/e=-75" ("g" 3.0000000000000001e-05))))
(paint (region "soma") (ion-reversal-potential "na" 50))
(paint (region "soma") (ion-reversal-potential "k" -85))
(paint (region "soma") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "soma") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "soma") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.98395500000000002))))
(paint (region "soma") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.30347200000000002))))
(paint (region "soma") (density (mechanism "BBP::SK_E2" ("gSK_E2bar" 0.0084069999999999995))))
(paint (region "soma") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00099400000000000009))))
(paint (region "soma") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.00033300000000000002))))
(paint (region "soma") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.00060899999999999995) ("decay" 210.48528400000001))))
(paint (region "soma") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
(paint (region "axon") (ion-reversal-potential "na" 50))
(paint (region "axon") (ion-reversal-potential "k" -85))
(paint (region "axon") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "axon") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "axon") (density (mechanism "BBP::NaTa_t" ("gNaTa_tbar" 3.1379679999999999))))
(paint (region "axon") (density (mechanism "BBP::Nap_Et2" ("gNap_Et2bar" 0.0068269999999999997))))
(paint (region "axon") (density (mechanism "BBP::K_Pst" ("gK_Pstbar" 0.97353800000000001))))
Expand All @@ -26,11 +26,11 @@
(paint (region "axon") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00098999999999999999))))
(paint (region "axon") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.0087519999999999994))))
(paint (region "axon") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.0029099999999999998) ("decay" 287.19873100000001))))
(paint (region "dend") (membrane-capacitance 0.02))
(paint (region "dend") (membrane-capacitance 0.02 (scalar 1.0)))
(paint (region "dend") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
(paint (region "apic") (ion-reversal-potential "na" 50))
(paint (region "apic") (ion-reversal-potential "k" -85))
(paint (region "apic") (membrane-capacitance 0.02))
(paint (region "apic") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "apic") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "apic") (membrane-capacitance 0.02 (scalar 1.0)))
(paint (region "apic") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.026145000000000002))))
(paint (region "apic") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.0042259999999999997))))
(paint (region "apic") (density (mechanism "BBP::Im" ("gImbar" 0.00014300000000000001))))
Expand Down
24 changes: 12 additions & 12 deletions bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
(arbor-component
(meta-data (version "0.9-dev"))
(decor
(default (membrane-potential -65))
(default (temperature-kelvin 307.14999999999998))
(default (membrane-capacitance 0.01))
(default (axial-resistivity 100))
(default (membrane-potential -65 (scalar 1.0)))
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
(default (membrane-capacitance 0.01 (scalar 1.0)))
(default (axial-resistivity 100 (scalar 1.0)))
(paint (region "all") (density (mechanism "default::pas/e=-75" ("g" 3.0000000000000001e-05))))
(paint (region "soma") (ion-reversal-potential "na" 50))
(paint (region "soma") (ion-reversal-potential "k" -85))
(paint (region "soma") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "soma") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "soma") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.98395500000000002))))
(paint (region "soma") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.30347200000000002))))
(paint (region "soma") (density (mechanism "BBP::SK_E2" ("gSK_E2bar" 0.0084069999999999995))))
(paint (region "soma") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00099400000000000009))))
(paint (region "soma") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.00033300000000000002))))
(paint (region "soma") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.00060899999999999995) ("decay" 210.48528400000001))))
(paint (region "soma") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
(paint (region "axon") (ion-reversal-potential "na" 50))
(paint (region "axon") (ion-reversal-potential "k" -85))
(paint (region "axon") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "axon") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "axon") (density (mechanism "BBP::NaTa_t" ("gNaTa_tbar" 3.1379679999999999))))
(paint (region "axon") (density (mechanism "BBP::Nap_Et2" ("gNap_Et2bar" 0.0068269999999999997))))
(paint (region "axon") (density (mechanism "BBP::K_Pst" ("gK_Pstbar" 0.97353800000000001))))
Expand All @@ -26,11 +26,11 @@
(paint (region "axon") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00098999999999999999))))
(paint (region "axon") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.0087519999999999994))))
(paint (region "axon") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.0029099999999999998) ("decay" 287.19873100000001))))
(paint (region "dend") (membrane-capacitance 0.02))
(paint (region "dend") (membrane-capacitance 0.02 (scalar 1.0)))
(paint (region "dend") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
(paint (region "apic") (ion-reversal-potential "na" 50))
(paint (region "apic") (ion-reversal-potential "k" -85))
(paint (region "apic") (membrane-capacitance 0.02))
(paint (region "apic") (ion-reversal-potential "na" 50 (scalar 1.0)))
(paint (region "apic") (ion-reversal-potential "k" -85 (scalar 1.0)))
(paint (region "apic") (membrane-capacitance 0.02 (scalar 1.0)))
(paint (region "apic") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.026145000000000002))))
(paint (region "apic") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.0042259999999999997))))
(paint (region "apic") (density (mechanism "BBP::Im" ("gImbar" 0.00014300000000000001))))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(arbor-component
(meta-data (version "0.9-dev"))
(decor
(paint (region "soma") (membrane-capacitance 0.01))
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
(paint (region "soma") (density (mechanism "default::hh" ("gnabar" 0.10299326453483033) ("gkbar" 0.027124836082684685))))))
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{%- endif %}
{%- else %}
{%- for param in params %}
(default ({{ param.name }} {{ param.value }}))
(default ({{ param.name }} {{ param.value }} (scalar 1.0)))
{%- endfor %}
{%- endif %}
{%- endfor %}
Expand All @@ -26,7 +26,7 @@
{%- endif %}
{%- else %}
{%- for param in params %}
(paint {{loc.ref}} ({{ param.name }} {{ param.value }}))
(paint {{loc.ref}} ({{ param.name }} {{ param.value }} (scalar 1.0)))
{%- endfor %}
{%- endif %}
{%- endfor %}
Expand Down

0 comments on commit f400cbb

Please sign in to comment.