Changes in / [e4d8726:97e6d3c] in sasmodels
- Files:
-
- 2 added
- 31 deleted
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r4a82d4d r66ebdd6 1 1 /build/ 2 2 /dist/ 3 /logs/4 3 /*.csv 5 4 *.pyc … … 17 16 /.project 18 17 /.pydevproject 19 /.idea20 /sasmodels.egg-info/ -
doc/_extensions/dollarmath.py
r103ea45 r19dcb933 12 12 import re 13 13 14 _dollar = re.compile(r"(?:^|(?<=\s |[(]))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;)\\]))")14 _dollar = re.compile(r"(?:^|(?<=\s))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;\\]))") 15 15 _notdollar = re.compile(r"\\[$]") 16 16 … … 51 51 assert replace_dollar(u"dollar\$ escape")==u"dollar$ escape" 52 52 assert replace_dollar(u"dollar \$escape\$ too")==u"dollar $escape$ too" 53 assert replace_dollar(u"spaces $in the$ math")==u"spaces :math:`in the` math"54 53 assert replace_dollar(u"emb\ $ed$\ ed")==u"emb\ :math:`ed`\ ed" 55 54 assert replace_dollar(u"$first$a")==u"$first$a" 56 55 assert replace_dollar(u"a$last$")==u"a$last$" 57 assert replace_dollar(u"$37")==u"$37"58 assert replace_dollar(u"($37)")==u"($37)"59 assert replace_dollar(u"$37 - $43")==u"$37 - $43"60 assert replace_dollar(u"($37, $38)")==u"($37, $38)"61 56 assert replace_dollar(u"a $mid$dle a")==u"a $mid$dle a" 62 assert replace_dollar(u"a ($in parens$) a")==u"a (:math:`in parens`) a"63 assert replace_dollar(u"a (again $in parens$) a")==u"a (again :math:`in parens`) a"64 57 65 58 if __name__ == "__main__": -
doc/rst_prolog
r0a4628d r19dcb933 60 60 .. |g/cm^3| replace:: g\ |cdot|\ cm\ :sup:`-3` 61 61 .. |fm^2| replace:: fm\ :sup:`2` 62 .. |Ang*cm^-1| replace:: |Ang|\ |cdot|\ cm\ :sup:`-1` -
multi_compare.sh
r0a4628d r5753e4e 1 #!/bin/ bash1 #!/bin/sh 2 2 3 3 sasview=( ../sasview/build/lib.* ) -
sasmodels/convert.py
r34d6cab r3964f92 10 10 'broad_peak', 11 11 'two_lorentzian', 12 "two_power_law",13 12 'gel_fit', 14 13 'gauss_lorentz_gel', … … 152 151 pars['string_thickness_pd_n'] = 0 153 152 pars['number_of_pearls_pd_n'] = 0 154 elif name == 'line':155 pars['scale'] = 1156 pars['background'] = 0157 153 elif name == 'rpa': 158 154 pars['case_num'] = int(pars['case_num']) -
sasmodels/generate.py
rfa8011eb reafc9fa 191 191 The function :func:`make` loads the metadata from the module and returns 192 192 the kernel source. The function :func:`doc` extracts the doc string 193 and adds the parameter table to the top. The function :func:` model_sources`193 and adds the parameter table to the top. The function :func:`sources` 194 194 returns a list of files required by the model. 195 195 """ … … 206 206 import numpy as np 207 207 208 #__all__ = ["make", "doc", "model_sources", "convert_type"]208 __all__ = ["make", "doc", "sources", "convert_type"] 209 209 210 210 C_KERNEL_TEMPLATE_PATH = joinpath(dirname(__file__), 'kernel_template.c') … … 233 233 "degrees": "degree", 234 234 "1/cm": "|cm^-1|", 235 "Ang/cm": "|Ang*cm^-1|",236 235 "": "None", 237 236 } -
sasmodels/kernel_template.c
r960cd80 r840b859 12 12 #ifndef USE_OPENCL 13 13 # ifdef __cplusplus 14 15 16 17 14 #include <cstdio> 15 #include <cmath> 16 using namespace std; 17 #if defined(_MSC_VER) 18 18 #include <limits> 19 19 #include <float.h> 20 20 #define kernel extern "C" __declspec( dllexport ) 21 21 inline double trunc(double x) { return x>=0?floor(x):-floor(-x); } 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 +1.2617719307481059087798E-4)*xsq37 +3.0299440770744196129956E-2)*xsq38 +9.9999999999999999991025E-1);39 const double q = ((((40 +3.0019850513866445504159E-6)*xsq41 +2.5244834034968410419224E-3)*xsq42 +2.2726554820815502876593E-1)*xsq43 +2.0000000000000000000897E0);44 double r = x * p;45 46 47 48 49 22 inline double fmin(double x, double y) { return x>y ? y : x; } 23 inline double fmax(double x, double y) { return x<y ? y : x; } 24 inline double isnan(double x) { return _isnan(x); } 25 #define NAN (std::numeric_limits<double>::quiet_NaN()) // non-signalling NaN 26 static double cephes_expm1(double x) { 27 // Adapted from the cephes math library. 28 // Copyright 1984 - 1992 by Stephen L. Moshier 29 if (x != x || x == 0.0) { 30 return x; // NaN and +/- 0 31 } else if (x < -0.5 || x > 0.5) { 32 return exp(x) - 1.0; 33 } else { 34 const double xsq = x*x; 35 const double p = ((( 36 +1.2617719307481059087798E-4)*xsq 37 +3.0299440770744196129956E-2)*xsq 38 +9.9999999999999999991025E-1); 39 const double q = (((( 40 +3.0019850513866445504159E-6)*xsq 41 +2.5244834034968410419224E-3)*xsq 42 +2.2726554820815502876593E-1)*xsq 43 +2.0000000000000000000897E0); 44 double r = x * p; 45 r = r / (q - r); 46 return r+r; 47 } 48 } 49 #define expm1 cephes_expm1 50 50 #else 51 51 #define kernel extern "C" … … 260 260 const double vol_weight = VOLUME_WEIGHT_PRODUCT; 261 261 vol += vol_weight*form_volume(VOLUME_PARAMETERS); 262 #endif 262 263 norm_vol += vol_weight; 263 #endif264 264 } 265 265 //else { printf("exclude qx,qy,I:%%g,%%g,%%g\n",qi,scattering); } -
sasmodels/models/be_polyelectrolyte.py
r0e86967 r168052c 127 127 :return: 2D-Intensity 128 128 """ 129 i ntensity= Iq(sqrt(qx**2 + qy**2), *args)130 return i ntensity129 iq = Iq(sqrt(qx**2 + qy**2), *args) 130 return iq 131 131 132 132 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values -
sasmodels/models/core_shell_bicelle.py
rfa8011eb r8007311 7 7 The form factor is normalized by the particle volume. 8 8 9 .. _core-shell- bicelle-geometry:9 .. _core-shell-cylinder-geometry: 10 10 11 11 .. figure:: img/core_shell_bicelle_geometry.png -
sasmodels/models/core_shell_cylinder.py
rf0aa7f8 reb69cce 155 155 156 156 def ER(radius, thickness, length): 157 """158 Returns the effective radius used in the S*P calculation159 """160 157 radius = radius + thickness 161 158 length = length + 2 * thickness … … 164 161 165 162 def VR(radius, thickness, length): 166 """167 Returns volume ratio168 """169 163 whole = pi * (radius + thickness) ** 2 * (length + 2 * thickness) 170 164 core = pi * radius ** 2 * length -
sasmodels/models/correlation_length.py
r3e6c5c1 r5054e80 78 78 # names and the target sasview model name. 79 79 oldname = 'CorrLengthModel' 80 # pylint: disable=bad-continuation 81 oldpars = dict( 82 lorentz_scale='scale_l', porod_scale='scale_p', 83 cor_length='length_l', exponent_p='exponent_p', 84 exponent_l='exponent_l' 85 ) 80 86 81 oldpars = dict(lorentz_scale='scale_l', porod_scale='scale_p', 82 cor_length='length_l', exponent_p='exponent_p', 83 exponent_l='exponent_l') 84 85 tests = [[{}, 0.001, 1009.98], 87 tests = [ 88 [{}, 0.001, 1009.98], 86 89 [{}, 0.150141, 0.174645], 87 [{}, 0.442528, 0.0203957]] 90 [{}, 0.442528, 0.0203957] 91 ] 92 # pylint: enable=bad-continuation -
sasmodels/models/cylinder.py
r0c3a226 reb69cce 144 144 145 145 def ER(radius, length): 146 """147 Return equivalent radius (ER)148 """149 146 ddd = 0.75 * radius * (2 * radius * length + (length + radius) * (length + pi * radius)) 150 147 return 0.5 * (ddd) ** (1. / 3.) -
sasmodels/models/dab.py
r94bd809 reb69cce 1 1 r""" 2 2 3 Calculates the scattering from a randomly distributed, two-phase system based on 3 4 the Debye-Anderson-Brumberger (DAB) model for such systems. The two-phase system -
sasmodels/models/ellipsoid.py
r431caae r9c461c7 111 111 ---------- 112 112 113 L A Feigin and D I Svergun. 114 *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, 115 Plenum Press, New York, 1987. 113 L A Feigin and D I Svergun. *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 114 New York, 1987. 116 115 """ 117 116 -
sasmodels/models/fcc.py
rc0ccea8 r9aac25d 114 114 single = False 115 115 116 # pylint: disable=bad-whitespace, line-too-long117 116 # ["name", "units", default, [lower, upper], "type","description"], 118 117 parameters = [["dnn", "Ang", 220, [-inf, inf], "", "Nearest neighbour distance"], … … 125 124 ["psi", "degrees", 60, [-inf, inf], "orientation", "Out of plane angle"] 126 125 ] 127 # pylint: enable=bad-whitespace, line-too-long128 126 129 127 source = ["lib/J1.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc.c"] -
sasmodels/models/guinier.py
r723cebe reb69cce 36 36 37 37 # ["name", "units", default, [lower, upper], "type","description"], 38 parameters = [["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"]] 38 parameters = [ 39 ["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"], 40 ] 39 41 40 42 Iq = """ … … 49 51 50 52 # parameters for demo 51 demo = dict(scale=1.0, 53 demo = dict(scale=1.0,rg=60.0) 52 54 53 55 # For testing against the old sasview models, include the converted parameter … … 57 59 58 60 # parameters for unit tests 59 tests = [[{'rg' : 31.5}, 0.005, 0.991756]] 61 tests = [ 62 [{'rg' : 31.5}, 0.005, 0.991756] 63 ] -
sasmodels/models/hollow_cylinder.py
re0fd913 rec2ca99 93 93 source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 94 94 95 # pylint: disable=W061396 95 def ER(radius, core_radius, length): 97 96 """ -
sasmodels/models/lamellarCailleHG.py
r652a78a r13ed84c 146 146 solvent_sld='sld_solvent') 147 147 # 148 tests = [[{'scale': 1.0, 'background': 0.0, 'tail_length': 10.0, 'head_length': 2.0, 149 'Nlayers': 30.0, 'spacing': 40., 'Caille_parameter': 0.001, 'sld': 0.4, 150 'head_sld': 2.0, 'solvent_sld': 6.0, 'tail_length_pd': 0.0, 151 'head_length_pd': 0.0, 'spacing_pd': 0.0}, [0.001], [6838238.571488]]] 148 tests = [ 149 [ {'scale': 1.0, 'background' : 0.0, 'tail_length' : 10.0, 'head_length' : 2.0,'Nlayers' : 30.0, 'spacing' : 40., 150 'Caille_parameter' : 0.001, 'sld' : 0.4, 'head_sld' : 2.0, 'solvent_sld' : 6.0, 151 'tail_length_pd' : 0.0, 'head_length_pd' : 0.0, 'spacing_pd' : 0.0 }, [0.001], [6838238.571488]] 152 ] -
sasmodels/models/lamellarFFHG.py
r3eb6b90 r7f47777 68 68 category = "shape:lamellae" 69 69 70 # pylint: disable=bad-whitespace, line-too-long71 70 # ["name", "units", default, [lower, upper], "type","description"], 72 parameters = [["tail_length", "Ang", 15, [0, inf], "volume", "Tail thickness"], 73 ["head_length", "Ang", 10, [0, inf], "volume", "head thickness"], 74 ["sld", "1e-6/Ang^2", 0.4, [-inf,inf], "", "Tail scattering length density"], 75 ["head_sld", "1e-6/Ang^2", 3.0, [-inf,inf], "", "Head scattering length density"], 76 ["solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", "Solvent scattering length density"]] 77 # pylint: enable=bad-whitespace, line-too-long 71 parameters = [["tail_length", "Ang", 15, [0, inf], "volume", 72 "Tail thickness"], 73 ["head_length", "Ang", 10, [0, inf], "volume", 74 "head thickness"], 75 ["sld", "1e-6/Ang^2", 0.4, [-inf,inf], "", 76 "Tail scattering length density"], 77 ["head_sld", "1e-6/Ang^2", 3.0, [-inf,inf], "", 78 "Head scattering length density"], 79 ["solvent_sld", "1e-6/Ang^2", 6, [-inf,inf], "", 80 "Solvent scattering length density"], 81 ] 78 82 79 83 # No volume normalization despite having a volume parameter … … 109 113 110 114 demo = dict(scale=1, background=0, 111 tail_length=15, 115 tail_length=15,head_length=10, 112 116 sld=0.4, head_sld=3.0, solvent_sld=6.0, 113 tail_length_pd= 0.2, tail_length_pd_n=40,114 head_length_pd= 0.01, head_length_pd_n=40)117 tail_length_pd= 0.2, tail_length_pd_n=40, 118 head_length_pd= 0.01, head_length_pd_n=40) 115 119 116 120 oldname = 'LamellarFFHGModel' … … 118 122 sld='sld_tail', head_sld='sld_head', solvent_sld='sld_solvent') 119 123 # 120 tests = [[{'scale': 1.0, 'background': 0.0, 'tail_length': 15.0, 'head_length': 10.0, 121 'sld': 0.4, 'head_sld': 3.0, 'solvent_sld': 6.0}, [0.001], [653143.9209]]] 124 tests = [ 125 [ {'scale': 1.0, 'background' : 0.0, 'tail_length' : 15.0, 'head_length' : 10.0,'sld' : 0.4, 126 'head_sld' : 3.0, 'solvent_sld' : 6.0, }, [0.001], [653143.9209]] 127 ] 128 129 -
sasmodels/models/lib/gauss76.c
r66d119f r994d77f 7 7 * 8 8 */ 9 #define N_POINTS_76 7610 9 11 10 // Gaussians 12 constant double Gauss76Wt[ N_POINTS_76]={11 constant double Gauss76Wt[76]={ 13 12 .00126779163408536, //0 14 13 .00294910295364247, … … 89 88 }; 90 89 91 constant double Gauss76Z[ N_POINTS_76]={90 constant double Gauss76Z[76]={ 92 91 -.999505948362153, //0 93 92 -.997397786355355, -
sasmodels/models/lorentz.py
reb5901b reb69cce 56 56 57 57 # parameters for demo 58 demo = dict(scale=1.0, background=0.0,cor_length=50.0)58 demo = dict(scale=1.0,background=0.0,cor_length=50.0) 59 59 60 60 # For testing against the old sasview models, include the converted parameter … … 64 64 65 65 # parameters for unit tests 66 tests = [[{'cor_length': 250}, 0.01, 0.137931]] 66 tests = [ 67 [{'cor_length' : 250},0.01,0.137931] 68 ] -
sasmodels/models/peak_lorentz.py
r04b0b30 r14ba6f6 11 11 I(q) = \frac{scale}{\bigl(1+\bigl(\frac{q-q_0}{B}\bigr)^2\bigr)} + background 12 12 13 with the peak having height of $I_0$ centered at $q_0$ and having 14 a HWHM (half-width half-maximum) of B. 13 with the peak having height of $I_0$ centered at $q_0$ and having a HWHM (half-width half-maximum) of B. 15 14 16 15 For 2D data the scattering intensity is calculated in the same way as 1D, … … 56 55 57 56 def Iq(q, peak_pos, peak_hwhm): 58 """59 Return I(q)60 """61 57 inten = (1/(1+((q-peak_pos)/peak_hwhm)**2)) 62 58 return inten … … 64 60 65 61 def Iqxy(qx, qy, *args): 66 """67 Return I(qx, qy)68 """69 62 return Iq(sqrt(qx ** 2 + qy ** 2), *args) 70 63 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values -
sasmodels/models/rpa.py
rfa8011eb r82c299f 43 43 component. 44 44 45 .. figure:: img/ rpa_1d.jpg45 .. figure:: img/image215.jpg 46 46 47 47 1D plot using the default values (w/500 data points). … … 89 89 # ["name", "units", default, [lower, upper], "type","description"], 90 90 parameters = [ 91 ["case_num", CASES, 0, [0, 10], "", "Component organization" ],91 ["case_num", CASES, 0, [0, 10], "", "Component organization" ], 92 92 93 93 ["Na", "", 1000.0, [1, inf], "", "Degree of polymerization"], -
sasmodels/models/sphere.py
rc691551 r9c461c7 100 100 101 101 def ER(radius): 102 """103 Return equivalent radius (ER)104 """105 102 return radius 106 103 -
sasmodels/models/spherepy.py
rd2950f4 reb69cce 118 118 g[low] = sqrt(1 - dlow2 / 4.) * (1 + dlow2 / 8.) + dlow2 / 2.*(1 - dlow2 / 16.) * log(dlow / (2. + sqrt(4. - dlow2))) 119 119 return g 120 sesans.vectorized = True # sesans accepts an array of z values120 sesans.vectorized = True # sesans accepts and array of z values 121 121 122 122 def ER(radius): -
sasmodels/models/triaxial_ellipsoid.py
r469e763 r9c461c7 82 82 ---------- 83 83 84 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray 85 and Neutron Scattering*, Plenum,New York, 1987.84 L A Feigin and D I Svergun, *Structure Analysis by Small-Angle X-Ray and Neutron Scattering*, Plenum, 85 New York, 1987. 86 86 """ 87 87 … … 120 120 121 121 def ER(req_minor, req_major, rpolar): 122 """123 Returns the effective radius used in the S*P calculation124 """125 122 import numpy as np 126 123 from .ellipsoid import ER as ellipsoid_ER -
sasmodels/models/vesicle.py
rfa8011eb r216fa6d 24 24 is a flat background level (due for example to incoherent scattering in the 25 25 case of neutrons), and $j_1$ is the spherical bessel function 26 $j_1 = ( \sin(x) - x \cos(x))/ x^2$.26 $j_1 = (sin(x) - x cos(x))/ x^2$. 27 27 28 28 The functional form is identical to a "typical" core-shell structure, except … … 35 35 thickness = $R_{\text{tot}} - R_{\text{core}}$. 36 36 37 .. figure:: img/vesicle_geometry.jpg 38 39 Vesicle geometry. 37 .. figure: img/vesicle_geometry.jpg 40 38 41 39 The 2D scattering intensity is the same as *P(q)* above, regardless of the … … 50 48 radius for *S(Q)* when *P(Q)* \* *S(Q)* is applied. 51 49 52 .. figure:: img/vesicle_1d.jpg50 .. image:: img/vesicle_1d.jpg 53 51 54 1D plot using the default values given in the table (w/200 data point). 55 Polydispersity and instrumental resolution normally will smear out most 56 of the rapidly oscillating features. 52 *Figure. 1D plot using the default values given in the table 53 (w/200 data point). Polydispersity and instrumental resolution normally 54 will smear out most of the rapidly oscillating features.* 57 55 58 56 REFERENCE … … 62 60 """ 63 61 62 import numpy as np 64 63 from numpy import pi, inf 65 64 … … 132 131 # NOTE: test results taken from values returned by SasView 3.1.2 133 132 tests = [[{}, 0.0010005303255, 17139.8268799], 134 [{}, 0.200027832249, 0.130387268704 ],133 [{}, 0.200027832249, 0.130387268704 ], 135 134 [{}, 'ER', 130.], 136 135 [{}, 'VR', 0.54483386436], -
setup.py
r3eb3312 r040575f 11 11 version = "1.0.0a", 12 12 description = "sasmodels package", 13 long_description=open('README. md').read(),13 long_description=open('README.rst').read(), 14 14 author = "SasView Collaboration", 15 15 author_email = "management@sasview.org",
Note: See TracChangeset
for help on using the changeset viewer.