Changeset 412c509 in sasview for src/sas/sascalc/corfunc/corfunc_calculator.py
- Timestamp:
- Jul 11, 2017 9:59:44 AM (7 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, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 2a54ba5
- Parents:
- 457f735
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/17 09:59:23)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (07/11/17 09:59:44)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sascalc/corfunc/corfunc_calculator.py
rff11b21 r412c509 34 34 35 35 def __call__(self, x): 36 if self._lastx == [] or x.tolist() != self._lastx.tolist(): 36 # If input is a single number, evaluate the function at that number 37 # and return a single number 38 if type(x) == float or type(x) == int: 39 return self._smoothed_function(np.array([x]))[0] 40 # If input is a list, and is different to the last input, evaluate 41 # the function at each point. If the input is the same as last time 42 # the function was called, return the result that was calculated 43 # last time instead of explicity evaluating the function again. 44 elif self._lastx == [] or x.tolist() != self._lastx.tolist(): 37 45 self._lasty = self._smoothed_function(x) 38 46 self._lastx = x … … 121 129 extrapolation = Data1D(qs, iqs) 122 130 123 return params, extrapolation 124 125 def compute_transform(self, extrapolation, trans_type, background=None,126 completefn=None, updatefn=None):131 return params, extrapolation, s2 132 133 def compute_transform(self, extrapolation, trans_type, extrap_fn=None, 134 background=None, completefn=None, updatefn=None): 127 135 """ 128 136 Transform an extrapolated scattering curve into a correlation function. … … 131 139 :param background: The background value (if not provided, previously 132 140 calculated value will be used) 141 :param extrap_fn: A callable function representing the extraoplated data 133 142 :param completefn: The function to call when the transform calculation 134 143 is complete` … … 144 153 if trans_type == 'fourier': 145 154 self._transform_thread = FourierThread(self._data, extrapolation, 146 background, completefn=completefn, updatefn=updatefn) 155 background, extrap_fn=extrap_fn, completefn=completefn, 156 updatefn=updatefn) 147 157 elif trans_type == 'hilbert': 148 158 self._transform_thread = HilbertThread(self._data, extrapolation,
Note: See TracChangeset
for help on using the changeset viewer.