Changeset c515b1b in sasmodels
- Timestamp:
- Mar 17, 2016 1:10:53 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:
- cbd37a7
- Parents:
- 094e320 (diff), c970053 (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. - Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/poly_gauss_coil.py
r246517d r09b84ed 50 50 """ 51 51 52 from numpy import inf, sqrt, power52 from numpy import inf, sqrt, exp, power 53 53 54 54 name = "poly_gauss_coil" … … 69 69 def Iq(q, i_zero, radius_gyration, polydispersity): 70 70 # pylint: disable = missing-docstring 71 # need to trap the case of the polydispersity being 1 (ie, monodispersity)72 71 u = polydispersity - 1.0 73 if polydispersity == 1:74 minusoneonu = -1.0 / u75 else:76 minusoneonu = -1.0 / u77 72 z = ((q * radius_gyration) * (q * radius_gyration)) / (1.0 + 2.0 * u) 78 73 if (q == 0).any(): 79 inten = i_zero74 inten = i_zero 80 75 else: 81 inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 76 # need to trap the case of the polydispersity being 1 (ie, monodispersity!) 77 if polydispersity == 1: 78 inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 79 else: 80 minusoneonu = -1.0 / u 81 inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 82 82 return inten 83 Iq.vectorized = True # Iq accepts an array of q values83 #Iq.vectorized = True # Iq accepts an array of q values 84 84 85 85 def Iqxy(qx, qy, *args): … … 100 100 background = 'background') 101 101 102 # these unit test values taken from SasView 3.1.2 102 103 tests = [ 103 [{'scale': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0},104 [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0}, 104 105 [0.0106939, 0.469418], [57.6405, 0.169016]], 105 106 ] -
sasmodels/models/lib/j0_cephes.c
rbfef528 r094e320 44 44 */ 45 45 46 /* y0.c47 *48 * Bessel function of the second kind, order zero49 *50 *51 *52 * SYNOPSIS:53 *54 * double x, y, y0();55 *56 * y = y0( x );57 *58 *59 *60 * DESCRIPTION:61 *62 * Returns Bessel function of the second kind, of order63 * zero, of the argument.64 *65 * The domain is divided into the intervals [0, 5] and66 * (5, infinity). In the first interval a rational approximation67 * R(x) is employed to compute68 * y0(x) = R(x) + 2 * log(x) * j0(x) / PI.69 * Thus a call to j0() is required.70 *71 * In the second interval, the Hankel asymptotic expansion72 * is employed with two rational functions of degree 6/673 * and 7/7.74 *75 *76 *77 * ACCURACY:78 *79 * Absolute error, when y0(x) < 1; else relative error:80 *81 * arithmetic domain # trials peak rms82 * DEC 0, 30 9400 7.0e-17 7.9e-1883 * IEEE 0, 30 30000 1.3e-15 1.6e-1684 *85 */86 87 46 88 47 /* … … 95 54 96 55 double j0( double ); 97 98 56 double j0(double x) { 99 57 … … 291 249 292 250 q = 1.0/x; 293 w = sqrt f(q);251 w = sqrt(q); 294 252 295 253 p = w * polevl( q, MO, 7); 296 254 w = q*q; 297 255 xn = q * polevl( w, PH, 7) - PIO4F; 298 p = p * cos f(xn + xx);256 p = p * cos(xn + xx); 299 257 return(p); 300 258 #endif -
sasmodels/models/lib/j1_cephes.c
rbfef528 re2af2a9 32 32 * IEEE 0, 30 30000 2.6e-16 1.1e-16 33 33 * 34 *35 */36 /* y1.c37 *38 * Bessel function of second kind of order one39 *40 *41 *42 * SYNOPSIS:43 *44 * double x, y, y1();45 *46 * y = y1( x );47 *48 *49 *50 * DESCRIPTION:51 *52 * Returns Bessel function of the second kind of order one53 * of the argument.54 *55 * The domain is divided into the intervals [0, 8] and56 * (8, infinity). In the first interval a 25 term Chebyshev57 * expansion is used, and a call to j1() is required.58 * In the second, the asymptotic trigonometric representation59 * is employed using two rational functions of degree 5/5.60 *61 *62 *63 * ACCURACY:64 *65 * Absolute error:66 * arithmetic domain # trials peak rms67 * DEC 0, 30 10000 8.6e-17 1.3e-1768 * IEEE 0, 30 30000 1.0e-15 1.3e-1669 *70 * (error criterion relative when |y1| > 1).71 34 * 72 35 */ -
sasmodels/models/lib/polevl.c
r3936ad3 re2af2a9 50 50 Direct inquiries to 30 Frost Street, Cambridge, MA 02140 51 51 */ 52 52 53 double polevl( double x, double coef[8], int N ); 53 54 double p1evl( double x, double coef[8], int N );
Note: See TracChangeset
for help on using the changeset viewer.