Trying to use SectionRefs crashing the simulation.
Posted: Fri Oct 29, 2021 10:12 am
Hi,
I'm trying to integrate some new functionality into a mountain of legacy code, and this functionality comes from something that's written half in Python and half in HOC, so I'm unsure of what my errors are doing.
I'm trying to add a spine to my detailed morphology, and I'm trying to use exactly the same spine as in someone else's project.
So I added this function to my cell's template:
The original source of where this was called was written in Python, and my current code is in HOC so I had to make some adjustments.
In my code I access a target section, and try to type this:
This causes a segmentation fault, and I'm totally unsure what I'm doing wrong. What I aim to do is place a spine at the halfway segment of the section I'm aiming at, and as far as I know I just need to pass the function a section ref and a segment index (in addition to its parameters). I aim to get this working first for currently accessed section, then adapt for an arbitrary number of them.
This is a bit of a sloppy hack job here, since my original idea (use my external tools to add a spine) doesn't seem to be working right.
I'm trying to integrate some new functionality into a mountain of legacy code, and this functionality comes from something that's written half in Python and half in HOC, so I'm unsure of what my errors are doing.
I'm trying to add a spine to my detailed morphology, and I'm trying to use exactly the same spine as in someone else's project.
So I added this function to my cell's template:
Code: Select all
proc add_spine_ra(){localobj sref
PI = 3.14159265359
sref = $o1
x = $2
neck_diam = $3
neck_len = $4
spine_head_area = $5
ra = $6
create spine[2]
L_head = 2*sqrt(spine_head_area /4/PI) //sphere has the same surface area as cylinder with L=diam
diam_head = L_head
spine[0]{
L = neck_len
diam = neck_diam
insert pas
cm =CM
g_pas=1/RM
e_pas = E_PAS
Ra = ra
regspines.append()
}
spine[1]{
L = L_head
diam = diam_head
insert pas
cm =CM
g_pas=1/RM
e_pas = E_PAS
Ra = ra
regspines.append()
}
connect spine[1](0) ,spine[0](1)
sref.sec{
connect spine[0](0), x
}
}
In my code I access a target section, and try to type this:
Code: Select all
target_section = new SectionRef()
//add a spine to the cell
add_spine_ra(target_section, 0.5, 0.25,1.35,2.8,201.78)
This is a bit of a sloppy hack job here, since my original idea (use my external tools to add a spine) doesn't seem to be working right.