Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit f400cbb

Browse files
author
Jaquier Aurélien Tristan
committed
fix arbor-related functional tests
1 parent 0373e39 commit f400cbb

File tree

9 files changed

+51
-42
lines changed

9 files changed

+51
-42
lines changed

bluepyopt/ephys/protocols.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,12 @@ def instantiate_iclamp_stimuli(self, decor, use_labels=False):
602602
for i, stim in enumerate(self.stimuli):
603603
if not isinstance(stim, stimuli.SynapticStimulus):
604604
if hasattr(stim, 'envelope'):
605-
arb_iclamp = arbor.iclamp(stim.envelope())
605+
envelope = stim.envelope()
606+
envelope = [
607+
(t * arbor.units.ms, curr * arbor.units.nA)
608+
for (t, curr) in envelope
609+
]
610+
arb_iclamp = arbor.iclamp(envelope)
606611
else:
607612
raise ValueError('Stimulus must provide envelope method '
608613
' or be of type NrnNetStimStimulus to be'
@@ -631,7 +636,7 @@ def instantiate_recordings(self, cell_model, use_labels=False):
631636
"""Instantiate recordings"""
632637

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

649654
cell_model.probe('voltage',
650655
arb_loc.ref if use_labels else arb_loc.loc,
651-
frequency=10) # could be a parameter
656+
"0", # tag: default is '0'
657+
# frequency could be a parameter
658+
frequency=10 * arbor.units.kHz)
652659

653660
return cell_model
654661

bluepyopt/ephys/simulators.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,11 @@ def run(self, arb_cell_model, tstop=None, dt=None):
372372
dt = dt if dt is not None else self.dt
373373

374374
if dt is not None:
375-
return arb_cell_model.run(tfinal=tstop, dt=dt)
375+
return arb_cell_model.run(
376+
tfinal=tstop * arbor.units.ms, dt=dt * arbor.units.ms
377+
)
376378
else:
377-
return arb_cell_model.run(tfinal=tstop)
379+
return arb_cell_model.run(tfinal=tstop * arbor.units.ms)
378380

379381

380382
class ArbSimulatorException(Exception):

bluepyopt/ephys/templates/acc/decor_acc_template.jinja2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{%- endif %}
1111
{%- else %}
1212
{%- for param in params %}
13-
(default ({{ param.name }} {{ param.value }}))
13+
(default ({{ param.name }} {{ param.value }} (scalar 1.0)))
1414
{%- endfor %}
1515
{%- endif %}
1616
{%- endfor %}
@@ -27,13 +27,13 @@
2727
{%- endif %}
2828
{%- else %}
2929
{%- for param in params %}
30-
(paint {{loc.ref}} ({{ param.name }} {{ param.value }}))
30+
(paint {{loc.ref}} ({{ param.name }} {{ param.value }} (scalar 1.0)))
3131
{%- endfor %}
3232
{%- endif %}
3333
{%- endfor %}
3434

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

