Changeset e090ba90 in sasview for src/sas/sascalc/corfunc
- Timestamp:
- Oct 11, 2018 11:59:57 AM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
- Children:
- 88d2e70
- Parents:
- 67ed543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/corfunc/corfunc_calculator.py
ra26f67f re090ba90 30 30 self.start = start 31 31 self.stop = stop 32 self._lastx = []33 self._lasty = []32 self._lastx = np.empty(0, dtype='d') 33 self._lasty = None 34 34 35 35 def __call__(self, x): 36 36 # If input is a single number, evaluate the function at that number 37 37 # and return a single number 38 if type(x) == float or type(x) == int:38 if isinstance(x, (float, int)): 39 39 return self._smoothed_function(np.array([x]))[0] 40 40 # If input is a list, and is different to the last input, evaluate … … 42 42 # the function was called, return the result that was calculated 43 43 # last time instead of explicity evaluating the function again. 44 elif self._lastx == [] or x.tolist() != self._lastx.tolist(): 45 self._lasty = self._smoothed_function(x) 46 self._lastx = x 44 if not np.array_equal(x, self._lastx): 45 self._lastx, self._lasty = x, self._smoothed_function(x) 47 46 return self._lasty 48 47 … … 88 87 # Only process data of the class Data1D 89 88 if not issubclass(data.__class__, Data1D): 90 raise ValueError(" Data must be of the type DataLoader.Data1D")89 raise ValueError("Correlation function cannot be computed with 2D data.") 91 90 92 91 # Prepare the data … … 246 245 """Fit the Guinier region of the curve""" 247 246 A = np.vstack([q**2, np.ones(q.shape)]).T 248 return lstsq(A, np.log(iq) )247 return lstsq(A, np.log(iq), rcond=None) 249 248 250 249 def _fit_porod(self, q, iq):
Note: See TracChangeset
for help on using the changeset viewer.