Changeset fe2ade9 in sasview for DataLoader
- Timestamp:
- Mar 4, 2009 3:47: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:
- 6c0568b
- Parents:
- eba08f1a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/qsmearing.py
rc0d9981 rfe2ade9 107 107 108 108 for i in range(self.nbins): 109 sum += iq[i] * self._weights[q_i][i] 110 counts += self._weights[q_i][i] 111 109 if iq[i]!=0 and self._weights[q_i][i]!=0: 110 sum += iq[i] * self._weights[q_i][i] 111 counts += self._weights[q_i][i] 112 #print "i,iq[i],self._weights[q_i][i] ",i,iq[i],self._weights[q_i][i] 112 113 iq_smeared[q_i] = sum/counts 113 114 #print "q_i,iq_smeared[q_i]",q_i,iq[i],iq_smeared[q_i] 115 #print "iq[i],iq_smeared[q_i],sum,counts,self.nbins",iq[i], iq_smeared[q_i],sum,counts,self.nbins 114 116 return iq_smeared 115 117 … … 156 158 # For each q-value, compute the weight of each other q-bin 157 159 # in the I(q) array 158 npts_h = self.n pts if self.height>0 else 1159 npts_w = self.n pts if self.width>0 else 1160 npts_h = self.nbins if self.height>0 else 1 #changed self.npts=>self.nbins 161 npts_w = self.nbins if self.width>0 else 1 #changed self.npts=>self.nbins 160 162 161 163 # If both height and width are great than zero, … … 184 186 if q_i<self.nbins: 185 187 weights[i][q_i] = weights[i][q_i]+1.0 186 188 187 189 self._weights = weights 188 190 return self._weights … … 264 266 q_min = q - 0.5*step 265 267 q_max = q + 0.5*step 266 267 268 for j in range(self.nbins): 268 269 q_j = self.min + j*step … … 270 271 # Compute the fraction of the Gaussian contributing 271 272 # to the q bin between q_min and q_max 273 #value = math.exp(-math.pow((q_max-q_j),2)/(2*math.pow(self.width[j],2) )) 274 #value += math.exp(-math.pow((q_max-q_j),2)/(2*math.pow(self.width[j],2) )) 272 275 value = scipy.special.erf( (q_max-q_j)/(math.sqrt(2.0)*self.width[j]) ) 273 276 value -=scipy.special.erf( (q_min-q_j)/(math.sqrt(2.0)*self.width[j]) ) 274 275 277 weights[i][j] += value 276 278 … … 321 323 if True: 322 324 for i in range(10): 323 print x[i], sy[i]325 print x[i],y[i], sy[i] 324 326 #print q, ' : ', s.weight(q), s._compute_iq(q) 325 327 #print q, ' : ', s(q), s._compute_iq(q)
Note: See TracChangeset
for help on using the changeset viewer.