# make VecStim vs_cell = VecStimCell("vecstim_cell") stim2 = vs_cell.make_vecstim(np.array([WARMUP+50])) # make synapses with spines syns_4p, heads = cell.add_synapses_with_spine(source=None, secs=cell.secs, number=100, netcon_weight=WEIGHT, mod_name="Syn4PAChDa", delay=1, **cell.params_4p_syn) for s, h in zip(syns_4p, heads): syn_ach = cell.add_synapse(source=stim1, mod_name="SynACh", seg=h(1.0), netcon_weight=0.1, delay=1) syn_da = cell.add_synapse(source=stim2, mod_name="SynDa", seg=h(1.0), netcon_weight=0.1, delay=1) cell.set_synaptic_pointers(s, syn_ach, syn_da) # add mechanisms cell.make_default_mechanisms() cell.make_apical_mechanisms(sections='head neck') # make plots rec_4psyn = Record(cell.filter_point_processes(mod_name="Syn4PAChDa", name="head[0]"), variables="w") # init and run sim = Simulation(init_v=-70, warmup=WARMUP) sim.run(runtime=200) # Event delivery syns_4p[0].make_event(10) sim.run(runtime=200) # plot rec_4psyn.plot()
from neuronpp.utils.record import Record from neuronpp.utils.simulation import Simulation path = os.path.dirname(os.path.abspath(__file__)) if __name__ == '__main__': # Prepare cell filepath = os.path.join(path, "..", "commons/mods/sigma3syn") cell = Cell("cell", compile_paths=filepath) soma = cell.add_sec("soma", diam=20, l=20, nseg=10) cell.insert('pas') cell.insert('hh') w = 0.003 # LTP #w = 0.0022 # LTD syn = cell.add_synapse(source=None, netcon_weight=w, seg=soma(0.5), mod_name="ExcSigma3Exp2Syn") # prepare plots and spike detector rec_v = Record(soma(0.5), variables="v") rec_w = Record(syn, variables="w") # run sim = Simulation(init_v=-68, warmup=5) syn.make_event(5) sim.run(runtime=50) # plot rec_w.plot() rec_v.plot()
soma = cell.filter_secs("soma") # Netstim to synapse stim = NetStimCell("stim").add_netstim(start=WARMUP, number=REPS, interval=interval) syn = cell.add_synapse(source=stim, netcon_weight=WEIGHT, mod_name="Syn4P", delay=1, seg=cell.filter_secs('apic[1]')(0.5)) # IClamp to soma iclamp = IClamp(segment=cell.filter_secs("soma")(0.5)) for i in range(REPS): start_t = WARMUP + delta_t + i * interval iclamp.stim(delay=start_t, dur=DUR, amp=AMP) # Record rec = Record([s(0.5) for s in cell.filter_secs("apic[1],apic[50]")]) # Run sim = Simulation(init_v=-70, warmup=WARMUP, dt=DT) total_time = REPS * interval + COOL_DOWN sim.run(total_time) # Plot rec.plot(position="merge") plt.show()
# 2) Recommended synapse syn1 = cell.add_synapse(source=stim, seg=soma(0.5), netcon_weight=0.01, mod_name="Syn4P", delay=1) # 3) Event synapse syn2 = cell.add_synapse(source=None, seg=soma(0.5), netcon_weight=0.01, mod_name="Syn4P", delay=1) # prepare plots rec_v = Record(soma(0.5), variables="v") # run sim = Simulation(init_v=-55, warmup=20) # Making external events to the synapse syn2.make_event(10) syn2.make_event(20) syn2.make_event(30) syn2.make_event(40) # Example of online update of the graph, however sim.run(runtime=1000) can be call in a single run for i in range(1000): sim.run(runtime=1) rec_v.plot(animate=True)
cell.group_synapses(tag="input_syn", synapses=[s, syn_ach, syn_da]) # add mechanisms cell.make_default_mechanisms() cell.make_apical_mechanisms(sections='dend head neck') soma = cell.filter_secs("soma") syns = cell.filter_synaptic_group() syn4p = syns[0]['Syn4PAChDa'] synach = syns[0]['SynACh'] rec_syn = Record(syn4p, variables="w stdp_ach ach_stdp ACh ACh_w") rec_soma = Record(soma(0.5), variables="v") sim = Simulation(init_v=-80, warmup=WARMUP, warmup_on_create=True) event = 0 inter = 5 for i in range(10): for syn in syns: syn['Syn4PAChDa'][0].make_event(event) syn['SynACh'][0].make_event(event) event += inter sim.run(runtime=150) # plot rec_soma.plot() rec_syn.plot()
spine_number=10, spine_secs_names="apic", spine_seed=13) soma = cell.filter_secs("soma") syns = cell.filter_complex_synapses(tag="combe") # Prepare STDP protocol stdp = Experiment() stdp.make_protocol("3xEPSP[int=10] 3xAP[int=10,dur=3,amp=1.6]", start=1, isi=10, epsp_synapse=syns[0], i_clamp_section=soma) # Prepare plots v_soma_rec = Record([soma(0.5), syns[0].parent], variables='v') cai_head0_rec = Record(syns[0].parent, variables='cai') # Run sim = Simulation(init_v=-70, warmup=20, with_neuron_gui=True, constant_timestep=False) sim.run(runtime=100, debug=True) # Plot cai_head0_rec.plot() v_soma_rec.plot() v_soma_rec.to_csv("vrec.csv")
cell.insert("hh") soma = cell.filter_secs("soma") dend = cell.filter_secs("apic[10]") syn = cell.add_synapse(source=None, mod_name="ExpSyn", seg=dend(0.5)) # Prepare EPSP and AP (IClamp) protocols experiment = Experiment(iti=40) experiment.add_epsp(num=3, synapse=syn, init=20, interval=20, weight=0.02) experiment.add_iclamp(num=3, segment=soma(0.5), init=60, interval=20, dur=3, amp=1.6) experiment.build() # Prepare plots rec = Record([soma(0.5), dend(0.5)], variables='v') # Run sim = Simulation(init_v=-70, warmup=20, with_neuron_gui=False, constant_timestep=True) sim.run(runtime=100) rec.plot() v_soma = rec.as_numpy('v', segment_name=soma(.5).name) v_dend = rec.as_numpy('v', segment_name=dend(.5).name)