Changeset 4bb2917 in sasview for park_integration/AbstractFitEngine.py
- Timestamp:
- Sep 23, 2009 6:42:33 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:
- 6e9150d
- Parents:
- 3f31159
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
park_integration/AbstractFitEngine.py
r920a6e5 r4bb2917 190 190 self.qmax = qmax 191 191 192 # Range used for input to smearing 192 # Determine the range needed in unsmeared-Q to cover 193 # the smeared Q range 193 194 self._qmin_unsmeared = self.qmin 194 195 self._qmax_unsmeared = self.qmax 195 196 196 # Determine the range needed in unsmeared-Q to cover 197 # the smeared Q range 198 #TODO: use the smearing matrix to determine which 199 # bin range to use 200 if self.smearer.__class__.__name__ == 'SlitSmearer': 201 self._qmin_unsmeared = min(self.data.x) 202 self._qmax_unsmeared = max(self.data.x) 203 elif self.smearer.__class__.__name__ == 'QSmearer': 204 # Take 3 sigmas as the offset between smeared and unsmeared space 205 try: 206 offset = 3.0*max(self.smearer.width) 207 self._qmin_unsmeared = max([min(self.data.x), self.qmin-offset]) 208 self._qmax_unsmeared = min([max(self.data.x), self.qmax+offset]) 209 except: 210 logging.error("FitData1D.setFitRange: %s" % sys.exc_value) 197 self._first_unsmeared_bin = 0 198 self._last_unsmeared_bin = len(self.data.x)-1 199 200 if self.smearer!=None: 201 self._first_unsmeared_bin, self._last_unsmeared_bin = self.smearer.get_bin_range(self.qmin, self.qmax) 202 self._qmin_unsmeared = self.data.x[self._first_unsmeared_bin] 203 self._qmax_unsmeared = self.data.x[self._last_unsmeared_bin] 204 211 205 # Identify the bin range for the unsmeared and smeared spaces 212 206 self.idx = (self.x>=self.qmin) & (self.x <= self.qmax) … … 232 226 # Compute theory data f(x) 233 227 fx= numpy.zeros(len(self.x)) 234 _first_bin = None235 _last_bin = None236 237 228 fx[self.idx_unsmeared] = fn(self.x[self.idx_unsmeared]) 238 229 239 240 for i_x in range(len(self.x)):241 if self.idx_unsmeared[i_x]==True:242 # Identify first and last bin243 #TODO: refactor this to pass q-values to the smearer244 # and let it figure out which bin range to use245 if _first_bin is None:246 _first_bin = i_x247 else:248 _last_bin = i_x249 250 230 ## Smear theory data 251 231 if self.smearer is not None: 252 fx = self.smearer(fx, _first_bin, _last_bin)232 fx = self.smearer(fx, self._first_unsmeared_bin, self._last_unsmeared_bin) 253 233 254 234 ## Sanity check
Note: See TracChangeset
for help on using the changeset viewer.