def load(widget): clear_output() data = None mass = float(frame.get_attribute("mass", "value")) Z = float(frame.get_attribute("Z", "value")) dir = frame.get_attribute("address_bar", "value") if frame.get_attribute("model_select", "value") != "": model = int(frame.get_attribute("model_select", "value")) else: model = 1 module = frame.get_attribute("select_module", "value") if module == "H5 out": if manual_data_select: data = mp.se(dir) else: data = mp.se(mass=mass, Z=Z) frame.set_state("nugrid_w_data") properties = ["mass", "radius", "rho", "temperature"] frame.set_attributes("xaxis", options=properties + data.se.isotopes) frame.set_attributes("yaxis", options=properties + data.se.isotopes) elif module == "History": if manual_data_select: data = ms.history_data(dir) else: data = ms.history_data(mass=mass, Z=Z) frame.set_state("mesa_w_data") frame.set_attributes("xaxis", options=sorted(data.cols.keys())) frame.set_attributes("yaxis", options=sorted(data.cols.keys())) elif module == "Profile": if manual_data_select: data = ms.mesa_profile(dir, num=model) else: data = ms.mesa_profile(mass=mass, Z=Z, num=model) frame.set_state("mesa_w_data") frame.set_attributes("xaxis", options=sorted(data.cols.keys())) frame.set_attributes("yaxis", options=sorted(data.cols.keys())) else: nugrid_or_mesa = frame.get_attribute("select_nugrid_mesa", 'value') if nugrid_or_mesa == "NuGrid": frame.set_state("nugrid") elif nugrid_or_mesa == "Mesa": frame.set_state("mesa") frame.set_state_data("class_instance", data) frame.set_attributes("select_plot", selected_label="")
def load(widget): clear_output() data = None mass = float(frame.get_attribute("mass", "value")) Z = float(frame.get_attribute("Z", "value")) dir = frame.get_attribute("address_bar", "value") if frame.get_attribute("model_select", "value") != "": model = int(frame.get_attribute("model_select", "value")) else: model = 1 module = frame.get_attribute("select_module", "value") if module == "H5 out": if manual_data_select: data = mp.se(dir) else: data = mp.se(mass=mass, Z=Z) frame.set_state("nugrid_w_data") properties = ["mass", "radius", "rho", "temperature"] frame.set_attributes("xaxis", options=properties+data.se.isotopes) frame.set_attributes("yaxis", options=properties+data.se.isotopes) elif module == "History": if manual_data_select: data = ms.history_data(dir) else: data = ms.history_data(mass=mass, Z=Z) frame.set_state("mesa_w_data") frame.set_attributes("xaxis", options=sorted(data.cols.keys())) frame.set_attributes("yaxis", options=sorted(data.cols.keys())) elif module == "Profile": if manual_data_select: data = ms.mesa_profile(dir, num=model) else: data = ms.mesa_profile(mass=mass, Z=Z, num=model) frame.set_state("mesa_w_data") frame.set_attributes("xaxis", options=sorted(data.cols.keys())) frame.set_attributes("yaxis", options=sorted(data.cols.keys())) else: nugrid_or_mesa = frame.get_attribute("select_nugrid_mesa", 'value') if nugrid_or_mesa == "NuGrid": frame.set_state("nugrid") elif nugrid_or_mesa == "Mesa": frame.set_state("mesa") frame.set_state_data("class_instance", data) frame.set_attributes("select_plot", selected_label="")
iso5='Ne-20 iso6='Si-28' iso7='Fe-56' iso8='Sr-86' iso9='Ba-136' iso10='Pb-206' # ~~~~~~~~~~~~~~~~ End global variables ~~~~~~~~~~~~~~~~ # # ~~~~~~~~~~~~~~~~ Start running code ~~~~~~~~~~~~~~~~ # plt.ioff() # turns off the live plot so that a new plot doesn't open each time the code loops m20=ns.se(filedir) # loads the H5_out files using nugridse.py i = 0 # The array number of the cycle you want to start with. i.e. If the cycle numbers go up in 20, Cycle 20 is '0' while i <= 4: # The array number of the cycle you want to end with. i.e. If the cycle numbers go up in 20, Cycle 100 is '4' # ~~~~~~~~~~~~~~~~ Start plot specific variables ~~~~~~~~~~~~~~~~ # cycletmp = m20.se.cycles[i].lstrip('0') # The current plots cycle number timetmp = '{:.2e}'.format(float(m20.se.ages[i])) # The current plots time stamp for YEARS #timetmp = '{:.2e}'.format(float(m20.se.ages[i])/31536000) # The current plot time stamp for SECONDS (uncomment one of the two) titletmp = 'Cycle = ' + cycletmp + ' Time= ' + str(timetmp) + ' years' # Plot title fnametmp = m20.se.cycles[i] # ~~~~~~~~~~~~~~~~ End plot specific variables ~~~~~~~~~~~~~~~~ #