Ignore:
Timestamp:
Sep 8, 2008 9:10:57 AM (16 years ago)
Author:
Gervaise Alina <gervyh@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
6f4b71f
Parents:
d89f09b
Message:

creating a panel for model display

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fitting.py

    rd89f09b r1b07935d  
    7474        self.fit_panel.set_model_list(self.menu_mng.get_model_list()) 
    7575        owner.Bind(fitpage.EVT_MODEL_BOX,self._on_model_panel) 
     76        #owner.Bind(modelpage.EVT_MODEL_DRAW,self.draw_model) 
    7677       
    7778        return [(id, self.menu1, "Fitting"),(id2, menu2, "Model")] 
     
    154155                    name = 'Fit' 
    155156                try: 
    156                     page = self.fit_panel.add_page(name) 
     157                    page = self.fit_panel.add_fit_page(name) 
    157158                    page.set_data_name(item) 
    158159                    self.page_finder[page]= FitProblem() 
     
    219220            for name in pars: 
    220221                if result.pvec.__class__==numpy.float64: 
    221                     model.model.setParam(name,result.pvec) 
     222                    model.setParam(name,result.pvec) 
    222223                else: 
    223                     model.model.setParam(name,result.pvec[i]) 
     224                    model.setParam(name,result.pvec[i]) 
    224225                    #print "fitting: i name out[i]", i,name,float(result.pvec[i]) 
    225226                    i += 1 
     
    255256                    print "fitting: fit in park fitting", p.name, p.value,p.stderr 
    256257                    model_name,param_name = self.split_string(p.name)   
    257                     print "fitting: simultfit",model.model.name,model_name,param_name ,p.name,param_name,p.value 
    258                     if model.model.name == model_name: 
     258                    print "fitting: simultfit",model.name,model_name,param_name ,p.name,param_name,p.value 
     259                    if model.name == model_name: 
    259260                        print "fitting: hello",p.name,param_name,p.value 
    260261                        small_out.append(p.value ) 
    261262                        small_cov.append(p.stderr) 
    262                         model.model.setParam(param_name,p.value)    
     263                        model.setParam(param_name,p.value)    
    263264                #print "fitting: out of each page",page,small_out,small_cov,data.group_id 
    264265                page.onsetValues(result.fitness, small_out,small_cov) 
     
    408409                    #print "fitter",self.fitter 
    409410                    #print "fitting: model name",model.name 
    410                     self.fitter.set_model(model,model.model.name, self.id, pars)  
     411                    self.fitter.set_model(Model(model),model.name, self.id, pars)  
    411412                    self.fitter.set_data(data,self.id,qmin,qmax) 
    412413                else: 
     
    455456            self.page_finder[current_pg].set_theory("Fitness") 
    456457            #print "on model",model.name 
    457             self.page_finder[current_pg].set_model(Model(model),M_name) 
     458            self.page_finder[current_pg].set_model(model,M_name) 
    458459            self.plot_helper(currpage= current_pg,qmin= None,qmax= None) 
    459460            sim_page.add_model(self.page_finder) 
     
    503504                try: 
    504505                    tempx = qmin 
    505                     tempy = model.eval(qmin) 
     506                    tempy = model.run(qmin) 
    506507                    theory.x.append(tempx) 
    507508                    theory.y.append(tempy) 
     
    514515                        if data.x[i]> qmin and data.x[i]< qmax: 
    515516                            tempx = data.x[i] 
    516                             tempy = model.eval(tempx) 
     517                            tempy = model.run(tempx) 
    517518                             
    518519                            theory.x.append(tempx)  
     
    523524                try: 
    524525                    tempx = qmax 
    525                     tempy = model.eval(qmax) 
     526                    tempy = model.run(qmax) 
    526527                    theory.x.append(tempx) 
    527528                    theory.y.append(tempy) 
     
    542543            Plot a theory from a model selected from the menu 
    543544        """ 
     545        #name = evt.model.__class__.__name__ 
     546        name="Model View" 
     547        self.fit_panel.add_model_page(evt.model,name)        
     548        self.draw_model(evt.model) 
     549         
     550    def draw_model(self,model): 
    544551        x = pylab.arange(0.001, 0.1, 0.001) 
    545552        xlen = len(x) 
     
    548555         
    549556        for i in range(xlen): 
    550             y[i] = evt.model.run(x[i]) 
     557            y[i] = model.run(x[i]) 
    551558            dy[i] = math.sqrt(math.fabs(y[i])) 
    552559        try: 
     
    562569            print "SimView.complete1D: could not import sans.guicomm.events" 
    563570 
    564  
    565571if __name__ == "__main__": 
    566572    i = Plugin() 
Note: See TracChangeset for help on using the changeset viewer.