def cell_description(self, gid): """A high level description of the cell with global identifier gid. For example the morphology, synapses and ion channels required to build a multi-compartment neuron. """ assert gid == 0 tree = arbor.segment_tree() tree.append(arbor.mnpos, arbor.mpoint(0, 0, 0, self.radius), arbor.mpoint(self.length, 0, 0, self.radius), tag=1) labels = arbor.label_dict({'cable': '(tag 1)', 'start': '(location 0 0)'}) decor = arbor.decor() decor.set_property(Vm=self.Vm) decor.set_property(cm=self.cm) decor.set_property(rL=self.rL) decor.paint('"cable"', arbor.density(f'pas/e={self.Vm}', {'g': self.g})) decor.place('"start"', arbor.iclamp(self.stimulus_start, self.stimulus_duration, self.stimulus_amplitude), "iclamp") policy = arbor.cv_policy_max_extent(self.cv_policy_max_extent) decor.discretization(policy) return arbor.cable_cell(tree, labels, decor)
def test_place_pwlin_id(self): # Single branch, discontiguous segments. s0p = A.mpoint(0, 0, 0, 10) s0d = A.mpoint(1, 0, 0, 10) s1p = A.mpoint(3, 0, 0, 10) s1d = A.mpoint(4, 0, 0, 10) tree = A.segment_tree() i = tree.append(A.mnpos, s0p, s0d, 1) tree.append(i, s1p, s1d, 2) m = A.morphology(tree) place = A.place_pwlin(m) L0 = place.at(A.location(0, 0)) L0s = place.all_at(A.location(0, 0)) self.assertEqual(s0p, L0) self.assertEqual([s0p], L0s) Lhalf = place.at(A.location(0, 0.5)) Lhalfs = place.all_at(A.location(0, 0.5)) self.assertTrue(s0d == Lhalf or s1p == Lhalf) self.assertTrue([s0d, s1p] == Lhalfs) Chalf = [(s.prox, s.dist) for s in place.segments([A.cable(0, 0., 0.5)])] self.assertEqual([(s0p, s0d)], Chalf) Chalf_all = [(s.prox, s.dist) for s in place.all_segments([A.cable(0, 0., 0.5)])] self.assertEqual([(s0p, s0d), (s1p, s1p)], Chalf_all)
def cell_description(self, gid): tree = arbor.segment_tree() tree.append(arbor.mnpos, arbor.mpoint(-3, 0, 0, 3), arbor.mpoint(3, 0, 0, 3), tag=1) labels = arbor.label_dict({ 'soma': '(tag 1)', 'center': '(location 0 0.5)' }) decor = arbor.decor() decor.set_property(Vm=-40) decor.paint('(all)', arbor.density('hh')) decor.place('"center"', arbor.spike_detector(-10), "detector") decor.place('"center"', arbor.synapse('expsyn'), "synapse") mech = arbor.mechanism('expsyn_stdp') mech.set("max_weight", 1.) syn = arbor.synapse(mech) decor.place('"center"', syn, "stpd_synapse") cell = arbor.cable_cell(tree, labels, decor) return cell
def cell_description(self, gid): tree = arb.segment_tree() tree.append(arb.mnpos, arb.mpoint(-3, 0, 0, 3), arb.mpoint(3, 0, 0, 3), tag=1) decor = arb.decor() decor.place('(location 0 0.5)', arb.gap_junction_site(), "gj") return arb.cable_cell(tree, arb.label_dict(), decor)
def make_cable_cell(gid): # (1) Build a segment tree # https://docs.arbor-sim.org/en/latest/concepts/morphology.html tree = arbor.segment_tree() # Soma (tag=1) with radius 6 μm, modelled as cylinder of length 2*radius s = tree.append(arbor.mnpos, arbor.mpoint(-12, 0, 0, 6), arbor.mpoint(0, 0, 0, 6), tag=1) # Single dendrite (tag=3) of length 50 μm and radius 2 μm attached to soma. b0 = tree.append(s, arbor.mpoint(0, 0, 0, 2), arbor.mpoint(50, 0, 0, 2), tag=3) # Attach two dendrites (tag=3) of length 50 μm to the end of the first dendrite. # Radius tapers from 2 to 0.5 μm over the length of the dendrite. b1 = TODO # Constant radius of 1 μm over the length of the dendrite. b2 = TODO # Associate labels to tags # https://docs.arbor-sim.org/en/latest/concepts/labels.html labels = arbor.label_dict() labels['soma'] = '(tag 1)' labels['dend'] = '(tag 3)' # (2) Mark location for synapse at the midpoint of branch 1 (the first dendrite). # https://docs.arbor-sim.org/en/latest/concepts/labels.html labels['synapse_site'] = TODO # Mark the root of the tree. labels['root'] = TODO # (3) Create a decor and a cable_cell # https://docs.arbor-sim.org/en/latest/python/decor.html decor = arbor.decor() # Put hh dynamics on soma, and passive properties on the dendrites. decor.paint('"soma"', 'hh') decor.paint('"dend"', 'pas') # (4) Attach a single synapse. decor.place('"synapse_site"', 'expsyn', 'syn') # Attach a spike detector with threshold of -10 mV. decor.place(TODO) cell = arbor.cable_cell(tree, labels, decor) return cell
def test_mpoint(self): # Translations can be built from mpoints, and isometry can act upon mpoints. Radius is ignored. y90 = A.isometry.rotate(theta=math.pi / 2, axis=(0, 1, 0)) z90 = A.isometry.rotate(theta=math.pi / 2, axis=(0, 0, 1)) t123 = A.isometry.translate(A.mpoint(1, 2, 3, 20)) t456 = A.isometry.translate(A.mpoint(4, 5, 6, 30)) iso = t123 * z90 * t456 * y90 expected = N.array([[0, 0, 1, 5], [1, 0, 0, 7], [0, 1, 0, 9]]) self.assertTrue(N.isclose(as_matrix(iso), expected).all()) q = iso(A.mpoint(2, 3, 4, 10)) q_arr = N.array((q.x, q.y, q.z, q.radius)) q_expected = N.array([4 + 5, 2 + 7, 3 + 9, 10]) self.assertTrue(N.isclose(q_arr, q_expected).all())
def make_cable_cell(gid): # Build a segment tree tree = arbor.segment_tree() # Soma with radius 5 μm and length 2 * radius = 10 μm, (tag = 1) s = tree.append(arbor.mnpos, arbor.mpoint(-10, 0, 0, 5), arbor.mpoint(0, 0, 0, 5), tag=1) # Single dendrite with radius 2 μm and length 40 μm, (tag = 2) b = tree.append(s, arbor.mpoint(0, 0, 0, 2), arbor.mpoint(40, 0, 0, 2), tag=2) # Label dictionary for cell components labels = arbor.label_dict() labels['soma'] = '(tag 1)' labels['dend'] = '(tag 2)' # Mark location for synapse site at midpoint of dendrite (branch 0 = soma + dendrite) labels['synapse_site'] = '(location 0 0.6)' # Gap junction site at connection point of soma and dendrite labels['gj_site'] = '(location 0 0.2)' # Label root of the tree labels['root'] = '(root)' # Paint dynamics onto the cell, hh on soma and passive properties on dendrite decor = arbor.decor() decor.paint('"soma"', arbor.density("hh")) decor.paint('"dend"', arbor.density("pas")) # Attach one synapse and gap junction each on their labeled sites decor.place('"synapse_site"', arbor.synapse('expsyn'), 'syn') decor.place('"gj_site"', arbor.junction('gj'), 'gj') # Attach spike detector to cell root decor.place('"root"', arbor.spike_detector(-10), 'detector') cell = arbor.cable_cell(tree, labels, decor) return cell
def make_cable_cell(gid): # (1) Build a segment tree tree = arbor.segment_tree() # Soma (tag=1) with radius 6 μm, modelled as cylinder of length 2*radius s = tree.append(arbor.mnpos, arbor.mpoint(-12, 0, 0, 6), arbor.mpoint(0, 0, 0, 6), tag=1) # Single dendrite (tag=3) of length 50 μm and radius 2 μm attached to soma. b0 = tree.append(s, arbor.mpoint(0, 0, 0, 2), arbor.mpoint(50, 0, 0, 2), tag=3) # Attach two dendrites (tag=3) of length 50 μm to the end of the first dendrite. # Radius tapers from 2 to 0.5 μm over the length of the dendrite. b1 = tree.append(b0, arbor.mpoint(50, 0, 0, 2), arbor.mpoint(50 + 50 / sqrt(2), 50 / sqrt(2), 0, 0.5), tag=3) # Constant radius of 1 μm over the length of the dendrite. b2 = tree.append(b0, arbor.mpoint(50, 0, 0, 1), arbor.mpoint(50 + 50 / sqrt(2), -50 / sqrt(2), 0, 1), tag=3) # Associate labels to tags labels = arbor.label_dict() labels['soma'] = '(tag 1)' labels['dend'] = '(tag 3)' # (2) Mark location for synapse at the midpoint of branch 1 (the first dendrite). labels['synapse_site'] = '(location 1 0.5)' labels['synapse_site2'] = '(location 1 0.5)' # Mark the root of the tree. labels['root'] = '(root)' # (3) Create a decor and a cable_cell decor = arbor.decor() # Put hh dynamics on soma, and passive properties on the dendrites. decor.paint('"soma"', 'hh') decor.paint('"dend"', 'pas') # (4) Attach a single synapse. decor.place('"synapse_site"', 'expsyn') decor.place('"synapse_site2"', 'expsyn') # Attach a spike detector with threshold of -10 mV. decor.place('"root"', arbor.spike_detector(-10)) cell = arbor.cable_cell(tree, labels, decor) return cell
def cable_cell(): # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm tree = arbor.segment_tree() tree.append( arbor.mnpos, arbor.mpoint(-3, 0, 0, 3), arbor.mpoint(3, 0, 0, 3), tag=1, ) # (2) Define the soma and its midpoint labels = arbor.label_dict({'soma': '(tag 1)', 'midpoint': '(location 0 0.5)'}) # (3) Create cell and set properties decor = arbor.decor() decor.set_property(Vm=-40) decor.paint('"soma"', arbor.density('hh')) decor.place('"midpoint"', arbor.iclamp( 10, 2, 0.8), "iclamp") decor.place('"midpoint"', arbor.spike_detector(-10), "detector") return arbor.cable_cell(tree, labels, decor)
def create_arbor_cell(cell, nl_network, gid): if cell.arbor_cell=='cable_cell': default_tree = arbor.segment_tree() radius = evaluate(cell.parameters['radius'], nl_network.parameters) if 'radius' in cell.parameters else 3 default_tree.append(arbor.mnpos, arbor.mpoint(-1*radius, 0, 0, radius), arbor.mpoint(radius, 0, 0, radius), tag=1) labels = arbor.label_dict({'soma': '(tag 1)', 'center': '(location 0 0.5)'}) labels['root'] = '(root)' decor = arbor.decor() v_init = evaluate(cell.parameters['v_init'], nl_network.parameters) if 'v_init' in cell.parameters else -70 decor.set_property(Vm=v_init) decor.paint('"soma"', cell.parameters['mechanism']) if gid==0: ic = arbor.iclamp( nl_network.parameters['input_del'], nl_network.parameters['input_dur'], nl_network.parameters['input_amp']) print_v("Stim: %s"%ic) decor.place('"center"', ic) decor.place('"center"', arbor.spike_detector(-10)) # (2) Mark location for synapse at the midpoint of branch 1 (the first dendrite). labels['synapse_site'] = '(location 0 0.5)' # (4) Attach a single synapse. decor.place('"synapse_site"', 'expsyn') default_cell = arbor.cable_cell(default_tree, labels, decor) print_v("Created a new cell for gid %i: %s"%(gid,cell)) print_v("%s"%(default_cell)) return default_cell
def cell_description(self, gid): """A high level description of the cell with global identifier gid. For example the morphology, synapses and ion channels required to build a multi-compartment neuron. """ assert gid in [0, 1] tree = arbor.segment_tree() tree.append(arbor.mnpos, arbor.mpoint(0, 0, 0, self.radius), arbor.mpoint(self.length, 0, 0, self.radius), tag=1) labels = arbor.label_dict({ 'cell': '(tag 1)', 'gj_site': '(location 0 0.5)' }) decor = arbor.decor() decor.set_property(Vm=self.Vms[gid]) decor.set_property(cm=self.cm) decor.set_property(rL=self.rL) # add a gap junction mechanism at the "gj_site" location and label that specific mechanism on that location "gj_label" junction_mech = arbor.junction('gj', {"g": self.gj_g}) decor.place('"gj_site"', junction_mech, 'gj_label') decor.paint('"cell"', arbor.density(f'pas/e={self.Vms[gid]}', {'g': self.g})) if self.cv_policy_max_extent is not None: policy = arbor.cv_policy_max_extent(self.cv_policy_max_extent) decor.discretization(policy) else: decor.discretization(arbor.cv_policy_single()) return arbor.cable_cell(tree, labels, decor)
def test_place_pwlin_isometry(self): # Single branch, discontiguous segments. s0p = A.mpoint(0, 0, 0, 10) s0d = A.mpoint(1, 0, 0, 10) s1p = A.mpoint(3, 0, 0, 10) s1d = A.mpoint(4, 0, 0, 10) tree = A.segment_tree() i = tree.append(A.mnpos, s0p, s0d, 1) tree.append(i, s1p, s1d, 2) m = A.morphology(tree) iso = A.isometry.translate(2, 3, 4) place = A.place_pwlin(m, iso) x0p = iso(s0p) x0d = iso(s0d) x1p = iso(s1p) x1d = iso(s1d) L0 = place.at(A.location(0, 0)) L0s = place.all_at(A.location(0, 0)) self.assertEqual(x0p, L0) self.assertEqual([x0p], L0s) Lhalf = place.at(A.location(0, 0.5)) Lhalfs = place.all_at(A.location(0, 0.5)) self.assertTrue(x0d == Lhalf or x1p == Lhalf) self.assertTrue([x0d, x1p] == Lhalfs) Chalf = [(s.prox, s.dist) for s in place.segments([A.cable(0, 0., 0.5)])] self.assertEqual([(x0p, x0d)], Chalf) Chalf_all = [(s.prox, s.dist) for s in place.all_segments([A.cable(0, 0., 0.5)])] self.assertEqual([(x0p, x0d), (x1p, x1p)], Chalf_all)
#!/usr/bin/env python3 import arbor import pandas, seaborn # You may have to pip install these. # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm # Build a segment tree tree = arbor.segment_tree() # Soma (tag = 0) with diameter 4.20119 μm, modelled as cylinder of height 4.20119 µm and radius 2.100595 µm # arbor.mpoint(x, y, z, radius) s0_0 = tree.append(arbor.mnpos, arbor.mpoint(-0.9, -231.95, 6.85, 4.20119 / 2), arbor.mpoint(-0.9, -227.74881, 6.85, 4.20119 / 2), tag=0) # describe Axon (tag=1) attached to soma # naming of segments ax_y with a = axon, x = number of axon segment, y = neuroML segment ID """" a0_7 = tree.append(s0_0, arbor.mpoint(-9.000000e-01, -2.319500e+02, 6.850000e+00, 0.78102493 / 2), arbor.mpoint(-9.000000e-01, -2.331500e+02, 7.700000e+00, 0.78102493/2), tag=1) a1_8 = tree.append(a0_7, arbor.mpoint(-9.000000e-01, -2.365500e+02, 1.020000e+01, 0.64031243 / 2), tag=1) a2_9 = tree.append(a1_8, arbor.mpoint(-9.000000e-01, -2.425500e+02, 1.470000e+01, 0.5744563 / 2), tag=1) a3_10 = tree.append(a2_9, arbor.mpoint(5.500000e-01, -2.436000e+02, 1.470000e+01, 0.5744563 / 2), tag=1) a4_11 = tree.append(a3_10, arbor.mpoint(2.900000e+00, -2.436000e+02, 1.470000e+01, 0.56568545 / 2), tag=1) a5_12 = tree.append(a4_11, arbor.mpoint(6.975000e+00, -2.435250e+02, 1.517500e+01, 0.622495 / 2), tag=1) a6_13 = tree.append(a5_12, arbor.mpoint(1.420000e+01, -2.421500e+02, 1.920000e+01, 0.5744563 / 2), tag=1) a7_14 = tree.append(a6_13, arbor.mpoint(1.792500e+01, -2.400500e+02, 2.560000e+01, 0.5408327 / 2), tag=1) a8_15 = tree.append(a7_14, arbor.mpoint(1.950000e+01, -2.378000e+02, 3.232500e+01, 0.60207975 / 2), tag=1) a9_16 = tree.append(a8_15, arbor.mpoint(1.792500e+01, -2.355500e+02, 3.907500e+01, 0.50497526 / 2), tag=1) a10_17 = tree.append(a9_16, arbor.mpoint(1.420000e+01, -2.334500e+02, 4.550000e+01, 0.5744563 / 2), tag=1) a11_18 = tree.append(a10_17, arbor.mpoint(6.975000e+00, -2.321000e+02, 4.952500e+01, 0.81547534 / 2), tag=1)
#!/usr/bin/env python3 import arbor import pandas, seaborn # You may have to pip install these. # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm tree = arbor.segment_tree() tree.append(arbor.mnpos, arbor.mpoint(-3, 0, 0, 3), arbor.mpoint(3, 0, 0, 3), tag=1) # (2) Define the soma and its center labels = arbor.label_dict({'soma': '(tag 1)', 'center': '(location 0 0.5)'}) # (3) Create cell and set properties cell = arbor.cable_cell(tree, labels) cell.set_properties(Vm=-40) cell.paint('"soma"', 'hh') cell.place('"center"', arbor.iclamp(10, 2, 0.8)) cell.place('"center"', arbor.spike_detector(-10)) # (4) Make single cell model. m = arbor.single_cell_model(cell) # (5) Attach voltage probe sampling at 10 kHz (every 0.1 ms). m.probe('voltage', '"center"', frequency=10000) # (6) Run simulation for 30 ms of simulated activity. m.run(tfinal=30)
import arbor import pandas, seaborn # You may have to pip install these. # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm tree = arbor.segment_tree() tree.append(arbor.mnpos, arbor.mpoint(-3, 0, 0, 3), arbor.mpoint(3, 0, 0, 3), tag=1) # (2) Define the soma and its center labels = arbor.label_dict({'soma': '(tag 1)', 'center': '(location 0 0.5)'}) # (3) Create cell and set properties cell = arbor.cable_cell(tree, labels) cell.set_properties(Vm=-40) cell.paint('"soma"', 'hh') cell.place('"center"', arbor.iclamp( 10, 2, 0.8)) cell.place('"center"', arbor.spike_detector(-10)) # (4) Make single cell model. m = arbor.single_cell_model(cell) # (5) Attach voltage probe sampling at 10 kHz (every 0.1 ms). m.probe('voltage', '"center"', frequency=10000) # (6) Run simulation for 30 ms of simulated activity. m.run(tfinal=30) # (7) Print spike times, if any. if len(m.spikes)>0: print('{} spikes:'.format(len(m.spikes))) for s in m.spikes:
# b4 # / # / # b1---b3 # / # / # s-------b0 # \ # \ # b2 # Start with a spherical soma with radius 6 μm, # approximated with a cylinder of: length = diameter = 12 μm. s = tree.append(arbor.mnpos, arbor.mpoint(-12, 0, 0, 6), arbor.mpoint(0, 0, 0, 6), tag=1) # Add the dendrite cables, labelling those closest to the soma "dendn", # and those furthest with "dendx" because we will set different electrical # properties for the two regions. labels = arbor.label_dict() labels['soma'] = '(tag 1)' labels['dendn'] = '(tag 5)' labels['dendx'] = '(tag 6)' b0 = tree.append(s, arbor.mpoint(0, 0, 0, 2), arbor.mpoint(100, 0, 0, 2),
last_dist = seg.dist sections += ']' string += '\n [{}],'.format(sections) string += ']\n' string += '{} = representation.make_morph(tmp)\n\n'.format(name) return string # Describe the morphologies mnpos = arbor.mnpos # The morphology used for all of the region/locset illustrations label_tree = arbor.segment_tree() label_tree.append(mnpos, mpoint(0, 0.0, 0, 2.0), mpoint(4, 0.0, 0, 2.0), tag=1) label_tree.append(0, mpoint(4, 0.0, 0, 0.8), mpoint(8, 0.0, 0, 0.8), tag=3) label_tree.append(1, mpoint(8, 0.0, 0, 0.8), mpoint(12, -0.5, 0, 0.8), tag=3) label_tree.append(2, mpoint(12, -0.5, 0, 0.8), mpoint(20, 4.0, 0, 0.4), tag=3) label_tree.append(3, mpoint(20, 4.0, 0, 0.4), mpoint(26, 6.0, 0, 0.2), tag=3) label_tree.append(2, mpoint(12, -0.5, 0, 0.5), mpoint(19, -3.0, 0, 0.5), tag=3) label_tree.append(5, mpoint(19, -3.0, 0, 0.5), mpoint(24, -7.0, 0, 0.2), tag=3) label_tree.append(5, mpoint(19, -3.0, 0, 0.5), mpoint(23, -1.0, 0, 0.2), tag=3) label_tree.append(7, mpoint(23, -1.0, 0, 0.2), mpoint(26, -2.0, 0, 0.2), tag=3) label_tree.append(mnpos, mpoint(0, 0.0, 0, 2.0), mpoint(-7, 0.0, 0, 0.4), tag=2) label_tree.append(9, mpoint(-7, 0.0, 0, 0.4), mpoint(-10, 0.0, 0, 0.4), tag=2) label_morph = arbor.morphology(label_tree)
def event_generators(self, gid): return [] # (12) Overrode the global_properties method def global_properties(self, gid): return self.the_props # (1) Define morphology of DD1 cell. # (1.1) Create a segment tree and add segments. tree = arbor.segment_tree() # Soma (tag = 0) with diameter 4.20119 μm, modelled as cylinder of height 4.20119 µm and radius 2.100595 µm # arbor.mpoint(x, y, z, radius) s0_0 = tree.append(arbor.mnpos, arbor.mpoint(-0.9, -231.95, 6.85, 4.20119 / 2), arbor.mpoint(-0.9, -227.74881, 6.85, 4.20119 / 2), tag=0) # describe Axon (tag=1) attached to soma # naming of segments ax_y with a = axon, x = number of axon segment, y = neuroML segment ID a0_7 = tree.append(s0_0, arbor.mpoint(-9.000000e-01, -2.319500e+02, 6.850000e+00, 0.78102493 / 2), arbor.mpoint(-9.000000e-01, -2.331500e+02, 7.700000e+00, 0.78102493 / 2), tag=1) a1_8 = tree.append(a0_7, arbor.mpoint(-9.000000e-01, -2.365500e+02, 1.020000e+01, 0.64031243 / 2), tag=1)
#!/usr/bin/env python3 import arbor import pandas, seaborn # You may have to pip install these. # (1) Create a morphology with a single (cylindrical) segment of length=diameter=6 μm # Build a segment tree tree = arbor.segment_tree() # Soma (tag = 0) with diameter 4.20119 μm, modelled as cylinder of height 4.20119 µm and radius 2.100595 µm # arbor.mpoint(x, y, z, radius) s0_0 = tree.append(arbor.mnpos, arbor.mpoint(-0.9, -231.95, 6.85, 4.20119), arbor.mpoint(-0.9, -227.74881, 6.85, 4.20119), tag=0) # describe Axon (tag=1) attached to soma # naming of segments ax_y with a = axon, x = number of axon segment, y = neuroML segment ID a0_7 = tree.append(s0_0, arbor.mpoint(-9.000000e-01, -2.319500e+02, 6.850000e+00, 0.78102493 / 2), arbor.mpoint(-9.000000e-01, -2.331500e+02, 7.700000e+00, 0.78102493/2), tag=1) a1_8 = tree.append(a0_7, arbor.mpoint(-9.000000e-01, -2.365500e+02, 1.020000e+01, 0.64031243 / 2), tag=1) a2_9 = tree.append(a1_8, arbor.mpoint(-9.000000e-01, -2.425500e+02, 1.470000e+01, 0.5744563 / 2), tag=1) a3_10 = tree.append(a2_9, arbor.mpoint(5.500000e-01, -2.436000e+02, 1.470000e+01, 0.5744563 / 2), tag=1) a4_11 = tree.append(a3_10, arbor.mpoint(2.900000e+00, -2.436000e+02, 1.470000e+01, 0.56568545 / 2), tag=1) a5_12 = tree.append(a4_11, arbor.mpoint(6.975000e+00, -2.435250e+02, 1.517500e+01, 0.622495 / 2), tag=1) a6_13 = tree.append(a5_12, arbor.mpoint(1.420000e+01, -2.421500e+02, 1.920000e+01, 0.5744563 / 2), tag=1) a7_14 = tree.append(a6_13, arbor.mpoint(1.792500e+01, -2.400500e+02, 2.560000e+01, 0.5408327 / 2), tag=1) a8_15 = tree.append(a7_14, arbor.mpoint(1.950000e+01, -2.378000e+02, 3.232500e+01, 0.60207975 / 2), tag=1) a9_16 = tree.append(a8_15, arbor.mpoint(1.792500e+01, -2.355500e+02, 3.907500e+01, 0.50497526 / 2), tag=1) a10_17 = tree.append(a9_16, arbor.mpoint(1.420000e+01, -2.334500e+02, 4.550000e+01, 0.5744563 / 2), tag=1) a11_18 = tree.append(a10_17, arbor.mpoint(6.975000e+00, -2.321000e+02, 4.952500e+01, 0.81547534 / 2), tag=1)
sections += 'Segment(({}, {}, {}), ({}, {}, {}), {})'.format(p.x, p.y, p.radius, d.x, d.y, d.radius, seg.tag) last_dist = seg.dist sections += ']' string += '\n [{}],'.format(sections) string += ']\n' string += '{} = representation.make_morph(tmp)\n\n'.format(name) return string # Describe the morphologies mnpos = arbor.mnpos # The morphology used for all of the region/locset illustrations label_tree = arbor.segment_tree() label_tree.append(mnpos, mpoint(0, 0.0, 0, 2.0), mpoint( 4, 0.0, 0, 2.0), tag=1) label_tree.append(0, mpoint(4, 0.0, 0, 0.8), mpoint( 8, 0.0, 0, 0.8), tag=3) label_tree.append(1, mpoint(8, 0.0, 0, 0.8), mpoint(12, -0.5, 0, 0.8), tag=3) label_tree.append(2, mpoint(12, -0.5, 0, 0.8), mpoint(20, 4.0, 0, 0.4), tag=3) label_tree.append(3, mpoint(20, 4.0, 0, 0.4), mpoint(26, 6.0, 0, 0.2), tag=3) label_tree.append(2, mpoint(12, -0.5, 0, 0.5), mpoint(19, -3.0, 0, 0.5), tag=3) label_tree.append(5, mpoint(19, -3.0, 0, 0.5), mpoint(24, -7.0, 0, 0.2), tag=3) label_tree.append(5, mpoint(19, -3.0, 0, 0.5), mpoint(23, -1.0, 0, 0.2), tag=3) label_tree.append(7, mpoint(23, -1.0, 0, 0.2), mpoint(26, -2.0, 0, 0.2), tag=3) label_tree.append(mnpos, mpoint(0, 0.0, 0, 2.0), mpoint(-7, 0.0, 0, 0.4), tag=2) label_tree.append(9, mpoint(-7, 0.0, 0, 0.4), mpoint(-10, 0.0, 0, 0.4), tag=2) label_morph = arbor.morphology(label_tree) # The label morphology with some gaps (at start of dendritic tree and remove the axon hillock) label_tree = arbor.segment_tree()
# (11) Override the event_generators method def event_generators(self, gid): return [] # (12) Overrode the global_properties method def global_properties(self, gid): return self.the_props # (1) Define morphology of DD1 cell. # (1.1) Create a segment tree and add segments. tree = arbor.segment_tree() # Soma (tag = 0) with diameter 4.20119 μm, modelled as cylinder of height 4.20119 µm and radius 2.100595 µm # arbor.mpoint(x, y, z, radius) s0_0 = tree.append(arbor.mnpos, arbor.mpoint(-0.9, -231.95, 6.85, 4.20119 / 2), arbor.mpoint(-0.9, -227.74881, 6.85, 4.20119 / 2), tag=0) # describe Axon (tag=1) attached to soma # naming of segments ax_y with a = axon, x = number of axon segment, y = neuroML segment ID a0_7 = tree.append(s0_0, arbor.mpoint(-9.000000e-01, -2.319500e+02, 6.850000e+00, 0.5918224163929164 / 2), arbor.mpoint(-9.000000e-01, -2.331500e+02, 7.700000e+00, 0.5918224163929164/2), tag=1) a1_8 = tree.append(a0_7, arbor.mpoint(-9.000000e-01, -2.365500e+02, 1.020000e+01, 0.5918224163929164 / 2), tag=1) a2_9 = tree.append(a1_8, arbor.mpoint(-9.000000e-01, -2.425500e+02, 1.470000e+01, 0.5918224163929164 / 2), tag=1) a3_10 = tree.append(a2_9, arbor.mpoint(5.500000e-01, -2.436000e+02, 1.470000e+01, 0.5918224163929164 / 2), tag=1) a4_11 = tree.append(a3_10, arbor.mpoint(2.900000e+00, -2.436000e+02, 1.470000e+01, 0.5918224163929164 / 2), tag=1) a5_12 = tree.append(a4_11, arbor.mpoint(6.975000e+00, -2.435250e+02, 1.517500e+01, 0.5918224163929164 / 2), tag=1) a6_13 = tree.append(a5_12, arbor.mpoint(1.420000e+01, -2.421500e+02, 1.920000e+01, 0.5918224163929164 / 2), tag=1) a7_14 = tree.append(a6_13, arbor.mpoint(1.792500e+01, -2.400500e+02, 2.560000e+01, 0.5918224163929164 / 2), tag=1) a8_15 = tree.append(a7_14, arbor.mpoint(1.950000e+01, -2.378000e+02, 3.232500e+01, 0.5918224163929164 / 2), tag=1) a9_16 = tree.append(a8_15, arbor.mpoint(1.792500e+01, -2.355500e+02, 3.907500e+01, 0.5918224163929164 / 2), tag=1) a10_17 = tree.append(a9_16, arbor.mpoint(1.420000e+01, -2.334500e+02, 4.550000e+01, 0.5918224163929164 / 2), tag=1) a11_18 = tree.append(a10_17, arbor.mpoint(6.975000e+00, -2.321000e+02, 4.952500e+01, 0.5918224163929164 / 2), tag=1)
def create_arbor_cell(self, cell, gid, pop_id, index): if cell.arbor_cell == "cable_cell": default_tree = arbor.segment_tree() radius = (evaluate(cell.parameters["radius"], self.nl_network.parameters) if "radius" in cell.parameters else 3) default_tree.append( arbor.mnpos, arbor.mpoint(-1 * radius, 0, 0, radius), arbor.mpoint(radius, 0, 0, radius), tag=1, ) labels = arbor.label_dict({ "soma": "(tag 1)", "center": "(location 0 0.5)" }) labels["root"] = "(root)" decor = arbor.decor() v_init = (evaluate(cell.parameters["v_init"], self.nl_network.parameters) if "v_init" in cell.parameters else -70) decor.set_property(Vm=v_init) decor.paint('"soma"', arbor.density(cell.parameters["mechanism"])) decor.place('"center"', arbor.spike_detector(0), "detector") for ip in self.input_info: if self.input_info[ip][0] == pop_id: print_v("Stim: %s (%s) being placed on %s" % (ip, self.input_info[ip], pop_id)) for il in self.input_lists[ip]: cellId, segId, fract, weight = il if cellId == index: if self.input_info[ip][ 1] == 'i_clamp': # TODO: remove hardcoding of this... ic = arbor.iclamp( self.nl_network.parameters["input_del"], self.nl_network.parameters["input_dur"], self.nl_network.parameters["input_amp"], ) print_v("Stim: %s on %s" % (ic, gid)) decor.place('"center"', ic, "iclamp") # (2) Mark location for synapse at the midpoint of branch 1 (the first dendrite). labels["synapse_site"] = "(location 0 0.5)" # (4) Attach a single synapse. decor.place('"synapse_site"', arbor.synapse("expsyn"), "syn") default_cell = arbor.cable_cell(default_tree, labels, decor) print_v("Created a new cell for gid %i: %s" % (gid, cell)) print_v("%s" % (default_cell)) return default_cell