Changeset 4416868 in sasmodels
- Timestamp:
- Mar 20, 2016 12:09:13 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 65bf704, 3a45c2c
- Parents:
- 45330ed (diff), 6ad0e87 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kerneldll.py
r17bbadd r6ad0e87 51 51 import ctypes as ct 52 52 from ctypes import c_void_p, c_int, c_longdouble, c_double, c_float 53 import _ctypes 53 54 54 55 import numpy as np … … 125 126 if callable(model_info.get('Iq', None)): 126 127 return PyModel(model_info) 127 128 128 129 dtype = np.dtype(dtype) 129 130 if dtype == generate.F16: … … 138 139 else: 139 140 tempfile_prefix = 'sas_' + model_info['name'] + '128_' 140 141 141 142 source = generate.convert_type(source, dtype) 142 143 source_files = generate.model_sources(model_info) + [model_info['filename']] … … 188 189 Call :meth:`release` when done with the kernel. 189 190 """ 191 190 192 def __init__(self, dllpath, model_info, dtype=generate.F32): 191 193 self.info = model_info … … 217 219 self.Iqxy = self.dll[generate.kernel_name(self.info, True)] 218 220 self.Iqxy.argtypes = IQXY_ARGS + pd_args_2d + [fp]*Nfixed2d 221 222 self.release() 219 223 220 224 def __getstate__(self): … … 230 234 kernel = self.Iqxy if q_input.is_2d else self.Iq 231 235 return DllKernel(kernel, self.info, q_input) 232 236 233 237 def release(self): 234 238 """ 235 239 Release any resources associated with the model. 236 240 """ 237 pass # TODO: should release the dll 241 if os.name == 'nt': 242 #dll = ct.cdll.LoadLibrary(self.dllpath) 243 dll = ct.CDLL(self.dllpath) 244 libHandle = dll._handle 245 #libHandle = ct.c_void_p(dll._handle) 246 del dll, self.dll 247 self.dll = None 248 #_ctypes.FreeLibrary(libHandle) 249 ct.windll.kernel32.FreeLibrary(libHandle) 250 else: 251 pass 238 252 239 253 -
sasmodels/models/guinier.py
ra84a0ca r45330ed 5 5 This model fits the Guinier function 6 6 7 .. math:: q_1=\frac{1}{R_g}\sqrt{\frac{(m-s)(3-s)}{2}}7 .. math:: I(q) = scale \exp{\left[ \frac{-Q^2R_g^2}{3} \right]} 8 8 9 9 to the data directly without any need for linearisation 10 (*cf*. $\ln I(q)$ vs $q^2$\ ). 10 (*cf*. the usual plot of $\ln I(q)$ vs $q^2$\ ). Note that you may have to 11 restrict the data range to include small q only, where the Guinier approximation 12 actually applies. See also the guinier_porod model. 11 13 12 14 For 2D data the scattering intensity is calculated in the same way as 1D, … … 27 29 title = "" 28 30 description = """ 29 I(q) = scale 31 I(q) = scale.exp ( - rg^2 q^2 / 3.0 ) 30 32 31 33 List of default parameters: -
sasmodels/models/guinier_porod.py
raa2edb2 r45330ed 39 39 Note that the radius-of-gyration for a sphere of radius R is given by $R_g = R \sqrt(3/5)$. 40 40 41 The cross-sectional radius-of-gyration for a randomly oriented cylinder 42 of radius R is given by $R_g = R / \sqrt(2)$. 41 For a cylinder of radius $R$ and length $L$, $R_g^2 = \frac{L^2}{12} + \frac{R^2}{2}$ 43 42 44 The cross-sectional radius-of-gyration of a randomly oriented lamella 43 from which the cross-sectional radius-of-gyration for a randomly oriented thin 44 cylinder is $R_g = R / \sqrt(2)$. 45 46 and the cross-sectional radius-of-gyration of a randomly oriented lamella 45 47 of thickness $T$ is given by $R_g = T / \sqrt(12)$. 46 48
Note: See TracChangeset
for help on using the changeset viewer.