I am attempting to place a grid of cells, all duplicates from one neurolucida morphology, in a shapeplot in NEURON. My issue is that the somas do not move in synchronization with their dendritic trees when I use the "_set_position" function from the Ball-and-stick tutorial (link: https://neuron.yale.edu/neuron/docs/bal ... del-part-3). When in shapeplot, it appears to me as if the somas move exactly half of the grid distance given compared to their dendritic trees. I have attempted to solve this by altering the "_set_position" function, but have been unsuccessful.
Here are some images of my issue. The first is what happens when using the original "_set_position" function, the others are the result of an alternative function I tested. Image link: https://universityofbergen-my.sharepoin ... w?e=TjZ9Vi
This is the code I use to create a grid:
Code: Select all
from neuron import h, gui
from neuron.units import ms, mV
from AII_class_v2 import AmacrineAII as AII
import sys
h.load_file('stdrun.hoc')
h.load_file("stdlib.hoc")
morphology = sys.argv[1]
x, y = 2, 2 #matrix
distance = 300
cells = []
counter = 0
for row in range(x):
for col in range(y):
counter += 1
new_cell = AII(morphology, counter)
new_cell.set_position(row * distance, 0, col * distance)
cells.append(new_cell)
ps = h.PlotShape(True)
ps.variable('v')
ps.scale(-80, 60)
ps.show(0)
ps.exec_menu('Shape Plot')
h.fast_flush_list.append(ps)
Code: Select all
def _set_position(self, x, y, z):
for sec in self.all:
for i in range(sec.n3d()):
sec.pt3dchange(i,
x - self.x + sec.x3d(i),
y - self.y + sec.y3d(i),
z - self.z + sec.z3d(i),
sec.diam3d(i))
self.x, self.y, self.z = x, y, z
Code: Select all
def _set_position(self, x, y, z):
for sec in self.soma:
for i in range(sec.n3d()):
sec.pt3dchange(i,
2 * (x - self.x) + sec.x3d(i),
2 * (y - self.y) + sec.y3d(i),
2 * (z - self.z) + sec.z3d(i),
sec.diam3d(i))
for sec in self.dend:
for i in range(sec.n3d()):
sec.pt3dchange(i,
x - self.x + sec.x3d(i),
y - self.y + sec.y3d(i),
z - self.z + sec.z3d(i),
sec.diam3d(i))
self.x, self.y, self.z = x, y, z