3939
{%- endfor %}))
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
(arbor-component
22
(meta-data (version "0.9-dev"))
33
(decor
4-
(default (gSKv3_1bar_SKv3_1 65))
5-
(paint (region "soma") (gSKv3_1bar_SKv3_1 65))
6-
(paint (region "soma") (gSKv3_1bar_SKv3_1 65))
4+
(default (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
5+
(paint (region "soma") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
6+
(paint (region "soma") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
77
(paint (region "dend") (density (mechanism "BBP::Ih")))
8-
(paint (region "apic") (gSKv3_1bar_SKv3_1 65))
9-
(paint (region "apic") (gSKv3_1bar_SKv3_1 65))
8+
(paint (region "apic") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
9+
(paint (region "apic") (gSKv3_1bar_SKv3_1 65 (scalar 1.0)))
1010
(paint (region "apic") (density (mechanism "BBP::Ih")))))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(arbor-component
22
(meta-data (version "0.9-dev"))
33
(decor
4-
(paint (region "soma") (membrane-capacitance 0.01))
4+
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
55
(paint (region "soma") (density (mechanism "default::pas")))
6-
(place (locset "somacenter") (synapse (mechanism "default::expsyn" ("tau" 10))) "expsyn")))
6+
(place (locset "somacenter") (synapse (mechanism "default::expsyn" ("tau" 10 (scalar 1.0)))) "expsyn")))

bluepyopt/tests/test_ephys/testdata/acc/l5pc/l5pc_decor.acc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
(arbor-component
22
(meta-data (version "0.9-dev"))
33
(decor
4-
(default (membrane-potential -65))
5-
(default (temperature-kelvin 307.14999999999998))
6-
(default (membrane-capacitance 0.01))
7-
(default (axial-resistivity 100))
4+
(default (membrane-potential -65 (scalar 1.0)))
5+
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
6+
(default (membrane-capacitance 0.01 (scalar 1.0)))
7+
(default (axial-resistivity 100 (scalar 1.0)))
88
(paint (region "all") (density (mechanism "default::pas/e=-75" ("g" 3.0000000000000001e-05))))
9-
(paint (region "soma") (ion-reversal-potential "na" 50))
10-
(paint (region "soma") (ion-reversal-potential "k" -85))
9+
(paint (region "soma") (ion-reversal-potential "na" 50 (scalar 1.0)))
10+
(paint (region "soma") (ion-reversal-potential "k" -85 (scalar 1.0)))
1111
(paint (region "soma") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.98395500000000002))))
1212
(paint (region "soma") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.30347200000000002))))
1313
(paint (region "soma") (density (mechanism "BBP::SK_E2" ("gSK_E2bar" 0.0084069999999999995))))
1414
(paint (region "soma") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00099400000000000009))))
1515
(paint (region "soma") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.00033300000000000002))))
1616
(paint (region "soma") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.00060899999999999995) ("decay" 210.48528400000001))))
1717
(paint (region "soma") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
18-
(paint (region "axon") (ion-reversal-potential "na" 50))
19-
(paint (region "axon") (ion-reversal-potential "k" -85))
18+
(paint (region "axon") (ion-reversal-potential "na" 50 (scalar 1.0)))
19+
(paint (region "axon") (ion-reversal-potential "k" -85 (scalar 1.0)))
2020
(paint (region "axon") (density (mechanism "BBP::NaTa_t" ("gNaTa_tbar" 3.1379679999999999))))
2121
(paint (region "axon") (density (mechanism "BBP::Nap_Et2" ("gNap_Et2bar" 0.0068269999999999997))))
2222
(paint (region "axon") (density (mechanism "BBP::K_Pst" ("gK_Pstbar" 0.97353800000000001))))
@@ -26,11 +26,11 @@
2626
(paint (region "axon") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00098999999999999999))))
2727
(paint (region "axon") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.0087519999999999994))))
2828
(paint (region "axon") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.0029099999999999998) ("decay" 287.19873100000001))))
29-
(paint (region "dend") (membrane-capacitance 0.02))
29+
(paint (region "dend") (membrane-capacitance 0.02 (scalar 1.0)))
3030
(paint (region "dend") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
31-
(paint (region "apic") (ion-reversal-potential "na" 50))
32-
(paint (region "apic") (ion-reversal-potential "k" -85))
33-
(paint (region "apic") (membrane-capacitance 0.02))
31+
(paint (region "apic") (ion-reversal-potential "na" 50 (scalar 1.0)))
32+
(paint (region "apic") (ion-reversal-potential "k" -85 (scalar 1.0)))
33+
(paint (region "apic") (membrane-capacitance 0.02 (scalar 1.0)))
3434
(paint (region "apic") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.026145000000000002))))
3535
(paint (region "apic") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.0042259999999999997))))
3636
(paint (region "apic") (density (mechanism "BBP::Im" ("gImbar" 0.00014300000000000001))))

