Changes in src/sas/sascalc/pr/invertor.py [13da5f5:b8080e1] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/pr/invertor.py
r13da5f5 rb8080e1 71 71 A[j][i] = (Fourier transformed base function for point j) 72 72 73 We the nchoose a number of r-points, n_r, to evaluate the second73 We them choose a number of r-points, n_r, to evaluate the second 74 74 derivative of P(r) at. This is used as our regularization term. 75 75 For a vector r of length n_r, the following n_r rows are set to :: … … 144 144 x, y, err, d_max, q_min, q_max and alpha 145 145 """ 146 if name == 'x':146 if name == 'x': 147 147 if 0.0 in value: 148 148 msg = "Invertor: one of your q-values is zero. " … … 227 227 return None 228 228 229 def add_errors(self, yvalues):230 """231 Adds errors to data set is they are not avaialble232 :return:233 """234 stats_errors = np.zeros(len(yvalues))235 for i in range(len(yvalues)):236 # Scale the error so that we can fit over several decades of Q237 scale = 0.05 * np.sqrt(yvalues[i])238 min_err = 0.01 * yvalues[i]239 stats_errors[i] = scale * np.sqrt(np.fabs(yvalues[i])) + min_err240 logger.warning("Simulated errors have been added to the data set\n")241 return stats_errors242 243 229 def clone(self): 244 230 """ … … 258 244 invertor.x = self.x 259 245 invertor.y = self.y 260 if np.size(self.err) == 0 or np.all(self.err) == 0: 261 invertor.err = self.add_errors(self.y) 262 else: 263 invertor.err = self.err 246 invertor.err = self.err 264 247 invertor.est_bck = self.est_bck 265 248 invertor.background = self.background … … 285 268 A[i][j] = (Fourier transformed base function for point j) 286 269 287 We the nchoose a number of r-points, n_r, to evaluate the second270 We them choose a number of r-points, n_r, to evaluate the second 288 271 derivative of P(r) at. This is used as our regularization term. 289 272 For a vector r of length n_r, the following n_r rows are set to :: … … 306 289 # Reset the background value before proceeding 307 290 # self.background = 0.0 308 if np.size(self.err) == 0 or np.all(self.err) == 0:309 self.err = self.add_errors(self.y)310 291 if not self.est_bck: 311 292 self.y -= self.background
Note: See TracChangeset
for help on using the changeset viewer.