def _create_cells(self, r): self.cells = [] for i in self.gidlist: ### only create the cells that exist on this host theta = i * 2 * h.PI / self._N self.cells.append( BallAndStick(i, h.cos(theta) * r, h.sin(theta) * r, 0, theta) ) ### associate the cell with this host and gid for cell in self.cells: pc.cell(cell._gid, cell._spike_detector)
def _rotate_z(self, theta): for sec in self.all: for i in range(sec.n3d()): x = sec.x3d(i) y = sec.y3d(i) c = h.cos(theta) s = h.sin(theta) xprime = x * c - y * s yprime = x * s + y * c sec.pt3dchange(i, xprime, yprime, sec.z3d(i), sec.diam3d(i))
def rotate_cell_z(self, theta): h.define_shape() """Rotate the cell about the Z axis.""" for sec in self.secs: for i in range(sec.n3d()): x = sec.x3d(i) y = sec.y3d(i) c = h.cos(theta) s = h.sin(theta) xprime = x * c - y * s yprime = x * s + y * c sec.pt3dchange(i, xprime, yprime, sec.z3d(i), sec.diam3d(i))
from neuron import h from matplotlib import pyplot from cells.core.basic_cell import BasicCell h.load_file('stdrun.hoc') n = 10 r = 50 cells = [] for i in range(n): cell = BasicCell(name=str(i)) cell.add_sec('soma', diam=12, l=200, nseg=10) cell.add_sec('dend', diam=1, l=10, nseg=10) cell.connect_secs(source='soma', target='dend') theta = i * 2 * h.PI / n cell.set_cell_position(x=h.cos(theta) * r, y=h.sin(theta) * r, z=0) cell.rotate_cell_z(theta=theta) cells.append(cell) ps = h.PlotShape(False) ps.plot(pyplot) pyplot.show()