def __init__(self, parent=None): super(SimWidget, self).__init__(parent) self.setupUi(self) self.colorEarth = '#009900' self.colorWater = '#27b6e9' self.timer = QTimer() self.time = 500 self.running = False fig = plt.figure() self.ax = fig.add_subplot(111) self.is_plot = False self.sim = Simulation() self.prov = load_provinces() self.countries = load_countries() #region Buttons self.worldMapBtn.clicked.connect(self.mapa_mundi) self.cubaMapBtn.clicked.connect(self.mapa_cuba) self.initialPopulationBtn.clicked.connect( self.on_initial_population_clicked) self.nextStepBtn.clicked.connect(self.on_next_step_clicked) self.simBtn.clicked.connect(self.on_sim_clicked) self.stopBtn.clicked.connect(self.on_stop_clicked) #endregion self.fill_header_table(self.tableWidget1) self.fill_header_table(self.tableWidget2)
fill='black', text=str(person.getName()), font=("Purisa", 10)) def inoculatePeople(self): self.master.after(2000, self.subInoculate) def infectPeople(self): self.time += 1 self.infectedListA, self.infectedListB = simulate.spreadInfection() A, B = simulate.getDict() self.master.after(1000, self.subInfect) self.moveVirus(A, B) simulate = Simulation() simulate.secureStart() clusterA = simulate.populationA.getClusters() clusterB = simulate.populationB.getClusters() populationA = simulate.populationA populationB = simulate.populationB targetA = simulate.Atargetlist targetB = simulate.Btargetlist infectListA = populationA.getLevelsOfInfection() infectListB = populationB.getLevelsOfInfection() root = gwaphics.Tk() app = Application(root) ButtonThing(root, app) app.createCanvas() app.graphSign()
mode = 1 start_x = -10 stop_x = 10 periodic_boundary_conditions = True gif_name = "test" time_start = 0 # time_stop = 2*np.pi time_stop = 1 delta_t = 1e-2 gamma = np.array( [-2 for i in range(int((time_stop - time_start) / delta_t + 1))]) sim = Simulation(x_start=start_x, x_stop=stop_x, number_of_psi=number_of_psi, number_of_spatial_dimensions=number_of_spatial_dimensions, nonlinear=True) NLSE = problems.NLSE(gamma, x_start=start_x, x_stop=stop_x, number_of_psi=number_of_psi, periodic=True) init_state = NLSE.get_stationary_state() init_state = 0.7 * np.exp(-NLSE.linspace**2 / 2) u = NLSE.get_u() p = NLSE.get_P() def shooting(x0):
# Variables (see Documentation for description) view = True # To turn on/off the use of SAP, go to Helpers/helpers.py and change the # global variable "SAP_PHYSICS" (defined after the import statements) to True/False. seed = "r@nd0M2" robot_number = 1 maxsteps = 10000 debug = 0 # begin debugging AFTER this timestep. 0 turns off debugging, change to 1 to debug w/ PDB comment = seed # seeding the simulation: turn this on to remove randomness in brain (for debugging) # behavior between runs will be identical. random.seed(seed) # Run the Simulation, input is the random seed Sim = Simulation() Sim.start(view, robot_number) # wrapped in a try/except block to catch errors and immediately begin # pdb at exception's location try: Sim.run_simulation(view, maxsteps, debug, comment) except: _, _, tb = sys.exc_info() traceback.print_exc() pdb.post_mortem(tb) # Display the simulation Sim.run_visualization() #SAP 2000 templates.sdb