Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-existing myelin section has len(icell.myelin) > 0 causing error on access #419

Open
lukasgd opened this issue Oct 3, 2022 · 2 comments

Comments

@lukasgd
Copy link
Contributor

lukasgd commented Oct 3, 2022

    That works on myelin and the `len(self.icell.myelin) == 1` looks like a bug given that NEURON crashes, complaining that the section was deleted upon accessing e.g. `self.icell.myelin[0]`. I've added safe support for `myelin` now in 2c67258.

Originally posted by @lukasgd in #393 (comment)

@lukasgd
Copy link
Contributor Author

lukasgd commented Oct 3, 2022

The behavior can be reproduced in the L5PC example, following the notebook

BluePyOpt/examples/l5pc$ ipython
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
Type 'copyright', 'credits' or 'license' for more information
IPython 8.5.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: !nrnivmodl mechanisms
/home/lukasd/src/arbor/bluepyopt_test/BluePyOpt/examples/l5pc
Mod files: "mechanisms/mechanisms/CaDynamics_E2.mod" "mechanisms/mechanisms/Ca_HVA.mod" "mechanisms/mechanisms/Ca_LVAst.mod" "mechanisms/mechanisms/Ih.mod" "mechanisms/mechanisms/Im.mod" "mechanisms/mechanisms/K_Pst.mod" "mechanisms/mechanisms/K_Tst.mod" "mechanisms/mechanisms/Nap_Et2.mod" "mechanisms/mechanisms/NaTa_t.mod" "mechanisms/mechanisms/NaTs2_t.mod" "mechanisms/mechanisms/SK_E2.mod" "mechanisms/mechanisms/SKv3_1.mod"

 -> Compiling mod_func.cpp
 => LINKING shared library ./libnrnmech.so
Successfully created x86_64/special

In [2]: from bluepyopt import ephys

In [3]: import l5pc_model

In [4]: l5pc_cell = ephys.models.CellModel('l5pc', morph=ephys.morphologies.NrnFileMorphology('morphology/C060114A7.asc', do_replace_axon
   ...: =True), mechs=l5pc_model.define_mechanisms(), params=l5pc_model.define_parameters())

In [5]: sim = ephys.simulators.NrnSimulator()

In [6]: release_params = {
   ...:     'gNaTs2_tbar_NaTs2_t.apical': 0.026145,
   ...:     'gSKv3_1bar_SKv3_1.apical': 0.004226,
   ...:     'gImbar_Im.apical': 0.000143,
   ...:     'gNaTa_tbar_NaTa_t.axonal': 3.137968,
   ...:     'gK_Tstbar_K_Tst.axonal': 0.089259,
   ...:     'gamma_CaDynamics_E2.axonal': 0.002910,
   ...:     'gNap_Et2bar_Nap_Et2.axonal': 0.006827,
   ...:     'gSK_E2bar_SK_E2.axonal': 0.007104,
   ...:     'gCa_HVAbar_Ca_HVA.axonal': 0.000990,
   ...:     'gK_Pstbar_K_Pst.axonal': 0.973538,
   ...:     'gSKv3_1bar_SKv3_1.axonal': 1.021945,
   ...:     'decay_CaDynamics_E2.axonal': 287.198731,
   ...:     'gCa_LVAstbar_Ca_LVAst.axonal': 0.008752,
   ...:     'gamma_CaDynamics_E2.somatic': 0.000609,
   ...:     'gSKv3_1bar_SKv3_1.somatic': 0.303472,
   ...:     'gSK_E2bar_SK_E2.somatic': 0.008407,
   ...:     'gCa_HVAbar_Ca_HVA.somatic': 0.000994,
   ...:     'gNaTs2_tbar_NaTs2_t.somatic': 0.983955,
   ...:     'decay_CaDynamics_E2.somatic': 210.485284,
   ...:     'gCa_LVAstbar_Ca_LVAst.somatic': 0.000333
   ...: }

In [7]: l5pc_cell.freeze(release_params)

In [8]: l5pc_cell.instantiate(sim)

In [9]: l5pc_cell.icell.myelin
Out[9]: l5pc[0].myelin[?]

In [10]: len(l5pc_cell.icell.myelin)
Out[10]: 1

In [11]: [s for s in l5pc_cell.icell.myelin]
NEURON: section in the object was deleted
 near line 0
 {create axon[2]}
                 ^

@lukasgd
Copy link
Contributor Author

lukasgd commented Oct 3, 2022

One way to resolve this was implemented in 2c67258, as mentioned above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant