Page 1 of 1

### Making a Nucleus

Posted: Sat Nov 30, 2019 9:36 am
Hi so in a previous post I mentioned that I had been defining a no go zone in the middle of my cells by creating a region with zero diffusion.
I can't get that to work, so next I have tried using h.pt3dremove() to "bite" a nucleus out of the cell. That doesn't work for me:

Code: Select all

``h.pt3dremove(int(x + nucleus0), 0, 0, math.sqrt((nr ** 2) - (x - a) ** 2) + b, sec=sec)``
it gave no errors, but I think I may have just been being silly. I don't think pt3dremove even has these arguments.
Can you think of a computationally easy way (with 3D models) to bite a chunk of cell out as a nucleus. i.e., nothing enters?
I guess it is fairly low priority!!!
Kind Regards

### Re: Making a Nucleus

Posted: Tue Feb 25, 2020 10:25 am
Sorry for the late response. A feature that was present for extracellular 3d (allowing voxels to have independent diffusion coefficients) was initially omitted form intracellular 3d. It has now been added (in the development branch; https://github.com/neuronsimulator/nrn). Using that it is possible to exclude a region in intracellular 3d by setting the diffusion coefficient to zero. For example;

Code: Select all

``````from neuron import h, rxd
from neuron.units import μm, ms, nM, mM, mV
from matplotlib import pyplot
import numpy as np
h.load_file('stdrun.hoc')

# model parameters
soma_diam = 20 * μm
nucleus_diam = 5 * μm
caDiff = 1 * μm**2/ms
dx = 0.25 * μm

# create a soma
soma = h.Section(name='soma')
soma.pt3dclear()
soma.pt3dadd(-10 * μm, 0, 0, 20 * μm)
soma.pt3dadd(10 * μm, 0, 0, 20 * μm)
soma.nseg = 11

def exclude(x, y, z, diam, value_outside, value_inside=0):
""" Function returns value_outside if outside the diameter otherwise
value_inside (defaults to zero)
"""

if x**2 + y**2 <= diam**2:
return value_inside
return value_outside

# use 3d solver
rxd.set_solve_type(dimension=3)

# Where? -- create the region
cyt = rxd.Region(soma, name='cyt', nrn_region='i', dx=dx)

# What? -- create the species
# initial difference in concentration with a cylinder where nothing
# diffuses
ca = rxd.Species(cyt, name='ca', charge=2,
d=lambda x,y,z: exclude(x, y, z, nucleus_diam, caDiff),
initial=lambda nd: 1.0 * mM if nd.y3d < 5 else 60 * nM)

h.finitialize(-70 * mV)

# plot concentrations averaged over depth
ax = pyplot.subplot(1,3,1)
pyplot.imshow(np.nanmean(ca.nodes.value_to_grid(),2), vmax=1, vmin=0)
pyplot.title('Ca at t=0ms')
pyplot.colorbar()
ax.axis('off')

h.continuerun(25)

ax = pyplot.subplot(1,3,2)
pyplot.imshow(np.nanmean(ca.nodes.value_to_grid(),2), vmax=1, vmin=0)
pyplot.title('Ca at t={0:1.2f}ms'.format(h.t))
pyplot.colorbar()
ax.axis('off')

h.continuerun(50)

ax = pyplot.subplot(1,3,3)
pyplot.imshow(np.nanmean(ca.nodes.value_to_grid(),2), vmax=1, vmin=0)
pyplot.title('Ca at t={0:1.2f}ms'.format(h.t))
pyplot.colorbar()
ax.axis('off')
pyplot.tight_layout()
pyplot.show()
`````` 