bluepyopt/tests/test_ephys/testdata/acc/l5pc_py37/l5pc_decor.acc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
(arbor-component
22
(meta-data (version "0.9-dev"))
33
(decor
4-
(default (membrane-potential -65))
5-
(default (temperature-kelvin 307.14999999999998))
6-
(default (membrane-capacitance 0.01))
7-
(default (axial-resistivity 100))
4+
(default (membrane-potential -65 (scalar 1.0)))
5+
(default (temperature-kelvin 307.14999999999998 (scalar 1.0)))
6+
(default (membrane-capacitance 0.01 (scalar 1.0)))
7+
(default (axial-resistivity 100 (scalar 1.0)))
88
(paint (region "all") (density (mechanism "default::pas/e=-75" ("g" 3.0000000000000001e-05))))
9-
(paint (region "soma") (ion-reversal-potential "na" 50))
10-
(paint (region "soma") (ion-reversal-potential "k" -85))
9+
(paint (region "soma") (ion-reversal-potential "na" 50 (scalar 1.0)))
10+
(paint (region "soma") (ion-reversal-potential "k" -85 (scalar 1.0)))
1111
(paint (region "soma") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.98395500000000002))))
1212
(paint (region "soma") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.30347200000000002))))
1313
(paint (region "soma") (density (mechanism "BBP::SK_E2" ("gSK_E2bar" 0.0084069999999999995))))
1414
(paint (region "soma") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00099400000000000009))))
1515
(paint (region "soma") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.00033300000000000002))))
1616
(paint (region "soma") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.00060899999999999995) ("decay" 210.48528400000001))))
1717
(paint (region "soma") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
18-
(paint (region "axon") (ion-reversal-potential "na" 50))
19-
(paint (region "axon") (ion-reversal-potential "k" -85))
18+
(paint (region "axon") (ion-reversal-potential "na" 50 (scalar 1.0)))
19+
(paint (region "axon") (ion-reversal-potential "k" -85 (scalar 1.0)))
2020
(paint (region "axon") (density (mechanism "BBP::NaTa_t" ("gNaTa_tbar" 3.1379679999999999))))
2121
(paint (region "axon") (density (mechanism "BBP::Nap_Et2" ("gNap_Et2bar" 0.0068269999999999997))))
2222
(paint (region "axon") (density (mechanism "BBP::K_Pst" ("gK_Pstbar" 0.97353800000000001))))
@@ -26,11 +26,11 @@
2626
(paint (region "axon") (density (mechanism "BBP::Ca_HVA" ("gCa_HVAbar" 0.00098999999999999999))))
2727
(paint (region "axon") (density (mechanism "BBP::Ca_LVAst" ("gCa_LVAstbar" 0.0087519999999999994))))
2828
(paint (region "axon") (density (mechanism "BBP::CaDynamics_E2" ("gamma" 0.0029099999999999998) ("decay" 287.19873100000001))))
29-
(paint (region "dend") (membrane-capacitance 0.02))
29+
(paint (region "dend") (membrane-capacitance 0.02 (scalar 1.0)))
3030
(paint (region "dend") (density (mechanism "BBP::Ih" ("gIhbar" 8.0000000000000007e-05))))
31-
(paint (region "apic") (ion-reversal-potential "na" 50))
32-
(paint (region "apic") (ion-reversal-potential "k" -85))
33-
(paint (region "apic") (membrane-capacitance 0.02))
31+
(paint (region "apic") (ion-reversal-potential "na" 50 (scalar 1.0)))
32+
(paint (region "apic") (ion-reversal-potential "k" -85 (scalar 1.0)))
33+
(paint (region "apic") (membrane-capacitance 0.02 (scalar 1.0)))
3434
(paint (region "apic") (density (mechanism "BBP::NaTs2_t" ("gNaTs2_tbar" 0.026145000000000002))))
3535
(paint (region "apic") (density (mechanism "BBP::SKv3_1" ("gSKv3_1bar" 0.0042259999999999997))))
3636
(paint (region "apic") (density (mechanism "BBP::Im" ("gImbar" 0.00014300000000000001))))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(arbor-component
22
(meta-data (version "0.9-dev"))
33
(decor
4-
(paint (region "soma") (membrane-capacitance 0.01))
4+
(paint (region "soma") (membrane-capacitance 0.01 (scalar 1.0)))
55
(paint (region "soma") (density (mechanism "default::hh" ("gnabar" 0.10299326453483033) ("gkbar" 0.027124836082684685))))))

bluepyopt/tests/test_ephys/testdata/acc/templates/decor_acc_template.jinja2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{%- endif %}
1212
{%- else %}
1313
{%- for param in params %}
14-
(default ({{ param.name }} {{ param.value }}))
14+
(default ({{ param.name }} {{ param.value }} (scalar 1.0)))
1515
{%- endfor %}
1616
{%- endif %}
1717
{%- endfor %}
@@ -26,7 +26,7 @@
2626
{%- endif %}
2727
{%- else %}
2828
{%- for param in params %}
29-
(paint {{loc.ref}} ({{ param.name }} {{ param.value }}))
29+
(paint {{loc.ref}} ({{ param.name }} {{ param.value }} (scalar 1.0)))
3030
{%- endfor %}
3131
{%- endif %}
3232
{%- endfor %}

0 commit comments

Comments
 (0)