Changeset 65883cf in sasview for DataLoader/qsmearing.py
- Timestamp:
- Sep 21, 2009 8:32:18 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:
- a0bc608
- Parents:
- a65ffcb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DataLoader/qsmearing.py
r5859862 r65883cf 106 106 @param q_max: maximum q-value to smear 107 107 """ 108 # If this is the first time we call for smearing, 109 # initialize the C++ smearer object first 110 if not self._init_complete: 111 self._initialize_smearer() 112 108 113 if q_min == None: 109 114 q_min = self.min … … 118 123 119 124 step = (self.max-self.min)/(self.nbins-1.0) 120 for i in range(self.nbins): 121 q_i = smearer.get_q(self._smearer, i) 122 if (q_i >= _qmin_unsmeared) and (q_i <= _qmax_unsmeared): 123 # Identify first and last bin 124 if _first_bin is None: 125 _first_bin = i 126 else: 127 _last_bin = i 125 try: 126 for i in range(self.nbins): 127 q_i = smearer.get_q(self._smearer, i) 128 if (q_i >= _qmin_unsmeared) and (q_i <= _qmax_unsmeared): 129 # Identify first and last bin 130 if _first_bin is None: 131 _first_bin = i 132 else: 133 _last_bin = i 134 except: 135 raise RuntimeError, "_BaseSmearer.get_bin_range: error getting range\n %s" % sys.exc_value 128 136 129 137 return _first_bin, _last_bin … … 151 159 # Storage for smeared I(q) 152 160 iq_out = numpy.zeros(self.nbins) 153 smearer.smear(self._smearer, iq_in, iq_out, first_bin, last_bin) 161 smear_output = smearer.smear(self._smearer, iq_in, iq_out, first_bin, last_bin) 162 if smear_output < 0: 163 raise RuntimeError, "_BaseSmearer: could not smear, code = %g" % smear_output 154 164 return iq_out 155 165 … … 184 194 ## Smearing matrix 185 195 self._weights = None 196 self.qvalues = None 186 197 187 198 def _initialize_smearer(self): … … 275 286 ## Smearing matrix 276 287 self._weights = None 288 self.qvalues = None 277 289 278 290 def _initialize_smearer(self):
Note: See TracChangeset
for help on using the changeset viewer.