Skip to content

Commit

Permalink
Merge pull request #268 from AurelienJaquier/jinja-template
Browse files Browse the repository at this point in the history
update jinja templates
  • Loading branch information
AurelienJaquier authored Mar 21, 2024
2 parents 835ddb3 + 41da32b commit 13c9daa
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bluepymm/templates/cell_template_neurodamus.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
24 changes: 18 additions & 6 deletions bluepymm/templates/cell_template_neurodamus_sbo.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
}
Expand Down
7 changes: 6 additions & 1 deletion bluepymm/templates/cell_template_neuron.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
}
Expand Down

0 comments on commit 13c9daa

Please sign in to comment.