def run_simulation(widget): frame.set_attributes("sim_responce", visible=False) clear_output() pyplot.close("all") sn1a_map = {"Power law":"power_law", "Gaussian":"gauss","Exponential":"exp","Maoz12":"maoz"} mgal = float(frame.get_attribute("mass_gas", "value")) iniZ = float(frame.get_attribute("init_Z", "value")) imf_type = frame.get_attribute("imf_type", "value") alphaimf = frame.get_attribute("imf_alpha", "value") mass_min = float(frame.get_attribute("imf_mass_min", "value")) mass_max = float(frame.get_attribute("imf_mass_max", "value")) imf_bdys = [mass_min, mass_max] sn1a_on = frame.get_attribute("use_sn1a", "value") sn1a_rate = sn1a_map[frame.get_attribute("sn1a_rates", "value")] dt = float(frame.get_attribute("dt", "value")) tend = float(frame.get_attribute("t_end", "value")) yield_table = frame.get_attribute("yield_table_list", "value") if not (imf_type in ['salpeter', 'chabrier', 'kroupa', 'alphaimf']): destination = os.environ["SYGMADIR"] + "/imf_input.py" shutil.copy(custom_imf_dir + imf_type + ".py", destination) imf_type = "input" run_count = frame.get_state_data("run_count") name = frame.get_attribute("run_name", "value") if name == "": name = "Run - "+"%03d" % (run_count + 1, ) if iniZ==0.0: data=s.sygma(mgal=mgal, iniZ=iniZ, imf_type=imf_type, alphaimf=alphaimf, imf_bdys=[10.1, 100.0], imf_bdys_pop3=imf_bdys, sn1a_on=sn1a_on, sn1a_rate=sn1a_rate, dt=dt,tend=tend, table=yield_table) else: data=s.sygma(mgal=mgal, iniZ=iniZ, imf_type=imf_type, alphaimf=alphaimf, imf_bdys=imf_bdys, sn1a_on=sn1a_on, sn1a_rate=sn1a_rate, dt=dt,tend=tend, table=yield_table) frame.set_state("run_sim") ##force reset plottype frame.set_attributes("plot_type", selected_label="Species mass", value="Species mass") frame.set_attributes("plot_type", selected_label="Total mass", value="Total mass") add_run(data, name, iniZ) frame.update()
def run_simulation(widget): frame.set_attributes("sim_responce", visible=False) clear_output() pyplot.close("all") sn1a_map = { "Power law": "power_law", "Gaussian": "gauss", "Exponential": "exp", "Maoz12": "maoz" } mgal = float(frame.get_attribute("mass_gas", "value")) iniZ = float(frame.get_attribute("init_Z", "value")) imf_type = frame.get_attribute("imf_type", "value") alphaimf = frame.get_attribute("imf_alpha", "value") mass_min = float(frame.get_attribute("imf_mass_min", "value")) mass_max = float(frame.get_attribute("imf_mass_max", "value")) imf_bdys = [mass_min, mass_max] sn1a_on = frame.get_attribute("use_sn1a", "value") sn1a_rate = sn1a_map[frame.get_attribute("sn1a_rates", "value")] dt = float(frame.get_attribute("dt", "value")) tend = float(frame.get_attribute("t_end", "value")) yield_table = frame.get_attribute("yield_table_list", "value") if not (imf_type in ['salpeter', 'chabrier', 'kroupa', 'alphaimf']): destination = os.environ["SYGMADIR"] + "/imf_input.py" shutil.copy(custom_imf_dir + imf_type + ".py", destination) imf_type = "input" run_count = frame.get_state_data("run_count") name = frame.get_attribute("run_name", "value") if name == "": name = "Run - " + "%03d" % (run_count + 1, ) if iniZ == 0.0: data = s.sygma(mgal=mgal, iniZ=iniZ, imf_type=imf_type, alphaimf=alphaimf, imf_bdys=[10.1, 100.0], imf_bdys_pop3=imf_bdys, sn1a_on=sn1a_on, sn1a_rate=sn1a_rate, dt=dt, tend=tend, table=yield_table) else: data = s.sygma(mgal=mgal, iniZ=iniZ, imf_type=imf_type, alphaimf=alphaimf, imf_bdys=imf_bdys, sn1a_on=sn1a_on, sn1a_rate=sn1a_rate, dt=dt, tend=tend, table=yield_table) frame.set_state("run_sim") ##force reset plottype frame.set_attributes("plot_type", selected_label="Species mass", value="Species mass") frame.set_attributes("plot_type", selected_label="Total mass", value="Total mass") add_run(data, name, iniZ) frame.update()
def run_sygma(self): import sygma as s s1 = s.sygma()