Changes in sasmodels/sesans.py [b297ba9:da33725] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/sesans.py
rb297ba9 rda33725 15 15 from numpy import pi # type: ignore 16 16 from scipy.special import j0 17 17 18 18 19 class SesansTransform(object): … … 38 39 39 40 # transform arrays 40 _H = None # type: np.ndarray41 _H0 = None # type: np.ndarray41 _H = None # type: np.ndarray 42 _H0 = None # type: np.ndarray 42 43 43 def __init__(self, z, SElength, lam, zaccept, Rmax ):44 def __init__(self, z, SElength, lam, zaccept, Rmax, log_spacing=1.0003): 44 45 # type: (np.ndarray, float, float) -> None 45 #import logging; logging.info("creating SESANS transform")46 46 self.q = z 47 self.log_spacing = log_spacing 47 48 self._set_hankel(SElength, lam, zaccept, Rmax) 48 49 … … 59 60 def _set_hankel(self, SElength, lam, zaccept, Rmax): 60 61 # type: (np.ndarray, float, float) -> None 61 # Force float32 arrays, otherwise run into memory problems on some machines 62 SElength = np.asarray(SElength, dtype='float32') 63 64 #Rmax = #value in text box somewhere in FitPage? 62 SElength = np.asarray(SElength) 65 63 q_max = 2*pi / (SElength[1] - SElength[0]) 66 64 q_min = 0.1 * 2*pi / (np.size(SElength) * SElength[-1]) 67 q = np. arange(q_min, q_max, q_min, dtype='float32')68 dq = q_min65 q = np.exp(np.arange(np.log(q_min), np.log(q_max), 66 np.log(self.log_spacing))) 69 67 70 H0 = np.float32(dq/(2*pi)) * q 68 dq = np.diff(q) 69 dq = np.insert(dq, 0, dq[0]) 71 70 72 repq = np.tile(q, (SElength.size, 1)).T 73 repSE = np.tile(SElength, (q.size, 1)) 74 H = np.float32(dq/(2*pi)) * j0(repSE*repq) * repq 71 H0 = dq/(2*pi) * q 75 72 76 replam = np.tile(lam, (q.size, 1)) 77 reptheta = np.arcsin(repq*replam/2*np.pi) 73 H = np.outer(q, SElength) 74 j0(H, out=H) 75 H *= (dq * q / (2*pi)).reshape((-1, 1)) 76 77 reptheta = np.outer(q, lam/(2*pi)) 78 np.arcsin(reptheta, out=reptheta) 78 79 mask = reptheta > zaccept 79 80 H[mask] = 0
Note: See TracChangeset
for help on using the changeset viewer.