def probes(self, gid): # Cell 0 has three voltage probes: # 0, 0: end of branch 1 # 0, 1: end of branch 2 # 0, 2: all terminal points # Values sampled from (0, 0) and (0, 1) should correspond # to the values sampled from (0, 2). # Cell 1 has whole cell probes: # 0, 0: all membrane voltages # 0, 1: all expsyn state variable 'g' if gid == 0: return [ A.cable_probe_membrane_voltage('(location 1 1)'), A.cable_probe_membrane_voltage('(location 2 1)'), A.cable_probe_membrane_voltage('(terminal)') ] elif gid == 1: return [ A.cable_probe_membrane_voltage_cell(), A.cable_probe_point_state_cell('expsyn', 'g') ] else: return []
def probes(self, gid): return [ arbor.cable_probe_membrane_voltage('"center"'), arbor.cable_probe_point_state(1, "expsyn_stdp", "g"), arbor.cable_probe_point_state(1, "expsyn_stdp", "apost"), arbor.cable_probe_point_state(1, "expsyn_stdp", "apre"), arbor.cable_probe_point_state(1, "expsyn_stdp", "weight_plastic") ]
def probes(self, gid): # Use keyword arguments to check that the wrappers have actually declared keyword arguments correctly. # Place single-location probes at (location 0 0.01*j) where j is the index of the probe address in # the returned list. return [ # probe id (0, 0) A.cable_probe_membrane_voltage(where='(location 0 0.00)'), # probe id (0, 1) A.cable_probe_membrane_voltage_cell(), # probe id (0, 2) A.cable_probe_axial_current(where='(location 0 0.02)'), # probe id (0, 3) A.cable_probe_total_ion_current_density(where='(location 0 0.03)'), # probe id (0, 4) A.cable_probe_total_ion_current_cell(), # probe id (0, 5) A.cable_probe_total_current_cell(), # probe id (0, 6) A.cable_probe_density_state(where='(location 0 0.06)', mechanism='hh', state='m'), # probe id (0, 7) A.cable_probe_density_state_cell(mechanism='hh', state='n'), # probe id (0, 8) A.cable_probe_point_state(target=0, mechanism='expsyn', state='g'), # probe id (0, 9) A.cable_probe_point_state_cell(mechanism='exp2syn', state='B'), # probe id (0, 10) A.cable_probe_ion_current_density(where='(location 0 0.10)', ion='na'), # probe id (0, 11) A.cable_probe_ion_current_cell(ion='na'), # probe id (0, 12) A.cable_probe_ion_int_concentration(where='(location 0 0.12)', ion='na'), # probe id (0, 13) A.cable_probe_ion_int_concentration_cell(ion='na'), # probe id (0, 14) A.cable_probe_ion_ext_concentration(where='(location 0 0.14)', ion='na'), # probe id (0, 15) A.cable_probe_ion_ext_concentration_cell(ion='na'), # probe id (0, 15) A.cable_probe_stimulus_current_cell() ]
def probes(self, gid): if gid < 3: return [] else: return [arbor.cable_probe_membrane_voltage('"midpoint"')]
decor.place('"axon_terminal"', arbor.spike_detector(-10), "detector") # Set cv_policy soma_policy = arbor.cv_policy_single('"soma"') dflt_policy = arbor.cv_policy_max_extent(1.0) policy = dflt_policy | soma_policy decor.discretization(policy) # Create a cell cell = arbor.cable_cell(morph, labels, decor) # (2) Declare a probe. probe = arbor.cable_probe_membrane_voltage('"custom_terminal"') # (3) Create a recipe class and instantiate a recipe class single_recipe(arbor.recipe): def __init__(self, cell, probes): # The base C++ class constructor must be called first, to ensure that # all memory in the C++ class is initialized correctly. arbor.recipe.__init__(self) self.the_cell = cell self.the_probes = probes self.the_cat = arbor.default_catalogue() self.the_cat.extend(arbor.allen_catalogue(), "")
def probes(self, gid): return [arbor.cable_probe_membrane_voltage('(location 0 0)')]
def probes(self, gid): return [arbor.cable_probe_membrane_voltage('"root"')]
parser.add_argument('--stimulus_amplitude', help="amplitude of stimulus in nA", type=float, default=1) parser.add_argument('--cv_policy_max_extent', help="maximum extent of control volume in μm", type=float, default=10) # parse the command line arguments args = parser.parse_args() # set up membrane voltage probes equidistantly along the dendrites probes = [ arbor.cable_probe_membrane_voltage(f'(location 0 {r})') for r in np.linspace(0, 1, 11) ] recipe = Cable(probes, **vars(args)) # create a default execution context and a default domain decomposition context = arbor.context() domains = arbor.partition_load_balance(recipe, context) # configure the simulation and handles for the probes sim = arbor.simulation(recipe, domains, context) dt = 0.001 handles = [ sim.sample((0, i), arbor.regular_schedule(dt)) for i in range(len(probes)) ]
# (4.4) Override the cell_description method return self.the_cell def probes(self, gid): # (4.5) Override the probes method return self.the_probes def global_properties(self, kind): # (4.6) Override the global_properties method return self.the_props # (5) Instantiate recipe with a voltage probe located on "midpoint". recipe = single_recipe(cell, [arbor.cable_probe_membrane_voltage('"midpoint"')]) # (6) Create a default execution context and a default domain decomposition. context = arbor.context() domains = arbor.partition_load_balance(recipe, context) # (7) Create and run simulation and set up 10 kHz (every 0.1 ms) sampling on the probe. # The probe is located on cell 0, and is the 0th probe on that cell, thus has probe_id (0, 0). sim = arbor.simulation(recipe, domains, context) sim.record(arbor.spike_recording.all) handle = sim.sample((0, 0), arbor.regular_schedule(0.1)) sim.run(tfinal=30) # (8) Collect results.
parser.add_argument('--stimulus_start', help="start of stimulus in ms", type=float, default=10) parser.add_argument('--stimulus_duration', help="duration of stimulus in ms", type=float, default=0.1) parser.add_argument('--stimulus_amplitude', help="amplitude of stimulus in nA", type=float, default=1) parser.add_argument('--cv_policy_max_extent', help="maximum extent of control volume in μm", type=float, default=10) # parse the command line arguments args = parser.parse_args() # set up membrane voltage probes equidistantly along the dendrites probes = [arbor.cable_probe_membrane_voltage( f'(location 0 {r})') for r in np.linspace(0, 1, 11)] recipe = Cable(probes, **vars(args)) # create a default execution context and a default domain decomposition context = arbor.context() domains = arbor.partition_load_balance(recipe, context) # configure the simulation and handles for the probes sim = arbor.simulation(recipe, domains, context) dt = 0.001 handles = [sim.sample((0, i), arbor.regular_schedule(dt)) for i in range(len(probes))] # run the simulation for 30 ms sim.run(tfinal=30, dt=dt)
default=0.001) parser.add_argument('--gj_g', help="gap junction conductivity in μS", type=float, default=0.01) parser.add_argument('--cv_policy_max_extent', help="maximum extent of control volume in μm", type=float) # parse the command line arguments args = parser.parse_args() # set up membrane voltage probes at the position of the gap junction probes = [arbor.cable_probe_membrane_voltage('"gj_site"')] recipe = TwoCellsWithGapJunction(probes, **vars(args)) # create a default execution context and a default domain decomposition context = arbor.context() domains = arbor.partition_load_balance(recipe, context) # configure the simulation and handles for the probes sim = arbor.simulation(recipe, domains, context) dt = 0.01 handles = [] for gid in [0, 1]: handles += [ sim.sample((gid, i), arbor.regular_schedule(dt)) for i in range(len(probes))
def cell_description(self, gid): # (4.4) Override the cell_description method return self.the_cell def probes(self, gid): # (4.5) Override the probes method return self.the_probes def global_properties(self, kind): # (4.6) Override the global_properties method return self.the_props # (5) Instantiate recipe with a voltage probe located on "midpoint". recipe = single_recipe(cell, [arbor.cable_probe_membrane_voltage('"midpoint"')]) # (6) Create a default execution context and a default domain decomposition. context = arbor.context() domains = arbor.partition_load_balance(recipe, context) # (7) Create and run simulation and set up 10 kHz (every 0.1 ms) sampling on the probe. # The probe is located on cell 0, and is the 0th probe on that cell, thus has probe_id (0, 0). sim = arbor.simulation(recipe, domains, context) sim.record(arbor.spike_recording.all) handle = sim.sample((0, 0), arbor.regular_schedule(0.1)) sim.run(tfinal=30) # (8) Collect results.
decor.place('"center"', arbor.iclamp(100, 300, value)) # Spike detection at center of soma. decor.place('"center"', arbor.spike_detector(-26)) #define CV policy and add it to decor #policy = arbor.cv_policy_every_segment('(all)') policy = arbor.cv_policy_fixed_per_branch(1, '(all)') #policy = arbor.cv_policy_max_extent(1.0) decor.discretization(policy) # (4) Create cell. dd1_cell = arbor.cable_cell(morph, labels, decor) # (5) Create probes for membrane voltage and calcium ion concentration. voltage_probe = arbor.cable_probe_membrane_voltage('"center"') ca_conc_probe = arbor.cable_probe_ion_int_concentration('"center"', "ca") # Instantiate recipe # Pass the probe in a list because that it what single_recipe expects. #recipe = single_recipe(dd1_cell, [voltage_probe]) #, ca_conc_probe]) recipe = single_recipe(dd1_cell, [voltage_probe, ca_conc_probe]) context = arbor.context() domains = arbor.partition_load_balance(recipe, context) sim = arbor.simulation(recipe, domains, context) # Instruct the simulation to record the spikes
# Label dictionary labels = arbor.label_dict() labels['centre'] = '(location 0 0.5)' # Decorations decor = arbor.decor() decor.set_property(Vm=-40) decor.paint('(all)', 'hh') decor.place('"centre"', arbor.iclamp(10, 2, 0.8)) decor.place('"centre"', arbor.spike_detector(-10)) cell = arbor.cable_cell(tree, labels, decor) # (3) Instantiate recipe with a voltage probe. recipe = single_recipe(cell, [arbor.cable_probe_membrane_voltage('"centre"')]) # (4) Instantiate simulation and set up sampling on probe id (0, 0). context = arbor.context() domains = arbor.partition_load_balance(recipe, context) sim = arbor.simulation(recipe, domains, context) sim.record(arbor.spike_recording.all) handle = sim.sample((0, 0), arbor.regular_schedule(0.1)) # (6) Run simulation for 30 ms of simulated activity and collect results. sim.run(tfinal=30) spikes = sim.spikes() data, meta = sim.samples(handle)[0]