overalT = 0. stop = False ############################################################################### seed_gen = TrialSeedGenerator(int(o.master_seed)) for trial_idx in range(o.ntrials): seed_gen.set_generators(trial_idx) # Each trial is reproducible d['master_seed'] = int(o.master_seed) d['invalidated'] = 1 const_v = [0.0, -o.Ivel] ei_net = ConstantVelocityNetwork(o, simulationOpts=None, vel=const_v) d['net_params'] = ei_net.getNetParams() # Common settings will stay try: ei_net.simulate(o.time, printTime=o.printTime) except NESTError as e: print("Simulation interrupted. Message: {0}".format(str(e))) print("Not saving the data. Trying to clean up if possible...") stop = True ei_net.endSimulation() d['trials'].append(ei_net.getAllData()) d.flush() constrT, simT, totalT = ei_net.printTimes() overalT += totalT if stop: break d.close() print("Script total run time: {0} s".format(overalT)) ###############################################################################
overalT = 0. stop = False ############################################################################### seed_gen = TrialSeedGenerator(int(o.master_seed)) for trial_idx in range(o.ntrials): seed_gen.set_generators(trial_idx) # Each trial is reproducible d['master_seed'] = int(o.master_seed) d['invalidated'] = 1 const_v = [-o.Ivel, 0.0] ei_net = ConstantVelocityNetwork(o, simulationOpts=None, vel=const_v) d['net_params'] = ei_net.getNetParams() # Common settings will stay try: ei_net.simulate(o.time, printTime=o.printTime) except NESTError as e: print("Simulation interrupted. Message: {0}".format(str(e))) print("Not saving the data. Trying to clean up if possible...") stop = True ei_net.endSimulation() d['trials'].append(ei_net.getAllData()) d.flush() constrT, simT, totalT = ei_net.printTimes() overalT += totalT if stop: break d.close() print("Script total run time: {0} s".format(overalT)) ###############################################################################
d['invalidated'] = 1 const_v = velocities[trial_idx] startPos = borders[trial_idx][0] ei_net = ConstantVelocityNetwork(o, simulationOpts=None, vel=const_v, startPos=startPos) d['net_params'] = ei_net.getNetParams() # Common settings will stay # create border cell (unconnected) ei_net.create_border_cells(borders, N_per_border=1) try: ei_net.simulate(o.time, printTime=o.printTime) except NESTError as e: print("Simulation interrupted. Message: {0}".format(str(e))) print("Not saving the data. Trying to clean up if possible...") stop = True ei_net.endSimulation() # get simulation data sim_data = ei_net.getAllData() # add connection matrices sim_data['connections'] = ei_net.getConnections() # save simulation data d['trials'].append(sim_data) d.flush() constrT, simT, totalT = ei_net.printTimes() overalT += totalT if stop: break d.close() print("Script total run time: {0} s".format(overalT)) ###############################################################################