Changeset 1309e919 in sasview for sansview/perspectives


Ignore:
Timestamp:
Feb 10, 2009 5:36:29 PM (15 years ago)
Author:
Jae Cho <jhjcho@…>
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:
ca10d8e
Parents:
26cb768
Message:

The definition of chisqr was corrected and applied number of points within fitting range to the reduced chisqr.

File:
1 edited

Legend:

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

    r2268d10 r1309e919  
    9292            i+=1 
    9393             
    94          
    9594        #Filing the sizer containing data related fields 
    9695        ix = 0 
     
    198197            self.qmax_x= math.sqrt(math.pow(max(math.fabs(self.data.xmax),math.fabs(self.data.xmin)),2) 
    199198                            +math.pow(max(math.fabs(self.data.ymax),math.fabs(self.data.ymin)),2))#self.data.xmax            
    200             print "data2D range",self.qmax_x 
     199            #print "data2D range",self.qmax_x 
    201200         
    202201        self.num_points= 100 
     
    310309                self.qmin_x = float(self.qmin.GetValue()) 
    311310                self.qmax_x = float(self.qmax.GetValue()) 
    312                  
    313311                for i in range(len(self.data.x_bins)): 
    314                     if self.data.x_bins[i]>= self.qmin_x and self.data.x_bins[i]<= self.qmax_x: 
     312                    #if self.data.x_bins[i]>= self.qmin_x and self.data.x_bins[i]<= self.qmax_x: 
    315313                        for j in range(len(self.data.y_bins)): 
    316                             if self.data.y_bins[j]>= self.qmin_x and self.data.y_bins[j]<= self.qmax_x: 
    317                                 res.append( (self.data.data[j][i]- self.model.runXY(\ 
    318                                  [self.data.x_bins[i],self.data.y_bins[j]]))\ 
    319                                     /self.data.err_data[j][i] ) 
     314                            if math.pow(self.data.x_bins[i],2)+math.pow(self.data.y_bins[j],2)>=math.pow(self.qmin_x,2): 
     315                                if math.pow(self.data.x_bins[i],2)+math.pow(self.data.y_bins[j],2)<=math.pow(self.qmax_x,2): 
     316                            #if self.data.y_bins[j]>= self.qmin_x and self.data.y_bins[j]<= self.qmax_x: 
     317                                    chisqrji=(self.data.data[j][i]- self.model.runXY(\ 
     318                                                                                        [self.data.y_bins[j],self.data.x_bins[i]]))\ 
     319                                                                                        /self.data.err_data[j][i] 
     320                                    res.append( math.pow(chisqrji,2) ) 
    320321                sum=0 
    321322                
     
    324325                        sum +=item 
    325326                #print "chisqr : sum 2D", xmin, xmax, ymin, ymax,sum 
    326                 #print res 
    327                 self.tcChi.SetLabel(format_number(math.fabs(sum))) 
     327                #print len(res) 
     328                self.tcChi.SetLabel(format_number(math.fabs(sum/ len(res)))) 
    328329            except: 
    329330                raise 
     
    361362                        if numpy.isfinite(item): 
    362363                            sum +=item 
    363                     self.tcChi.SetLabel(format_number(math.fabs(sum))) 
     364                    self.tcChi.SetLabel(format_number(math.fabs(sum/ len(res)))) 
    364365            except: 
    365366                wx.PostEvent(self.parent.GrandParent, StatusEvent(status=\ 
Note: See TracChangeset for help on using the changeset viewer.