Changeset 8f04da4 in sasmodels for sasmodels/models/hardsphere.py


Ignore:
Timestamp:
Aug 2, 2017 2:53:56 AM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
bd21b12
Parents:
1511c37c
Message:

tuned random model generation for more models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/hardsphere.py

    r40a87fa r8f04da4  
    7575Iq = r""" 
    7676      double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 
    77       // these are c compiler instructions, can also put normal code inside the "if else" structure  
     77      // these are c compiler instructions, can also put normal code inside the "if else" structure 
    7878      #if FLOAT_SIZE > 4 
    7979      // double precision    orig had 0.2, don't call the variable cutoff as PAK already has one called that! Must use UPPERCASE name please. 
     
    8282      #else 
    8383      // 0.1 bad, 0.2 OK, 0.3 good, 0.4 better, 0.8 no good 
    84       #define CUTOFFHS 0.4   
     84      #define CUTOFFHS 0.4 
    8585      #endif 
    8686 
     
    110110      if(X < CUTOFFHS) { 
    111111      // RKH Feb 2016, use Taylor series expansion for small X 
    112       // else no obvious way to rearrange the equations to avoid needing a very high number of significant figures.  
    113       // Series expansion found using Mathematica software. Numerical test in .xls showed terms to X^2 are sufficient  
    114       // for 5 or 6 significant figures, but I put the X^4 one in anyway  
     112      // else no obvious way to rearrange the equations to avoid needing a very high number of significant figures. 
     113      // Series expansion found using Mathematica software. Numerical test in .xls showed terms to X^2 are sufficient 
     114      // for 5 or 6 significant figures, but I put the X^4 one in anyway 
    115115            //FF = 8*A +6*B + 4*G - (0.8*A +2.0*B/3.0 +0.5*G)*X2 +(A/35. +B/40. +G/50.)*X4; 
    116116            // refactoring the polynomial makes it very slightly faster (0.5 not 0.6 msec) 
     
    153153   """ 
    154154 
     155def random(): 
     156    import numpy as np 
     157    pars = dict( 
     158        scale=1, background=0, 
     159        radius_effective=10**np.random.uniform(1, 4), 
     160        volfraction=10**np.random.uniform(-2, 0),  # high volume fraction 
     161    ) 
     162    return pars 
     163 
    155164# ER defaults to 0.0 
    156165# VR defaults to 1.0 
Note: See TracChangeset for help on using the changeset viewer.