def showUI(*args, **kwargs): if chimera.nogui: tk.Tk().withdraw() model = Model() global ui if not ui: ui = DummyDialog(*args, **kwargs) model.gui = ui controller = Controller(gui=ui, model=model) ui.enter()
def showUI(*args, **kwargs): if chimera.nogui: tk.Tk().withdraw() ui = QMSetupDialog(*args, **kwargs) model = Model(gui=ui) controller = Controller(gui=ui, model=model) ui.enter()
def showUI(): if chimera.nogui: tk.Tk().withdraw() global ui if not ui: ui = PoPMuSiCExtension() model = Model(gui=ui) controller = Controller(gui=ui, model=model) ui.enter()
def plot_ionization_(elem,model_lst,xlims=None): Zcolor=[ 'red','orangered','orange', 'yellow','yellowgreen','green', 'cyan', 'teal','blue','blueviolet'] Z = [-4.,-3.8,-3.6, -3.4,-3.2,-3.0,-2.8, -2.6,-2.4,-2.2] for i in to_plot[elem]: if xlims: l,u = observed[elem][i]["column"][0], observed[elem][i]["column"][2] if l==-30.: l=0. plt.fill( [xlims[0], xlims[1], xlims[1], xlims[0]], [l,l,u,u], '0.50', alpha=0.1) plt.axhline(y=u,linestyle='dashed',linewidth=2, color='k') for j in range(len(Z)): mods=[item for item in model_lst if Z[j]-0.05<float(item.data['Z'])<Z[j]+0.05] if len(mods)==0: print("skipping Z=%lf"%(Z[j])) continue U=[item.data['U'] for item in mods] N=Model.get_qty_lst(mods,elem,"column",i) #if elem=='Si': # N=[item+1.34 for item in N] #ISM to popII try: assert(len(N)>0 and len(U)>0) except AssertionError: print('N=',N) print('U=',U) raise plt.plot(U, N, 'o', color=Zcolor[j],label="Z="+str(Z[j])) plt.minorticks_on() plt.ylabel(r"log $N_{%s}$"%(elem+roman[i])) plt.xlabel(r"log U") plt.legend(loc='lower right', shadow=True,numpoints=1) plt.title('%s'%elem+roman[i]) plt.xlim(min(U),max(U)) plt.ylim(min(N)-1.,max(N)+1.) plt.show()
def showUI(callback=None, *args, **kwargs): """ Requested by Chimera way-of-doing-things """ if chimera.nogui: tk.Tk().withdraw() global ui if not ui: # Edit this to reflect the name of the class! ui = MMSetupDialog(*args, **kwargs) model = Model(gui=ui) controller = Controller(gui=ui, model=model) ui.enter() if callback: ui.addCallback(callback)
def __init__(self,name="Truss Model 01"): Model.__init__(self,name=name,mtype="truss") self.F = [] # Forces self.U = [] # Displacements self.dof = 2 # 2 DOF for truss element
def __init__(self,name="Spring Model 01"): Model.__init__(self,name=name,mtype="spring") self.F = {} # Forces self.U = {} # Displacements self.dof = 1 # 1 DOF per Node self.IS_KG_BUILDED = False
def __init__(self,name="Beam Model 01"): Model.__init__(self,name=name,mtype="beam") self.F = {} # Forces self.U = {} # Displacements self.dof = 2 # 2 DOF for beam element self.IS_KG_BUILDED = False
def __init__(self,name="Bar Model 01"): Model.__init__(self,name=name,mtype="bar") self.F = {} # Forces self.U = {} # Displacements self.dof = 1 # 1 DOF for bar element (per node) self.IS_KG_BUILDED = False
optimization.report() # Choose problem to solve problem_ids = [] ##problem_ids = range(0,230) ##problem_ids = chain(range(200,203), range(191, 193)) for problem_id in problem_ids: print(f"######### Solving problem {problem_id} #########") # Initialize the settings update_settings(problem_id) # Initialize the model model = Model() # Check computation setup build_surrogate = bool(settings["surrogate"]["surrogate"]) load_surrogate = settings["surrogate"]["surrogate"] == "load" train_from_data = settings["data"]["evaluator"] == "data" perform_optimization = bool(settings["optimization"]["algorithm"]) # Initialize if build_surrogate: surrogate = Surrogate(model) if perform_optimization: optimization = Optimization(model) # Perform computation # Surrogate only
def model(self, key): return Model(key)