Ejemplo n.º 1
0
 def position(self, x, y, z):
     for i in range(h.n3d()):
         h.pt3dchange(i, x+self.x+h.x3d(i), y+self.y+h.y3d(i),
                      z+self.z+h.z3d(i), h.diam3d(i))
         self.x = x
         self.y = y
         self.z = z
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     for sec in self.all:
         for i in range(2):
             x = h.x3d(i) * sin(theta) + h.y3d(i) * cos(theta)
             y = h.x3d(i) * cos(theta) + h.y3d(i) * -sin(theta)
             h.pt3dchange(i, x, y, h.z3d(i), h.diam3d(i))
Ejemplo n.º 3
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     rot_m = numpy.array([[sin(theta), cos(theta)], [cos(theta), -sin(theta)]])
     for sec in self.all:
         for i in range(int(h.n3d())):
             xy = numpy.dot([h.x3d(i), h.y3d(i)], rot_m)
             h.pt3dchange(i, xy[0], xy[1], h.z3d(i), h.diam3d(i))
Ejemplo n.º 4
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     for sec in self.all:
         for i in range(2):
             x = h.x3d(i) * sin(theta) + h.y3d(i) * cos(theta)
             y = h.x3d(i) * cos(theta) + h.y3d(i) * -sin(theta)
             h.pt3dchange(i, x, y, h.z3d(i), h.diam3d(i))
Ejemplo n.º 5
0
def setup_pcmorphology(kk, x, y, z):
    print 'i value is:', kk
    cellpc = Purkinje()
    h.define_shape()

    sections = h.SectionList()
    sections.wholetree(cellpc.soma)
    cellpc.soma.push()
    n = h.n3d(sec=cellpc.soma)
    xs = [h.x3d(i) for i in range(int(n))]
    ys = [h.y3d(i) for i in range(int(n))]
    zs = [h.z3d(i) for i in range(int(n))]
    ds = [h.diam3d(i) for i in range(int(n))]
    j = 0
    #sec.push()
    for a, b, c, d in zip(xs, ys, zs, ds):
        #print 'sec here is:', sec
        h.pt3dchange(j, a + x, b + y, c + z, d)
        j += 1
    h.define_shape()
    h.pop_section()
    pulist.append(cellpc)
    #call another function to locate the local granule neurons
    cellpc.soma.push()
    getpurksecs = h.SectionList()
    getpurksecs.wholetree(cellpc.soma)
    func_local_grcneurons(kk, getpurksecs)
Ejemplo n.º 6
0
 def translate3d (self, dx, dy, dz):
   #s = self.soma
   #for i in range(s.n3d()):          
   #  h.pt3dchange(i,s.x3d(i)+dx,s.y3d(i)+dy,s.z3d(i)+dz,s.diam3d(i),sec=s)
   for s in self.get_sections():
     for i in range(s.n3d()):          
       #print(s,i,s.x3d(i)+dx,s.y3d(i)+dy,s.z3d(i)+dz,s.diam3d(i))
       h.pt3dchange(i,s.x3d(i)+dx,s.y3d(i)+dy,s.z3d(i)+dz,s.diam3d(i),sec=s)
Ejemplo n.º 7
0
def change_cell_location(soma, offset=150):
    soma.push()

    for i in range(int(h.n3d())):
        h.pt3dchange(i,
                     offset + h.x3d(i),
                     offset + h.y3d(i),
                     offset + h.z3d(i),
                     h.diam3d(i))
Ejemplo n.º 8
0
 def position(self, x, y, z):
     soma.push()
     for i in range(h.n3d()):
         h.pt3dchange(i, x - self.x + h.x3d(i), y - self.y + h.y3d(i),
                      z - self.z + h.z3d(i), h.diam3d(i))
     self.x = x
     self.y = y
     self.z = z
     h.pop_section()
Ejemplo n.º 9
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     rot_m = numpy.array([[numpy.sin(theta), numpy.cos(theta)], 
             [numpy.cos(theta), -numpy.sin(theta)]])
     for sec in self.all:
         for i in range(sec.n3d()):
             xy = numpy.dot([sec.x3d(i), sec.y3d(i)], rot_m)
             h.pt3dchange(i, float(xy[0]), float(xy[1]), sec.z3d(i), 
                     sec.diam3d(i))
Ejemplo n.º 10
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         for i in range(int(h.n3d())):
             h.pt3dchange(i, x - self.x + h.x3d(i), y - self.y + h.y3d(i),
                          z - self.z + h.z3d(i), h.diam3d(i))
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 11
0
 def translate3d(self, dx, dy, dz):
     """Translate 3d."""
     for s in self.get_sections():
         for i in range(s.n3d()):
             h.pt3dchange(i,
                          s.x3d(i) + dx,
                          s.y3d(i) + dy,
                          s.z3d(i) + dz,
                          s.diam3d(i),
                          sec=s)
Ejemplo n.º 12
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         # note: iterating like this changes the context for all NEURON
         # functions that depend on a section, so no need to specify sec=
         for i in range(int(h.n3d())):
             h.pt3dchange(i, x - self.x + h.x3d(i), y - self.y + h.y3d(i),
                          z - self.z + h.z3d(i), h.diam3d(i))
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 13
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         for i in range(int(nrn.n3d())):
             nrn.pt3dchange(i, \
                            x-self.x+nrn.x3d(i), \
                            y-self.y+nrn.y3d(i), \
                            z-self.z+nrn.z3d(i), \
                            nrn.diam3d(i))
     self.x = x; self.y = y; self.z = z
Ejemplo n.º 14
0
    def move_to_pos(self):
        """Move cell to position."""
        x0 = self.soma.x3d(0)
        y0 = self.soma.y3d(0)
        z0 = self.soma.z3d(0)
        dx = self.pos[0] * 100 - x0
        dy = self.pos[2] - y0
        dz = self.pos[1] * 100 - z0

        for s in self.get_sections():
            for i in range(s.n3d()):
                h.pt3dchange(i, s.x3d(i) + dx, s.y3d(i) + dy,
                             s.z3d(i) + dz, s.diam3d(i), sec=s)
Ejemplo n.º 15
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         for i in range(int(h.n3d())):
             h.pt3dchange(i,
                     x - self.x + h.x3d(i),
                     y - self.y + h.y3d(i),
                     z - self.z + h.z3d(i),
                     h.diam3d(i))
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 16
0
 def set_position(self, x, y, z):
     """
         This method can change the absolute 3D location of the network by
         translational motion, leaving all relative positons intact. Besides
         the SimpleCell object, it takes three other argumentseach of which 
         is the change in the respective Cartesian coordinate. 
     """
     for section in self.all:
         for point in range(int(h.n3d(sec=section))):
             h.pt3dchange(point, x - self.x + h.x3d(point),
                          y - self.y + h.y3d(point),
                          z - self.z + h.z3d(point), h.diam3d(point))
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 17
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         for i in range(sec.n3d()):
             h.pt3dchange(i, 
                     x-self.x+sec.x3d(i), 
                     y-self.y+sec.y3d(i), 
                     z-self.z+sec.z3d(i), 
                     sec.diam3d(i), sec=sec)
     self.x = x; self.y = y; self.z = z
Ejemplo n.º 18
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     rel_origin = (self.soma.x3d(0), self.soma.y3d(0))
     for sec in self.all:
         for i in range(sec.n3d()):
             point = (sec.x3d(i), sec.y3d(i))
             dx = (rel_origin[0] + math.cos(theta) *
                   (point[0] - rel_origin[0]) - math.sin(theta) *
                   (point[1] - rel_origin[1]))
             dy = (rel_origin[1] + math.sin(theta) *
                   (point[0] - rel_origin[0]) + math.cos(theta) *
                   (point[1] - rel_origin[1]))
             new_point = (dx, dy)
             h.pt3dchange(i, dx, dy, 0, sec.diam3d(i), sec=sec)
Ejemplo n.º 19
0
def modify_morphology(section_dict, cellname):

    for key, sec_list in section_dict.items():
        for sec in sec_list:
            sec.nseg = 11

    for sec in section_dict['basal']:
        for i in xrange(int(nrn.n3d())):
            nrn.pt3dchange(i, 0.76)

    for sec in section_dict['oblique_dendrites']:
        for i in xrange(int(nrn.n3d())):
            nrn.pt3dchange(i, 0.73)

    if cellname == 'n120':
        apic_root_segment = 'apic[9]'
    elif cellname == 'c12861':
        apic_root_segment = 'apic[92]'
    else:
        raise RuntimeError("Not known cellname!")

    nrn.distance()
    apic_tuft_root_diam = None
    apic_tuft_root_dist = None

    for sec in section_dict['apic_trunk']:
        npts = int(nrn.n3d())
        cummulative_L = 0
        for i in xrange(npts):
            if not i == 0:
                delta_x = (nrn.x3d(i) - nrn.x3d(i - 1))**2
                delta_y = (nrn.y3d(i) - nrn.y3d(i - 1))**2
                delta_z = (nrn.z3d(i) - nrn.z3d(i - 1))**2
                cummulative_L += np.sqrt(delta_x + delta_y + delta_z)
            dist_from_soma = nrn.distance(0) + cummulative_L
            diam = 3.5 - 4.7e-3 * dist_from_soma
            # print diam, nrn.diam3d(i)
            nrn.pt3dchange(i, diam)
        if sec.name() == apic_root_segment:
            apic_tuft_root_diam = nrn.diam3d(npts - 1)
            apic_tuft_root_dist = nrn.distance(1.)

    longest_tuft_branch = find_longest_tuft_branch(section_dict, apic_tuft_root_dist)

    tuft_smallest_diam = 0.3
    for sec in section_dict['apic_tuft']:
        npts = int(nrn.n3d())
        cummulative_L = 0
        start_dist_from_tuft_root = nrn.distance(0.0) - apic_tuft_root_dist
        for i in xrange(npts):
            if not i == 0:
                delta_x = (nrn.x3d(i) - nrn.x3d(i - 1))**2
                delta_y = (nrn.y3d(i) - nrn.y3d(i - 1))**2
                delta_z = (nrn.z3d(i) - nrn.z3d(i - 1))**2
                cummulative_L += np.sqrt(delta_x + delta_y + delta_z)
            dist_from_root = start_dist_from_tuft_root + cummulative_L
            diam = apic_tuft_root_diam - dist_from_root/longest_tuft_branch * (apic_tuft_root_diam - tuft_smallest_diam)
            # print nrn.diam3d(i), diam
            nrn.pt3dchange(i, diam, sec=sec)
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         # note: iterating like this changes the context for all NEURON
         # functions that depend on a section, so no need to specify sec=
         for i in range(int(h.n3d())):
             h.pt3dchange(i,
                     x - self.x + h.x3d(i),
                     y - self.y + h.y3d(i),
                     z - self.z + h.z3d(i),
                     h.diam3d(i))
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 21
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     for sec in self.all:
         for i in range(int(h.n3d(sec=sec))):
             x = h.x3d(i, sec=sec)
             y = h.y3d(i, sec=sec)
             c = cos(theta)
             s = sin(theta)
             xprime = x * c - y * s
             yprime = x * s + y * c
             h.pt3dchange(i,
                          xprime,
                          yprime,
                          h.z3d(i, sec=sec),
                          h.diam3d(i, sec=sec),
                          sec=sec)
Ejemplo n.º 22
0
 def rotateZ(self, theta):
     """Rotate the cell about the Z axis."""
     for sec in self.all:
         for i in range(sec.n3d()):
             x = sec.x3d(i)
             y = sec.y3d(i)
             c = cos(theta)
             s = sin(theta)
             xprime = x * c - y * s
             yprime = x * s + y * c
             h.pt3dchange(i,
                          xprime,
                          yprime,
                          sec.z3d(i),
                          sec.diam3d(i),
                          sec=sec)
Ejemplo n.º 23
0
 def move(self, xyz, move_mlab=False):
     """ Move visualization and cell """
     from neuron import h
     if move_mlab:
         if self.mlab_cell:
             self.mlab_cell.mlab_source.x = self.mlab_cell.mlab_source.x + xyz[0]
             self.mlab_cell.mlab_source.y = self.mlab_cell.mlab_source.y + xyz[1]
             self.mlab_cell.mlab_source.z = self.mlab_cell.mlab_source.z + xyz[2]
     tree = h.SectionList()
     tree.wholetree(sec=self.root)
     for sec in tree:
         for ii in xrange(h.n3d(sec=sec).__int__()):
             x=h.x3d(ii,sec=sec)
             y=h.y3d(ii,sec=sec)
             z=h.z3d(ii,sec=sec)
             d=h.diam3d(ii,sec=sec)
             h.pt3dchange(ii,x+float(xyz[0]),y+float(xyz[1]),z+float(xyz[2]),d)
