Changeset 6c2d1a1 in sasview for DataLoader/smearing_2d.py


Ignore:
Timestamp:
May 24, 2010 3:09:43 PM (14 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:
9bc499b6
Parents:
11a7e11
Message:

put more doc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/smearing_2d.py

    rf72333f r6c2d1a1  
    2626    def __init__(self, data=None,model=None,index=None,limit=LIMIT,accuracy='Low'): 
    2727        """ 
    28             Assumption: equally spaced bins of increasing q-values. 
     28            Assumption: equally spaced bins in dq_r, dq_phi space. 
    2929             
    3030            @param data: 2d data used to set the smearing parameters 
     
    102102    def get_value(self): 
    103103        """ 
    104             Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, then find semared intensity 
    105             # For the default vaues, this is equivalent (but speed optimized by a factor of ten)to the following: 
     104            Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, then find smeared intensity 
     105            # For the default values, this is equivalent (but speed optimized by a factor of ten)to the following: 
    106106            ===================================================================================== 
    107107            ## Remove the singular points if exists 
     
    112112                    n = (phi)*5+(r) 
    113113                    r = r+0.25 
    114                     dphi = phi*2.0*math.pi/4.0 + numpy.arctan(self.qy_data[index_model]/self.qx_data[index_model]) 
     114                    dphi = phi*2.0*math.pi/4.0 + numpy.arctan(self.qy_data[index_model]/self.dqy_data[index_model]/self.qx_data[index_model]*/self.dqx_data[index_model]) 
    115115                    dq = r*numpy.sqrt( self.dqx_data[index_model]*self.dqx_data[index_model] \ 
    116116                        + self.dqy_data[index_model]*self.dqy_data[index_model] ) 
    117                     #integrant of r*math.exp(-0.5*r*r) dr at each bins 
     117                    #integrant of math.exp(-0.5*r*r) r dr at each bins : The integration may not need. 
    118118                    weight_res[n] = math.exp(-0.5*((r-0.25)*(r-0.25)))-math.exp(-0.5*((r-0.25)*(r-0.25))) 
    119119                    #if phi !=0 and r != 0: 
    120120                    qx_res=numpy.append(qx_res,self.qx_data[index_model]+ dq*math.cos(dphi)) 
    121121                    qy_res=numpy.append(qy_res,self.qy_data[index_model]+ dq*math.sin(dphi)) 
     122            ## Then compute I(qx_res,qy_res) and do weighted averaging.  
    122123            ===================================================================================== 
    123124        """ 
     
    145146        dphi = phi*2.0*math.pi/nphi 
    146147        dphi = dphi.repeat(nr) 
    147         ## Transform to polar coordinate and set dphi at each data points ; 1d array 
     148        ## Transform to polar coordinate, and set dphi at each data points ; 1d array 
    148149        dphi = dphi.repeat(len_data)+numpy.arctan(self.qy_data*self.dqx_data/self.qx_data/self.dqy_data).repeat(n_bins).reshape(len_data,n_bins).transpose().flatten() 
    149         ## Find Gaussian weight for each dq bins: The weight depends only on r-direction 
     150        ## Find Gaussian weight for each dq bins: The weight depends only on r-direction (The integration may not need) 
    150151        weight_res = numpy.exp(-0.5*((r-bin_size/2.0)*(r-bin_size/2.0)))-numpy.exp(-0.5*((r+bin_size/2.0)*(r+bin_size/2.0))) 
    151152        weight_res = weight_res.repeat(nphi).reshape(nr,nphi).transpose().flatten() 
Note: See TracChangeset for help on using the changeset viewer.