Changeset b093c1c in sasmodels

Ignore:
Timestamp:
Oct 30, 2018 10:53:04 AM (11 months ago)
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
8064d5e
Parents:
f31815d (diff), c6084f1 (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.
Message:

Merge branch 'master' into py3

Files:
13 edited

Unmodified
Removed
• doc/guide/magnetism/magnetism.rst

 rbefe905 ===========   ================================================================ M0:sld       $D_M M_0$ mtheta:sld   $\theta_M$ mphi:sld     $\phi_M$ up:angle     $\theta_\mathrm{up}$ up:frac_i    $u_i$ = (spin up)/(spin up + spin down) *before* the sample up:frac_f    $u_f$ = (spin up)/(spin up + spin down) *after* the sample sld_M0       $D_M M_0$ sld_mtheta   $\theta_M$ sld_mphi     $\phi_M$ up_frac_i    $u_i$ = (spin up)/(spin up + spin down) *before* the sample up_frac_f    $u_f$ = (spin up)/(spin up + spin down) *after* the sample up_angle     $\theta_\mathrm{up}$ ===========   ================================================================ .. note:: The values of the 'up:frac_i' and 'up:frac_f' must be in the range 0 to 1. The values of the 'up_frac_i' and 'up_frac_f' must be in the range 0 to 1. *Document History*
• doc/guide/plugin.rst

 r2015f02 def random(): ... This function provides a model-specific random parameter set which shows model features in the USANS to SANS range.  For example, core-shell sphere sets the outer radius of the sphere logarithmically in [20, 20,000], which sets the Q value for the transition from flat to falling.  It then uses a beta distribution to set the percentage of the shape which is shell, giving a preference for very thin or very thick shells (but never 0% or 100%).  Using -sets=10 in sascomp should show a reasonable variety of curves over the default sascomp q range. The parameter set is returned as a dictionary of {parameter: value, ...}. Any model parameters not included in the dictionary will default according to This function provides a model-specific random parameter set which shows model features in the USANS to SANS range.  For example, core-shell sphere sets the outer radius of the sphere logarithmically in [20, 20,000], which sets the Q value for the transition from flat to falling.  It then uses a beta distribution to set the percentage of the shape which is shell, giving a preference for very thin or very thick shells (but never 0% or 100%).  Using -sets=10 in sascomp should show a reasonable variety of curves over the default sascomp q range. The parameter set is returned as a dictionary of {parameter: value, ...}. Any model parameters not included in the dictionary will default according to the code in the _randomize_one() function from sasmodels/compare.py. erf, erfc, tgamma, lgamma:  **do not use** Special functions that should be part of the standard, but are missing or inaccurate on some platforms. Use sas_erf, sas_erfc and sas_gamma instead (see below). Note: lgamma(x) has not yet been tested. or inaccurate on some platforms. Use sas_erf, sas_erfc, sas_gamma and sas_lgamma instead (see below). Some non-standard constants and functions are also provided: Gamma function sas_gamma\ $(x) = \Gamma(x)$. The standard math function, tgamma(x) is unstable for $x < 1$ The standard math function, tgamma(x), is unstable for $x < 1$ on some platforms. :code:source = ["lib/sas_gamma.c", ...] (sas_gamma.c _) sas_gammaln(x): log gamma function sas_gammaln\ $(x) = \log \Gamma(|x|)$. The standard math function, lgamma(x), is incorrect for single precision on some platforms. :code:source = ["lib/sas_gammainc.c", ...] (sas_gammainc.c _) sas_gammainc(a, x), sas_gammaincc(a, x): Incomplete gamma function sas_gammainc\ $(a, x) = \int_0^x t^{a-1}e^{-t}\,dt / \Gamma(a)$ and complementary incomplete gamma function sas_gammaincc\ $(a, x) = \int_x^\infty t^{a-1}e^{-t}\,dt / \Gamma(a)$ :code:source = ["lib/sas_gammainc.c", ...] (sas_gammainc.c _) sas_erf(x), sas_erfc(x): If $n$ = 0 or 1, it uses sas_J0($x$) or sas_J1($x$), respectively. Warning: JN(n,x) can be very inaccurate (0.1%) for x not in [0.1, 100]. The standard math function jn(n, x) is not available on all platforms. Sine integral Si\ $(x) = \int_0^x \tfrac{\sin t}{t}\,dt$. Warning: Si(x) can be very inaccurate (0.1%) for x in [0.1, 100]. This function uses Taylor series for small and large arguments: For large arguments, For large arguments use the following Taylor series, .. math:: - \frac{\sin(x)}{x}\left(\frac{1}{x} - \frac{3!}{x^3} + \frac{5!}{x^5} - \frac{7!}{x^7}\right) For small arguments, For small arguments , .. math::

• sasmodels/kernelpy.py

 r91bd550 self.info = model_info self.dtype = np.dtype('d') logger.info("make python model " + self.info.name) def make_kernel(self, q_vectors):

• sasmodels/models/spinodal.py

 r475ff58 where $x=q/q_0$, $q_0$ is the peak position, $I_{max}$ is the intensity at $q_0$ (parameterised as the $scale$ parameter), and $B$ is a flat background. The spinodal wavelength is given by $2\pi/q_0$. background. The spinodal wavelength, $\Lambda$, is given by $2\pi/q_0$. The definition of $I_{max}$ in the literature varies. Hashimoto *et al* (1991) define it as .. math:: I_{max} = \Lambda^3\Delta\rho^2 whereas Meier & Strobl (1987) give .. math:: I_{max} = V_z\Delta\rho^2 where $V_z$ is the volume per monomer unit. The exponent $\gamma$ is equal to $d+1$ for off-critical concentration H. Furukawa. Dynamics-scaling theory for phase-separating unmixing mixtures: Growth rates of droplets and scaling properties of autocorrelation functions. Physica A 123,497 (1984). Growth rates of droplets and scaling properties of autocorrelation functions. Physica A 123, 497 (1984). H. Meier & G. Strobl. Small-Angle X-ray Scattering Study of Spinodal Decomposition in Polystyrene/Poly(styrene-co-bromostyrene) Blends. Macromolecules 20, 649-654 (1987). T. Hashimoto, M. Takenaka & H. Jinnai. Scattering Studies of Self-Assembling Processes of Polymer Blends in Spinodal Decomposition. J. Appl. Cryst. 24, 457-466 (1991). Revision History * **Author:**  Dirk Honecker **Date:** Oct 7, 2016 * **Revised:** Steve King    **Date:** Sep 7, 2018 * **Revised:** Steve King    **Date:** Oct 25, 2018 """
• sasmodels/sasview_model.py

 rbd547d0 return value, [value], [1.0] @classmethod def runTests(cls): """ Run any tests built into the model and captures the test output. Returns success flag and output """ from .model_test import check_model return check_model(cls._model_info) def test_cylinder(): # type: () -> float
• sasmodels/special.py

 rdf69efa The standard math function, tgamma(x) is unstable for $x < 1$ on some platforms. sas_gammaln(x): log gamma function sas_gammaln\ $(x) = \log \Gamma(|x|)$. The standard math function, lgamma(x), is incorrect for single precision on some platforms. sas_gammainc(a, x), sas_gammaincc(a, x): Incomplete gamma function sas_gammainc\ $(a, x) = \int_0^x t^{a-1}e^{-t}\,dt / \Gamma(a)$ and complementary incomplete gamma function sas_gammaincc\ $(a, x) = \int_x^\infty t^{a-1}e^{-t}\,dt / \Gamma(a)$ sas_erf(x), sas_erfc(x): from numpy import pi, nan, inf from scipy.special import gamma as sas_gamma from scipy.special import gammaln as sas_gammaln from scipy.special import gammainc as sas_gammainc from scipy.special import gammaincc as sas_gammaincc from scipy.special import erf as sas_erf from scipy.special import erfc as sas_erfc
• setup.py

 r1f991d6 return version[1:-1] raise RuntimeError("Could not read version from %s/__init__.py"%package) install_requires = ['numpy', 'scipy'] if sys.platform=='win32' or sys.platform=='cygwin': install_requires.append('tinycc') setup( 'sasmodels': ['*.c', '*.cl'], }, install_requires=[ ], install_requires=install_requires, extras_require={ 'full': ['docutils', 'bumps', 'matplotlib'], 'server': ['bumps'], 'OpenCL': ["pyopencl"], 'Bumps': ["bumps"], 'TinyCC': ["tinycc"], }, build_requires=['setuptools'],
• sasmodels/jitter.py

 r1198f90 pass import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.widgets import Slider pass axcolor = 'lightgoldenrodyellow' # CRUFT: use axisbg instead of facecolor for matplotlib<2 facecolor_prop = 'facecolor' if mpl.__version__ > '2' else 'axisbg' props = {facecolor_prop: 'lightgoldenrodyellow'} ## add control widgets to plot axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], axisbg=axcolor) axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], axisbg=axcolor) axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], axisbg=axcolor) axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], **props) axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], **props) axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], **props) stheta = Slider(axes_theta, 'Theta', -90, 90, valinit=theta) sphi = Slider(axes_phi, 'Phi', -180, 180, valinit=phi) spsi = Slider(axes_psi, 'Psi', -180, 180, valinit=psi) axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], axisbg=axcolor) axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], axisbg=axcolor) axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], axisbg=axcolor) axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], **props) axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], **props) axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], **props) # Note: using ridiculous definition of rectangle distribution, whose width # in sasmodels is sqrt(3) times the given width.  Divide by sqrt(3) to keep
• sasmodels/kernelcl.py

 rd86f0fc import time try: from time import perf_counter as clock except ImportError: # CRUFT: python < 3.3 import sys if sys.platform.count("darwin") > 0: from time import time as clock else: from time import clock import numpy as np  # type: ignore # Attempt to setup opencl. This may fail if the opencl package is not # Call kernel and retrieve results wait_for = None last_nap = time.clock() last_nap = clock() step = 1000000//self.q_input.nq + 1 for start in range(0, call_details.num_eval, step): # Allow other processes to run wait_for[0].wait() current_time = time.clock() current_time = clock() if current_time - last_nap > 0.5: time.sleep(0.05)
• sasmodels/resolution.py

 r9e7837a q = np.sort(q) if q_min + 2*MINIMUM_RESOLUTION < q[0]: n_low = np.ceil((q[0]-q_min) / (q[1]-q[0])) if q[1] > q[0] else 15 n_low = int(np.ceil((q[0]-q_min) / (q[1]-q[0]))) if q[1] > q[0] else 15 q_low = np.linspace(q_min, q[0], n_low+1)[:-1] else: q_low = [] if q_max - 2*MINIMUM_RESOLUTION > q[-1]: n_high = np.ceil((q_max-q[-1]) / (q[-1]-q[-2])) if q[-1] > q[-2] else 15 n_high = int(np.ceil((q_max-q[-1]) / (q[-1]-q[-2]))) if q[-1] > q[-2] else 15 q_high = np.linspace(q[-1], q_max, n_high+1)[1:] else: q_min = q[0]*MINIMUM_ABSOLUTE_Q n_low = log_delta_q * (log(q[0])-log(q_min)) q_low = np.logspace(log10(q_min), log10(q[0]), np.ceil(n_low)+1)[:-1] q_low = np.logspace(log10(q_min), log10(q[0]), int(np.ceil(n_low))+1)[:-1] else: q_low = [] if q_max > q[-1]: n_high = log_delta_q * (log(q_max)-log(q[-1])) q_high = np.logspace(log10(q[-1]), log10(q_max), np.ceil(n_high)+1)[1:] q_high = np.logspace(log10(q[-1]), log10(q_max), int(np.ceil(n_high))+1)[1:] else: q_high = []
• sasmodels/weights.py

 r3d58247 default = dict(npts=35, width=0, nsigmas=3) def __init__(self, npts=None, width=None, nsigmas=None): self.npts = self.default['npts'] if npts is None else npts self.npts = self.default['npts'] if npts is None else int(npts) self.width = self.default['width'] if width is None else width self.nsigmas = self.default['nsigmas'] if nsigmas is None else nsigmas
Note: See TracChangeset for help on using the changeset viewer.