Changeset c7ac15e in sasview for DataLoader/qsmearing.py


Ignore:
Timestamp:
Mar 24, 2009 2:38:52 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:
2140e68
Parents:
6859338
Message:

corrected some problems

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/qsmearing.py

    rd594a81 rc7ac15e  
    4646        if data1D.dx[0]>0.0: 
    4747            _found_resolution = True 
    48             print "_found_resolution",_found_resolution 
     48            #print "_found_resolution",_found_resolution 
     49            #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0] 
    4950    # If we found resolution smearing data, return a QSmearer 
    5051    if _found_resolution == True: 
     
    7071                _found_resolution = False 
    7172                break 
    72              
     73    #print "_found_slit",_found_slit  
     74    #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0]        
    7375    # If we found slit smearing data, return a slit smearer 
    7476    if _found_slit == True: 
     
    104106        iq_smeared = numpy.zeros(self.nbins) 
    105107        # Loop over q-values 
     108        idwb=[] 
     109         
    106110        for q_i in range(self.nbins): 
    107111            sum = 0.0 
    108             counts = 0.0     
    109              
     112            counts = 0.0   
     113 
    110114            for i in range(self.nbins): 
    111                 if iq[i]!=0 and self._weights[q_i][i]!=0: 
     115                if iq[i]==0 or self._weights[q_i][i]==0: 
     116                    continue 
     117                else: 
    112118                    sum += iq[i] * self._weights[q_i][i]  
    113119                    counts += self._weights[q_i][i] 
     
    147153        self.nbins  = nbins 
    148154        ## Number of points used in the smearing computation 
    149         self.npts   = 1000 
     155        self.npts   = 10000 
    150156        ## Smearing matrix 
    151157        self._weights = None 
     
    163169            # For each q-value, compute the weight of each other q-bin 
    164170            # in the I(q) array 
    165             npts_h = self.nbins if self.height>0 else 1 #changed self.npts=>self.nbins 
    166             npts_w = self.nbins if self.width>0 else 1 #changed self.npts=>self.nbins 
     171            npts_h = self.npts if self.height>0 else 1  
     172            npts_w = self.npts if self.width>0 else 1  
    167173             
    168174            # If both height and width are great than zero, 
     
    191197                    if q_i<self.nbins: 
    192198                        weights[i][q_i] = weights[i][q_i]+1.0 
    193         print "nbin,npts",self.nbins,self.npts 
    194199 
    195200        self._weights = weights 
     
    234239        self.max = data1D.x[len(data1D.x)-1]         
    235240 
     241        #print "nbin,npts",self.nbins,self.npts 
    236242 
    237243class _QSmearer(_BaseSmearer): 
Note: See TracChangeset for help on using the changeset viewer.