Ejemplo n.º 24
0
def modify_morphology(apic_trunk, basal, apic_tuft):

    for sec in basal:
        for i in xrange(int(nrn.n3d())):
            nrn.pt3dchange(i, 0.76)

    nrn.distance()
    apic_tuft_root_diam = None
    apic_tuft_root_dist = None
    for sec in apic_trunk:

        npts = int(nrn.n3d())
        cummulative_L = 0
        for i in xrange(npts - 1):
            delta_x = (nrn.x3d(i + 1) - nrn.x3d(i))**2
            delta_y = (nrn.y3d(i + 1) - nrn.y3d(i))**2
            delta_z = (nrn.z3d(i + 1) - nrn.z3d(i))**2
            cummulative_L += np.sqrt(delta_x + delta_y + delta_z)
            diam = 3.5 - 4.7e-3 * cummulative_L
            nrn.pt3dchange(i, diam, sec=sec)

        apic_tuft_root_diam = nrn.diam3d(npts - 1)
        apic_tuft_root_dist = cummulative_L


    # THE FOLLOWING RETURNS NEGATIVE PARAMETERS!
    # for sec in nrn.somatic:
    #     if sec.name() == 'soma[2]':
    #         nrn.distance(0, 1)
    # for sec in apic_tuft:
    #
    #     npts = int(nrn.n3d())
    #     cummulative_L = 0
    #     start_dist_from_soma = nrn.distance(0)
    #     start_dist_from_tuft_root = start_dist_from_soma - apic_tuft_root_dist
    #     for i in xrange(npts - 1):
    #         delta_x = (nrn.x3d(i + 1) - nrn.x3d(i))**2
    #         delta_y = (nrn.y3d(i + 1) - nrn.y3d(i))**2
    #         delta_z = (nrn.z3d(i + 1) - nrn.z3d(i))**2
    #         cummulative_L += np.sqrt(delta_x + delta_y + delta_z)
    #         dist_from_root = start_dist_from_tuft_root + cummulative_L
    #         diam = apic_tuft_root_diam - 18e-3 * dist_from_root
    #         print diam, nrn.diam3d(i)
    #         # nrn.pt3dchange(i, diam, sec=sec)

    return apic_tuft_root_diam
Ejemplo n.º 25
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         sec.push()
         #print('secname = %s, h.n3d = %d' % (h.secname(), h.n3d()))
         for i in range(int(h.n3d())):
             h.pt3dchange(i,
                     x - self.x + h.x3d(i),
                     y - self.y + h.y3d(i),
                     z - self.z + h.z3d(i),
                     h.diam3d(i), sec=sec)
         h.pop_section()
     #h.define_shape()
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 26
0
 def set_position(self, x, y, z):
     """
     Set the base location in 3D and move all other
     parts of the cell relative to that location.
     """
     for sec in self.all:
         sec.push()
         #print('secname = %s, h.n3d = %d' % (h.secname(), h.n3d()))
         for i in range(int(h.n3d())):
             h.pt3dchange(i,
                          x - self.x + h.x3d(i),
                          y - self.y + h.y3d(i),
                          z - self.z + h.z3d(i),
                          h.diam3d(i),
                          sec=sec)
         h.pop_section()
     #h.define_shape()
     self.x, self.y, self.z = x, y, z
Ejemplo n.º 27
0
 def z_rotation(self, theta):
     """
         This method rotates the SimpleCell object in 3D space around the 
         z-axis by a user-specified number of degrees.
     """
     theta *= (pylab.pi / 180)
     for section in self.all:
         for point in range(int(h.n3d(sec=section))):
             xold = h.x3d(point, sec=section)
             yold = h.y3d(point, sec=section)
             xnew = xold * pylab.cos(theta) - yold * pylab.sin(theta)
             ynew = xold * pylab.sin(theta) + yold * pylab.cos(theta)
             h.pt3dchange(point,
                          xnew,
                          ynew,
                          h.z3d(point, sec=section),
                          h.diam3d(point, sec=section),
                          sec=section)
    def rotate(self, theta):
        """ Rotate neuron coordinates.
            theta = [thetax,thetay,thetaz]
        """
        from neuron import h
        from mytools.rotate_xyz import rotate_xyz

        tree = h.SectionList()
        tree.wholetree(sec=self.root)
        for sec in tree:
            for ii in xrange(h.n3d(sec=sec).__int__()):
                x = h.x3d(ii, sec=sec)
                y = h.y3d(ii, sec=sec)
                z = h.z3d(ii, sec=sec)
                d = h.diam3d(ii, sec=sec)

                xyz_out = rotate_xyz(theta, [x, y, z])

                h.pt3dchange(ii, float(xyz_out[0]), float(xyz_out[1]),
                             float(xyz_out[2]), d)
