Changeset 24cab5d in sasview
- Timestamp:
- Mar 26, 2009 5:53:12 PM (16 years ago)
- 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:
- 8f90cfd
- Parents:
- aed7c57
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r2140e68 r24cab5d 420 420 421 421 self.sizer3.Layout() 422 self.sizer4_4.Layout()422 #self.sizer4_4.Layout() 423 423 self.sizer4.Layout() 424 424 self.SetScrollbars(20,20,200,100) -
sansview/perspectives/fitting/fitting.py
rbb7d8a4 r24cab5d 452 452 if param_value !=None and param_name != None: 453 453 new_model.parameterset[ param_name].set( param_value ) 454 455 454 self.fitter.set_model(model= new_model, Uid=self.fit_id, pars=pars) 456 455 ## check that non -zero value are send as dy in the fit engine … … 564 563 qstep=qstep) 565 564 566 def _fit_helper(self, page, id ):565 def _fit_helper(self,current_pg, id ): 567 566 """ 568 567 helper for fitting … … 574 573 self.fit_id = id 575 574 page_fitted = None 576 577 575 pars=[] 576 value = self.page_finder[current_pg] 577 metadata = value.get_fit_data() 578 model = value.get_model() 579 smearer = value.get_smearer() 580 581 #Create list of parameters for fitting used 582 templist=[] 583 try: 584 ## get the list of parameter names to fit 585 templist = current_pg.get_param_list() 586 587 for element in templist: 588 pars.append(str(element[1])) 589 590 pars.sort() 591 ## create a park model and reset parameter value if constraint 592 ## is given 593 new_model = Model(model) 594 param = value.get_model_param() 595 if len(param)>0: 596 for item in param: 597 param_value = item[1] 598 param_name = item[0] 599 ## check if constraint 600 if param_value !=None and param_name != None: 601 new_model.parameterset[ param_name].set( param_value ) 602 603 #Do the single fit 604 self.fitter.set_model(new_model, self.fit_id, pars) 605 dy=[] 606 x=[] 607 y=[] 608 ## checking the validity of error 609 if metadata.__class__ in ["Data1D","Theory1D"]: 610 for i in range(len(metadata.dy)): 611 if metadata.dy[i] !=0: 612 dy.append(metadata.dy[i]) 613 x.append(metadata.x[i]) 614 y.append(metadata.y[i]) 615 if len(dy)>0: 616 metadata.dy=numpy.zeros(len(dy)) 617 metadata.dy=dy 618 metadata.y=numpy.zeros(len(y)) 619 metadata.y=y 620 metadata.x=numpy.zeros(len(x)) 621 metadata.x=x 622 623 self.fitter.set_data(data=metadata,Uid=self.fit_id, 624 smearer=smearer,qmin= qmin,qmax=qmax ) 625 626 self.fitter.select_problem_for_fit(Uid= self.fit_id, 627 value= value.get_scheduled()) 628 page_fitted=current_pg 629 630 except: 631 msg= "Single Fit error: %s" % sys.exc_value 632 wx.PostEvent(self.parent, StatusEvent(status= msg )) 633 return 578 634 579 635 def _onSelect(self,event): … … 679 735 wx.PostEvent(self.parent, StatusEvent(status="Simultaneous fit \ 680 736 complete ", type="stop")) 737 681 738 ## fit more than 1 model at the same time 682 739 try: … … 692 749 model_name,param_name = self.split_string(p.name) 693 750 if model.name == model_name: 694 small_out.append(p.value ) 695 if p.stderr==None: 696 p.stderr=numpy.nan 697 small_cov.append(p.stderr) 698 model.setParam(param_name,p.value) 751 p_name= model.name+"."+param_name 752 if p.name == p_name: 753 small_out.append(p.value ) 754 model.setParam(param_name,p.value) 755 if p.stderr==None: 756 p.stderr=numpy.nan 757 small_cov.append(p.stderr) 758 759 else: 760 small_cov.append(p.stderr) 761 else: 762 value= model.getParam(param_name) 763 small_out.append(value ) 764 small_cov.append(numpy.nan) 699 765 700 766 # Display result on each page
Note: See TracChangeset
for help on using the changeset viewer.