From 41da32b38ecaf87ce95782d503498035ccbadd32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaquier=20Aur=C3=A9lien=20Tristan?= Date: Fri, 2 Feb 2024 16:48:43 +0100 Subject: [PATCH] update jinja templates --- .../templates/cell_template_neurodamus.jinja2 | 3 ++- .../cell_template_neurodamus_sbo.jinja2 | 24 ++++++++++++++----- .../templates/cell_template_neuron.jinja2 | 7 +++++- 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/bluepymm/templates/cell_template_neurodamus.jinja2 b/bluepymm/templates/cell_template_neurodamus.jinja2 index 5120b2ec..fa9532bc 100755 --- a/bluepymm/templates/cell_template_neurodamus.jinja2 +++ b/bluepymm/templates/cell_template_neurodamus.jinja2 @@ -184,7 +184,8 @@ proc distribute_distance(){local x localobj sl this.soma[0] distance(0, 0.5) sprint(distfunc, "%%s %s(%%f) = %s", mech, distfunc) forsec sl for(x, 0) { - sprint(stmp, distfunc, secname(), x, distance(x)) + // use distance(x) twice for the step distribution case, e.g. for calcium hotspot + sprint(stmp, distfunc, secname(), x, distance(x), distance(x)) execute(stmp) } } diff --git a/bluepymm/templates/cell_template_neurodamus_sbo.jinja2 b/bluepymm/templates/cell_template_neurodamus_sbo.jinja2 index 8b57dfbf..fceb1024 100644 --- a/bluepymm/templates/cell_template_neurodamus_sbo.jinja2 +++ b/bluepymm/templates/cell_template_neurodamus_sbo.jinja2 @@ -138,16 +138,27 @@ func getThreshold() { return 0.0 } proc load_morphology(/* morphology_dir, morphology_name */) {localobj morph, import, sf, extension, commands, pyobj strdef morph_path - sprint(morph_path, "%s/%s", $s1, $s2) sf = new StringFunctions() - extension = new String() sscanf(morph_path, "%s", extension.s) + sprint(morph_path, "%s/%s", $s1, $s2) + sf = new StringFunctions() + extension = new String() + sscanf(morph_path, "%s", extension.s) - // TODO fix the `-3` here. sf.right(extension.s, sf.len(extension.s)-3) - if( strcmp(extension.s, ".asc") == 0 ) { + if( strcmp(extension.s, "asc") == 0 ) { morph = new Import3d_Neurolucida3() - } else if( strcmp(extension.s, ".swc" ) == 0) { + morph.quiet = 1 + morph.input(morph_path) + + import = new Import3d_GUI(morph, 0) + import.instantiate(this) + } else if( strcmp(extension.s, "swc" ) == 0) { morph = new Import3d_SWC_read() + morph.quiet = 1 + morph.input(morph_path) + + import = new Import3d_GUI(morph, 0) + import.instantiate(this) } else if( strcmp(extension.s, ".h5") == 0 ) { if(nrnpython ("from morphio_wrapper import MorphIOWrapper") == 1) { pyobj = new PythonObject() @@ -181,7 +192,8 @@ proc distribute_distance(){local x localobj sl this.soma[0] distance(0, 0.5) sprint(distfunc, "%%s %s(%%f) = %s", mech, distfunc) forsec sl for(x, 0) { - sprint(stmp, distfunc, secname(), x, distance(x)) + // use distance(x) twice for the step distribution case, e.g. for calcium hotspot + sprint(stmp, distfunc, secname(), x, distance(x), distance(x)) execute(stmp) } } diff --git a/bluepymm/templates/cell_template_neuron.jinja2 b/bluepymm/templates/cell_template_neuron.jinja2 index 85a1974e..5102f379 100755 --- a/bluepymm/templates/cell_template_neuron.jinja2 +++ b/bluepymm/templates/cell_template_neuron.jinja2 @@ -41,6 +41,10 @@ begintemplate {{template_name}} public all, somatic, apical, axonal, basal, myelinated, APC objref all, somatic, apical, axonal, basal, myelinated, APC +obfunc getCell(){ + return this +} + proc init(/* args: morphology_dir, morphology_name */) { all = new SectionList() apical = new SectionList() @@ -112,7 +116,8 @@ proc distribute_distance(){local x localobj sl this.soma[0] distance(0, 0.5) sprint(distfunc, "%%s %s(%%f) = %s", mech, distfunc) forsec sl for(x, 0) { - sprint(stmp, distfunc, secname(), x, distance(x)) + // use distance(x) twice for the step distribution case, e.g. for calcium hotspot + sprint(stmp, distfunc, secname(), x, distance(x), distance(x)) execute(stmp) } }