Changeset 09ebe8c in sasmodels
 Timestamp:
 Jan 27, 2016 3:55:41 PM (8 years ago)
 Branches:
 master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 384d114
 Parents:
 fdc538a
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sasmodels/sesans.py
r3c56da87 r09ebe8c 12 12 import numpy as np 13 13 from numpy import pi, exp 14 15 14 from scipy.special import jv as besselj 16 15 17 def make_q(q_zmax, Rmax): 16 def make_q(q_max, Rmax): 17 """ 18 Return a $q$ vector suitable for SESANS covering from $2\pi/ (10 R_{\max})$ 19 to $q_max$. 20 """ 18 21 q_min = dq = 0.1 * 2*pi / Rmax 19 #q_min = 0.00003 20 return np.arange(q_min, q_zmax, dq) 21 22 # TODO: dead code; for now the call to the hankel transform happens in BumpsModel 23 class SesansCalculator: 24 def __init__(self, kernel, q_zmax, Rmax, SElength, wavelength, thickness): 25 self._set_kernel(kernel, q_zmax, Rmax) 26 self.SElength = SElength 27 self.wavelength = wavelength 28 self.thickness = thickness 29 30 def _set_kernel(self, kernel, q_zmax, Rmax): 31 kernel_input = kernel.make_input([make_q(q_zmax, Rmax)]) 32 self.sans_calculator = kernel(kernel_input) 33 34 def __call__(self, pars, pd_pars, cutoff=1e5): 35 Iq = self.sans_calculator(pars, pd_pars, cutoff) 36 P = hankel(self.SElength, self.wavelength, self.thickness, self.q, Iq) 37 self.Iq = Iq 38 return P 22 return np.arange(q_min, q_max, dq) 39 23 40 24 def hankel(SElength, wavelength, thickness, q, Iq): … … 60 44 G = np.zeros(len(SElength), 'd') 61 45 for i in range(len(SElength)): 62 integr = besselj(0, q*SElength[i])*Iq*q46 integr = besselj(0, q*SElength[i])*Iq*q 63 47 G[i] = np.sum(integr) 64 48 dq=(q[1]q[0])*1e10 # [m^1] step size in q, needed for integration
Note: See TracChangeset
for help on using the changeset viewer.