Changeset 589b740 in sasmodels
- Timestamp:
- Nov 20, 2016 5:43:52 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 26b848d
- Parents:
- 46d9f48
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/resolution.py
r2ccb775 r589b740 66 66 self.q_calc = q_calc 67 67 def apply(self, theory): 68 return sesans.hankeltrafo(self.H0, self.H, theory) 68 return sesans.SesansTransform.apply(theory) 69 #return sesans.hankeltrafo(self.H0, self.H, theory) 69 70 70 71 """ -
sasmodels/sesans.py
r46d9f48 r589b740 14 14 import numpy as np # type: ignore 15 15 from numpy import pi, exp # type: ignore 16 from scipy.special import jv as besselj16 #from scipy.special import jv as besselj 17 17 from scipy.special import j0 18 #from mpmath import j0 19 from mpmath import besselj20 from mpmath import mpf18 #from mpmath import j0 as j0 19 #from mpmath import besselj 20 #from mpmath import mpf 21 21 from src.sas.sascalc.data_util.nxsunit import Converter 22 22 #from sas.sasgui.perspectives.fitting.fitpage import FitPage … … 42 42 def Hankelconstructor(data): 43 43 Rmax = 1000000 44 #Rmax = #value in text box? 44 45 q_calc = make_q(data.sample.zacceptance, Rmax) 45 46 SElength = Converter(data._xunit)(data.x, "A") … … 47 48 H0 = dq / (2 * pi) * q_calc 48 49 repSE, repq = np.meshgrid(SElength,q_calc) 50 repq=np.array(repq,dtype='f') 51 repSE=np.array(repSE,dtype='f') 49 52 H = dq / (2 * pi) * j0(repSE*repq)*repq 50 53 return H0, H, q_calc … … 55 58 P = G - G0 56 59 return P # This is the logarithmic Polarization, not the linear one as found in Andersson2008! 60 61 62 class SesansTransform(object): 63 #: Set of spin-echo lengths in the measured data 64 SElength = None # type: np.ndarray 65 #: Maximum acceptance of scattering vector in the spin echo encoding dimension (for ToF: Q of min(R) and max(lam)) 66 zaccept = None # type: float 67 #: Maximum size sensitivity; larger radius requires more computation 68 Rmax = None # type: float 69 #: q values to calculate when computing transform 70 q = None # type: np.ndarray 71 72 # transform arrays 73 _H = None # type: np.ndarray 74 _H0 = None # type: np.ndarray 75 76 def set_transform(self, SE, zaccept, Rmax): 77 if self.SE is None or len(SE) != len(self.SE) or np.any(SE != self.SE) or zaccept != self.zaccept or Rmax != self.Rmax: 78 self.SE, self.zaccept, self.Rmax = SE, zaccept, Rmax 79 self._set_q() 80 self._set_hankel() 81 82 def apply(self, Iq): 83 G0 = np.dot(self._H0, Iq) 84 G = np.dot(self._H.T, Iq) 85 P = G - G0 86 return P 87 88 def _set_q(self): 89 q_min = dq = 0.1 * 2*pi / self.Rmax 90 q_max = self.zaccept 91 q=np.arange(q_min,q_max) 92 self.q = q 93 self.dq = dq 94 95 def _set_hankel(self): 96 #Rmax = #value in text box somewhere in FitPage? 97 q = self.q 98 dq = self.dq 99 SElength = self.SE 100 101 H0 = dq / (2 * pi) * q 102 repSE, repq = np.meshgrid(SElength,q) 103 repq=np.array(repq,dtype='f') 104 repSE=np.array(repSE,dtype='f') 105 H = dq / (2 * pi) * j0(repSE*repq)*repq 106 107 self._H, self._H0 = H, H0 108
Note: See TracChangeset
for help on using the changeset viewer.