Ejemplo n.º 29
0
    def __set_3Dshape(self):
        # set 3D shape of soma by calling shape_soma from class Cell
        # print "WARNING: You are setting 3d shape geom. You better be doing"
        # print "gui analysis and not numerical analysis!!"
        self.shape_soma()

        # soma proximal coords
        x_prox = 0
        y_prox = 0

        # soma distal coords
        x_distal = 0
        y_distal = self.soma.L

        # dend 0-3 are major axis, dend 4 is branch
        # deal with distal first along major cable axis
        # the way this is assigning variables is ugly/lazy right now
        for i in range(0, 4):
            h.pt3dclear(sec=self.list_dend[i])

            # x_distal and y_distal are the starting points for each segment
            # these are updated at the end of the loop
            sec=self.list_dend[i]
            h.pt3dadd(0, y_distal, 0, sec.diam, sec=sec)

            # update x_distal and y_distal after setting them
            # x_distal += dend_dx[i]
            y_distal += sec.L

            # add next point
            h.pt3dadd(0, y_distal, 0, sec.diam, sec=sec)

        # now deal with dend 4
        # dend 4 will ALWAYS be positioned at the end of dend[0]
        h.pt3dclear(sec=self.list_dend[4])

        # activate this section with 'sec=self.list_dend[i]' notation
        x_start = h.x3d(1, sec=self.list_dend[0])
        y_start = h.y3d(1, sec=self.list_dend[0])

        sec=self.list_dend[4]
        h.pt3dadd(x_start, y_start, 0, sec.diam, sec=sec)
        # self.dend_L[4] is subtracted because lengths always positive,
        # and this goes to negative x
        h.pt3dadd(x_start-sec.L, y_start, 0, sec.diam, sec=sec)

        # now deal with proximal dends
        for i in range(5, 8):
            h.pt3dclear(sec=self.list_dend[i])

        # deal with dend 5, ugly. sorry.
        sec=self.list_dend[5]
        h.pt3dadd(x_prox, y_prox, 0, sec.diam, sec=sec)
        y_prox += -sec.L

        h.pt3dadd(x_prox, y_prox, 0, sec.diam,sec=sec)

        # x_prox, y_prox are now the starting points for BOTH of last 2 sections
        # dend 6
        # Calculate x-coordinate for end of dend
        sec=self.list_dend[6]
        dend6_x = -sec.L * np.sqrt(2) / 2.
        h.pt3dadd(x_prox, y_prox, 0, sec.diam, sec=sec)
        h.pt3dadd(dend6_x, y_prox-sec.L * np.sqrt(2) / 2.,
                    0, sec.diam, sec=sec)

        # dend 7
        # Calculate x-coordinate for end of dend
        sec=self.list_dend[7]
        dend7_x = sec.L * np.sqrt(2) / 2.
        h.pt3dadd(x_prox, y_prox, 0, sec.diam, sec=sec)
        h.pt3dadd(dend7_x, y_prox-sec.L * np.sqrt(2) / 2.,
                    0, sec.diam, sec=sec)

        # set 3D position
        # z grid position used as y coordinate in h.pt3dchange() to satisfy
        # gui convention that y is height and z is depth. In h.pt3dchange()
        # x and z components are scaled by 100 for visualization clarity
        self.soma.push()
        for i in range(0, int(h.n3d())):
            h.pt3dchange(i, self.pos[0]*100 + h.x3d(i), -self.pos[2] + h.y3d(i),
                           self.pos[1] * 100 + h.z3d(i), h.diam3d(i))

        h.pop_section()
Ejemplo n.º 30
0
    if advance_count % save_every == 0:
        values.append([seg.v for seg in segs])
    advance_count += 1
    print h.t

#
# now fatten everything up (so we can see it) and save the graphics
# note: handle the soma differently by scaling in all directions not just diam
#
scale = 5
import numpy
for sec in h.allsec():
    if 'soma' not in sec.name():
        for i in xrange(int(h.n3d(sec=sec))):
            d = h.diam3d(i, sec=sec)
            h.pt3dchange(i, d * scale, sec=sec)
    elif 'soma' in sec.name():
        x, y, z, diam = [], [], [], []
        for i in xrange(int(h.n3d(sec=sec))):
            x.append(h.x3d(i, sec=sec))
            y.append(h.y3d(i, sec=sec))
            z.append(h.z3d(i, sec=sec))
            diam.append(h.diam3d(i, sec=sec))
        h.pt3dclear(sec=sec)
        x, y, z, diam = scale * numpy.array(x), scale * numpy.array(y), scale * numpy.array(z), scale * numpy.array(diam)
        i = int(len(x) / 2)
        midptx, midpty, midptz = x[i], y[i], z[i]
        x -= midptx / 2.
        y -= midpty / 2.
        z -= midptz / 2.
        for xpt, ypt, zpt, diampt in zip(x, y, z, diam):
