Changeset 84db7a5 in sasmodels for sasmodels


Ignore:
Timestamp:
Mar 17, 2016 8:47:47 AM (8 years ago)
Author:
krzywon
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:
6824af5
Parents:
4373d62
Message:

Updated sesans scripting to be more command line focused AND modified hardsphere to effect_radius.

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/data.py

    r7824276 r84db7a5  
    440440 
    441441    if use_data or use_theory: 
     442        is_tof = np.any(data.lam!=data.lam[0]) 
    442443        if num_plots > 1: 
    443444            plt.subplot(1, num_plots, 1) 
    444445        if use_data: 
    445             plt.errorbar(data.x, data.y, yerr=data.dy) 
     446            if is_tof: 
     447                plt.errorbar(data.x, np.log(data.y)/(data.lam*data.lam), yerr=data.dy/data.y/(data.lam*data.lam)) 
     448            else: 
     449                plt.errorbar(data.x, data.y, yerr=data.dy) 
    446450        if theory is not None: 
    447             plt.plot(data.x, theory, '-', hold=True) 
     451            if is_tof: 
     452                plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-', hold=True) 
     453            else: 
     454                plt.plot(data.x, theory, '-', hold=True) 
    448455        if limits is not None: 
    449456            plt.ylim(*limits) 
    450         plt.xlabel('spin echo length (nm)') 
    451         plt.ylabel('polarization (P/P0)') 
     457 
     458        plt.xlabel('spin echo length ({})'.format(data._xunit)) 
     459        if is_tof: 
     460            plt.ylabel('(Log (P/P$_0$))/$\lambda^2$') 
     461        else: 
     462            plt.ylabel('polarization (P/P0)') 
     463 
    452464 
    453465    if resid is not None: 
     
    455467            plt.subplot(1, num_plots, (use_data or use_theory) + 1) 
    456468        plt.plot(data.x, resid, 'x') 
    457         plt.xlabel('spin echo length (nm)') 
     469        plt.xlabel('spin echo length ({})'.format(data._xunit)) 
    458470        plt.ylabel('residuals (P/P0)') 
    459471 
  • sasmodels/models/hardsphere.py

    raa2edb2 r84db7a5  
    77the maths needs to be modified (no \Beta(Q) correction yet in sasview). 
    88 
    9 radius_effective is the effective hard sphere radius. 
     9effect_radius is the effective hard sphere radius. 
    1010volfraction is the volume fraction occupied by the spheres. 
    1111 
     
    5353        systems. Though strictly the maths needs to be modified - 
    5454    which sasview does not do yet. 
    55     radius_effective is the hard sphere radius 
     55    effect_radius is the hard sphere radius 
    5656    volfraction is the volume fraction occupied by the spheres. 
    5757""" 
     
    6060 
    6161#             ["name", "units", default, [lower, upper], "type","description"], 
    62 parameters = [["radius_effective", "Ang", 50.0, [0, inf], "volume", 
     62parameters = [["effect_radius", "Ang", 50.0, [0, inf], "volume", 
    6363               "effective radius of hard sphere"], 
    6464              ["volfraction", "", 0.2, [0, 0.74], "", 
     
    7575      double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 
    7676 
    77       if(fabs(radius_effective) < 1.E-12) { 
     77      if(fabs(effect_radius) < 1.E-12) { 
    7878               HARDSPH=1.0; 
    7979               return(HARDSPH); 
     
    8484      A= (1.+2.*volfraction)*D; 
    8585      A *=A; 
    86       X=fabs(q*radius_effective*2.0); 
     86      X=fabs(q*effect_radius*2.0); 
    8787 
    8888      if(X < 5.E-06) { 
     
    147147# VR defaults to 1.0 
    148148 
    149 demo = dict(radius_effective=200, volfraction=0.2, radius_effective_pd=0.1, radius_effective_pd_n=40) 
     149demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 
    150150oldname = 'HardsphereStructure' 
    151 oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     151oldpars = dict(effect_radius="effect_radius",effect_radius_pd="effect_radius_pd",effect_radius_pd_n="effect_radius_pd_n") 
    152152# Q=0.001 is in the Taylor series, low Q part, so add Q=0.1, assuming double precision sasview is correct 
    153153tests = [ 
    154         [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'volfraction' : 0.2, 
    155            'radius_effective_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
     154        [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'volfraction' : 0.2, 
     155           'effect_radius_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
    156156        ] 
    157157# ADDED by: RKH  ON: 16Mar2016  using equations from FISH as better than orig sasview, see notes above. Added Taylor expansions at small Q,  
Note: See TracChangeset for help on using the changeset viewer.