Changeset e4e5e29 in sasmodels
- Timestamp:
- Apr 8, 2017 10:13:19 AM (8 years ago)
- Branches:
- costrafo411
- Children:
- a86e249
- Parents:
- b2921d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/sesans.py
r94d13f1 re4e5e29 45 45 #import logging; logging.info("creating SESANS transform") 46 46 self.q = z 47 # isoriented flag determines whether data is from an oriented sample or not, should be in the data or selectable in GUI. 48 #if self.isoriented==False 47 49 self._set_hankel(SElength, zaccept, Rmax) 50 #if self.isoriented==True 51 self._set_cosmat(SElength, zaccept, Rmax) 48 52 49 53 def apply(self, Iq): 50 # tye: (np.ndarray) -> np.ndarray 51 G0 = np.dot(self._H0, Iq) 52 G = np.dot(self._H.T, Iq) 53 P = G - G0 54 if len(Iq.size) == 1: # if isotropic, do Hankel transform 55 # type: (np.ndarray) -> np.ndarray 56 G0 = np.dot(self._H0, Iq) 57 G = np.dot(self._H.T, Iq) 58 P = G - G0 59 elif len(Iq.size) == 2: 60 dq=self.q_calc[0] 61 G0 = sum(np.dot(self._cos0, Iq)*dq) 62 G = sum(np.dot(self._cosmat.T, Iq)*dq) 63 P = G - G0 54 64 return P 55 65 … … 73 83 self.q_calc = q 74 84 self._H, self._H0 = H, H0 85 86 def _set_cosmat(self, SElength, zaccept, Rmax): 87 # type: (np.ndarray, float, float) -> None 88 # Force float32 arrays, otherwise run into memory problems on some machines 89 SElength = np.asarray(SElength, dtype='float32') 90 #qymax and qzmax depend on detector shape 91 qzmax= 92 # Rmax = #value in text box somewhere in FitPage? 93 q_max = 2 * pi / (SElength[1] - SElength[0]) 94 q_min = 0.1 * 2 * pi / (np.size(SElength) * SElength[-1]) 95 96 q = np.arange(q_min, q_max, q_min, dtype='float32') 97 dq = q_min 98 99 cos0 = np.float32(dq / (2 * pi)) 100 101 repq = np.tile(q, (SElength.size, 1)).T 102 repSE = np.tile(SElength, (q.size, 1)) 103 cosmat = np.float32(dq / (2 * pi)) * np.cos(repSE * repq) 104 105 self.q_calc = q 106 self._cosmat, self._cos0 = cosmat, cos0
Note: See TracChangeset
for help on using the changeset viewer.