Ejemplo n.º 31
0
def setup_grcmorphology(i, pursections, x, y, z):
    if i > 3500:
        print 'i value is:', i
    cell = h.SMGrC2019()
    print 'grc here'
    h.define_shape()
    grcallsec = h.SectionList()
    grcallsec.wholetree(cell.soma[0])
    cell.soma[0].push()
    n = h.n3d(sec=cell.soma[0])
    xs = [h.x3d(i) for i in range(int(n))]
    ys = [h.y3d(i) for i in range(int(n))]
    zs = [h.z3d(i) for i in range(int(n))]
    ds = [h.diam3d(i) for i in range(int(n))]
    j = 0
    #sec.push()
    for a, b, c, d in zip(xs, ys, zs, ds):
        #print 'sec here is:', sec
        h.pt3dchange(j, a + x, b + y, c + z, d)
        j += 1
    h.define_shape()
    h.pop_section()
    for sec in pursections:
        xsecappend = []
        ysecappend = []
        zsecappend = []
        segstr = str(sec)
        #print 'segstr:', segstr
        segstr = segstr.split('.')
        if str(sec) == "axonAIS" or str(sec) == "axonmyelin" or str(
                sec) == "axonmyelin4" or str(sec) == "axonNOR3" or str(
                    sec) == "axoncoll2" or str(sec) == "axonmyelin3" or str(
                        sec) == "axoncoll" or str(sec) == "axonNOR2" or str(
                            sec
                        ) == "axonmyelin2" or str(sec) == "axonNOR" or str(
                            sec) == "axonAISK" or str(sec) == "axonAIS":
            segstr = str(sec)
            ext = "axon"
            segstr = segstr[:segstr.find(ext) + len(ext)]
            #print 'the section name here is axonAIS'
        #print 'before segstr[2] split', segstr
        else:
            segstr = segstr[2].split('[')
            segstr = ''.join([i for i in segstr[0] if not i.isdigit()])
        if segstr == 'bs':
            #print 'this section is dendrite', sec
            sec.push()
            for kj in range(int(h.n3d() - 1)):
                xsecappend.append(h.x3d(kj))
                #append_secX_list.append(h.x3d(h.n3d()-1))
                ysecappend.append(h.y3d(kj))
                #append_secY_list.append(h.y3d(h.n3d()-1))
                zsecappend.append(h.z3d(kj))
                purkallcoord = [sec.x3d(kj), sec.y3d(kj), sec.z3d(kj)]
                purkradius = (sec.diam / 2)
                for gsec in grcallsec:
                    gsegstr = str(gsec)
                    gsegstr = gsegstr.split('.')
                    gsegstr = gsegstr[1].split('[')
                    gsegid = gsegstr[1].split(']')
                    if gsegstr[0] == 'axon':
                        if gsegid > 1 and gsegid < 20:
                            for jj in range(int(gsec.n3d() - 1)):
                                gxmin = gsec.x3d(jj)
                                gymin = gsec.y3d(jj)
                                gzmin = gsec.z3d(jj)
                                grallcoord = [
                                    gsec.x3d(jj),
                                    gsec.y3d(jj),
                                    gsec.z3d(jj)
                                ]
                                dst = distance.euclidean(
                                    grallcoord, purkallcoord)
                                granradius = (gsec.diam / 2)
                                if dst < (purkradius + granradius):
                                    print 'probable connection'

                #append_secZ_list.append(h.z3d(h.n3d()-1))
            h.pop_section()
Ejemplo n.º 32
0
Archivo: cell1.py Proyecto: a1eko/lampy
 def position(self, x, y, z):
     soma.push()
     for i in range(h.n3d()):
         h.pt3dchange(i, x-self.x+h.x3d(i), y-self.y+h.y3d(i), z-self.z+h.z3d(i), h.diam3d(i))
     self.x = x; self.y = y; self.z = z
     h.pop_section()