def generate_date(period, amount): """ This function generates random data for given models. """ fps = 20 dT = 1 / fps model_name = ['Ball3D', 'RobotArm', 'SCARA', 'Unicycle'] human_start = [10, 0, 10, 0] robot_start = [1e5, 0, 1e5, 0] for k in range(amount): robot = RobotArm(SafeSet(), dT) human = HumanBall3D(MobileAgent(), dT, True) record = Record(period, dT, human.goals, robot.goals, human.x, robot.x) for i in range(fps * period): human.update(robot) human.move() if record.cnt < record.period * fps: record.human_moves[:, record.cnt] = human.x record.cnt = record.cnt + 1 record.human_achieved = human.goal_achieved save_data('simulate_data', 'data_', record)
if __name__ == '__main__': h.load_file('stdrun.hoc') # define cell cell = EbnerRxDCaSpineCell(name="cell") cell.load_morpho(filepath='morphologies/swc/my.swc', seg_per_L_um=1, add_const_segs=11) cell.add_spines(spine_number=10, head_nseg=10, neck_nseg=10, sections='dend') cell.add_soma_mechanisms() cell.add_apical_mechanisms(sections='dend head neck') cell.add_4p_ach_da_synapse(sec_names="head", loc=1) # add synapse at the top of each spine's head # Create stims s1 = NetStimCell("stim_cell") stim1 = s1.add_netstim("stim1", start=WARMUP + 1) stim2 = s1.add_netstim("stim2", start=WARMUP + 100) # stimulation cell.add_netcons(source=stim1, weight=WEIGHT, delay=1, pp_type_name="SynACh", sec_names="head[0][0]") cell.add_netcons(source=stim2, weight=WEIGHT, delay=1, pp_type_name="SynDa", sec_names="head[0][0]") # create plots rec_4psyn = Record(cell.filter_point_processes(pp_type_name="Syn4PAChDa", sec_names="head[0][0]"), variables="LTD_pre w") # init and run h.finitialize(-70 * mV) run_sim(runtime=500, warmup=WARMUP) # plot rec_4psyn.plot() plt.show()
# define cell cell = CellRxDCaSpineCellCellCell(name="cell") cell.load_morpho(filepath='morphologies/swc/my.swc', seg_per_L_um=1, add_const_segs=11) cell.add_spines(spine_number=10, head_nseg=10, neck_nseg=10, sections='dend') cell.add_rxd(rxd_obj=RxDCa(), sec_names="soma dend head neck") cell.add_rxd(rxd_obj=RxDpmca(), sec_names="soma dend head neck") cell.add_rxd(rxd_obj=RxDncx(), sec_names="head neck") # plots ps_cai = get_shape_plot(variable='cai', min_val=0, max_val=0.01) ps_v = get_shape_plot(variable='v', min_val=-70, max_val=40) rec = Record(cell.filter_secs("head[0]"), locs=1, variables='ica cai') # init and run h.finitialize(-65 * mV) # make_stim(cell) make_head_ca2_concentration(cell) h.cvode.re_init() run_sim(runtime=100, stepsize=0.1, init_sleep=3, delay_between_steps=50, plot_shapes=[ps_cai, ps_v]) rec.plot()
neck_nseg=10, sections='dend') cell.add_soma_mechanisms() cell.add_apical_mechanisms(sections='dend head neck') cell.add_4p_synapse(sec_names="head", loc=1) # add synapse at the top of each spine's head # stimulation stim = NetStimCell("stim_cell").add_netstim("stim1", start=WARMUP + 1, number=300, interval=1) cell.add_netcons(source=stim, weight=WEIGHT, delay=1) # create plots rec_w = Record(cell.filter_point_processes(pp_type_name="Syn4P", sec_names="head[0][0]"), variables="w") rec_v = Record(cell.filter_secs(sec_names="head[0]"), locs=1.0, variables="v") # init and run h.finitialize(-70 * mV) run_sim(runtime=500, warmup=WARMUP) # plot rec_w.plot() rec_v.plot() plt.show()