Changeset 98f3053 in sasmodels


Ignore:
Timestamp:
Feb 8, 2016 5:27:39 AM (9 years ago)
Author:
piotr
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:
ec2ca99
Parents:
9aac25d (diff), 216fa6d (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 remote-tracking branch 'origin/master'

Location:
sasmodels
Files:
11 added
7 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/compare.py

    rd07c883 rd5e650d  
    539539    if Ncomp > 0 and Nbase > 0: 
    540540        plt.subplot(133) 
    541         if '-abs' in opts: 
     541        if not opts['rel_err']: 
    542542            err, errstr, errview = resid, "abs err", "linear" 
    543543        else: 
     
    545545        #err,errstr = base/comp,"ratio" 
    546546        plot_theory(data, None, resid=err, view=errview, use_data=False) 
     547        if view == 'linear': 
     548            plt.xscale('linear') 
    547549        plt.title("max %s = %.3g"%(errstr, max(abs(err)))) 
    548550        #cbar_title = errstr if errview=="linear" else "log "+errstr 
  • sasmodels/convert.py

    r5054e80 r3964f92  
    1414    'be_polyelectrolyte', 
    1515    'correlation_length', 
     16    'binary_hard_sphere' 
    1617] 
    1718 
  • sasmodels/kernel_template.c

    rcaf768d r840b859  
    1616     using namespace std; 
    1717     #if defined(_MSC_VER) 
     18         #include <limits> 
    1819         #include <float.h> 
    1920         #define kernel extern "C" __declspec( dllexport ) 
     
    2223             inline double fmax(double x, double y) { return x<y ? y : x; } 
    2324             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 
    2450     #else 
    2551         #define kernel extern "C" 
  • sasmodels/models/bcc.c

    r7ed702f r9aac25d  
    4040} 
    4141 
    42 double _sphereform(double q, double radius, double sld, double solvent_sld){ 
    43     const double qr = q*radius; 
    44     double sn, cn; 
    45     SINCOS(qr, sn, cn); 
    46     const double bes = (qr == 0.0 ? 1.0 : 3.0*(sn-qr*cn)/(qr*qr*qr)); 
    47     const double fq = bes * (sld - solvent_sld)*form_volume(radius); 
    48     return 1.0e-4*fq*fq; 
    49 } 
    5042 
    5143double form_volume(double radius){ 
     
    8779 
    8880        answer = (vb-va)/2.0*summ; 
    89         answer = answer*_sphereform(q,radius,sld,solvent_sld)*latticescale; 
     81        answer = answer*sphere_form(q,radius,sld,solvent_sld)*latticescale; 
    9082 
    9183    return answer; 
     
    174166 
    175167  // Use SphereForm directly from libigor 
    176   answer = _sphereform(q,radius,sld,solvent_sld)*Zq*latticescale; 
     168  answer = sphere_form(q,radius,sld,solvent_sld)*Zq*latticescale; 
    177169 
    178170  return answer; 
  • sasmodels/models/bcc.py

    r13ed84c r9aac25d  
    132132# pylint: enable=bad-whitespace, line-too-long 
    133133 
    134 source = ["lib/J1.c", "lib/gauss150.c", "bcc.c"] 
     134source = ["lib/J1.c", "lib/gauss150.c", "lib/sphere_form.c", "bcc.c"] 
    135135 
    136136# parameters for demo 
  • sasmodels/models/fcc.c

    reeb8bac r9aac25d  
    77double _FCC_Integrand(double q, double dnn, double d_factor, double theta, double phi); 
    88double _FCCeval(double Theta, double Phi, double temp1, double temp3); 
    9 double _sphereform(double q, double radius, double sld, double solvent_sld); 
    109 
    1110 
     
    3938 
    4039        return (result); 
    41 } 
    42  
    43 double _sphereform(double q, double radius, double sld, double solvent_sld){ 
    44     const double qr = q*radius; 
    45     double sn, cn; 
    46     SINCOS(qr, sn, cn); 
    47     const double bes = (qr == 0.0 ? 1.0 : 3.0*(sn-qr*cn)/(qr*qr*qr)); 
    48     const double fq = bes * (sld - solvent_sld)*form_volume(radius); 
    49     return 1.0e-4*fq*fq; 
    5040} 
    5141 
     
    8878 
    8979        answer = (vb-va)/2.0*summ; 
    90         answer = answer*_sphereform(q,radius,sld,solvent_sld)*latticescale; 
     80        answer = answer*sphere_form(q,radius,sld,solvent_sld)*latticescale; 
    9181 
    9282    return answer; 
     
    175165 
    176166  // Use SphereForm directly from libigor 
    177   answer = _sphereform(q,radius,sld,solvent_sld)*Zq*latticescale; 
     167  answer = sphere_form(q,radius,sld,solvent_sld)*Zq*latticescale; 
    178168 
    179169  return answer; 
  • sasmodels/models/fcc.py

    r13ed84c r9aac25d  
    125125             ] 
    126126 
    127 source = ["lib/J1.c", "lib/gauss150.c", "fcc.c"] 
     127source = ["lib/J1.c", "lib/gauss150.c", "lib/sphere_form.c", "fcc.c"] 
    128128 
    129129# parameters for demo 
Note: See TracChangeset for help on using the changeset viewer.