Changeset 6c2d1a1 in sasview for DataLoader
- Timestamp:
- May 24, 2010 5:09:43 PM (15 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:
- 9bc499b6
- Parents:
- 11a7e11
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/smearing_2d.py
rf72333f r6c2d1a1 26 26 def __init__(self, data=None,model=None,index=None,limit=LIMIT,accuracy='Low'): 27 27 """ 28 Assumption: equally spaced bins of increasing q-values.28 Assumption: equally spaced bins in dq_r, dq_phi space. 29 29 30 30 @param data: 2d data used to set the smearing parameters … … 102 102 def get_value(self): 103 103 """ 104 Over sampling of r_nbins times phi_nbins, calculate Gaussian weights, then find s emared intensity105 # For the default va ues, 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: 106 106 ===================================================================================== 107 107 ## Remove the singular points if exists … … 112 112 n = (phi)*5+(r) 113 113 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]) 115 115 dq = r*numpy.sqrt( self.dqx_data[index_model]*self.dqx_data[index_model] \ 116 116 + self.dqy_data[index_model]*self.dqy_data[index_model] ) 117 #integrant of r*math.exp(-0.5*r*r) dr at each bins117 #integrant of math.exp(-0.5*r*r) r dr at each bins : The integration may not need. 118 118 weight_res[n] = math.exp(-0.5*((r-0.25)*(r-0.25)))-math.exp(-0.5*((r-0.25)*(r-0.25))) 119 119 #if phi !=0 and r != 0: 120 120 qx_res=numpy.append(qx_res,self.qx_data[index_model]+ dq*math.cos(dphi)) 121 121 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. 122 123 ===================================================================================== 123 124 """ … … 145 146 dphi = phi*2.0*math.pi/nphi 146 147 dphi = dphi.repeat(nr) 147 ## Transform to polar coordinate and set dphi at each data points ; 1d array148 ## Transform to polar coordinate, and set dphi at each data points ; 1d array 148 149 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) 150 151 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))) 151 152 weight_res = weight_res.repeat(nphi).reshape(nr,nphi).transpose().flatten()
Note: See TracChangeset
for help on using the changeset viewer.