Changes in / [98c045a:89dba62] in sasmodels


Ignore:
Location:
sasmodels
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/conversion_table.py

    rdb1d9d5 ref476e6  
    854854            "TwoPowerLawModel", 
    855855        ], 
    856         "unified_power_rg": [ 
     856        "unified_power_Rg": [ 
    857857            "UnifiedPowerRg", 
    858858            dict(((field_new+str(index), field_old+str(index)) 
  • sasmodels/convert.py

    rdb1d9d5 ref476e6  
    606606            if pars['volfraction_a'] > 0.5: 
    607607                pars['volfraction_a'] = 1.0 - pars['volfraction_a'] 
    608         elif name == 'unified_power_rg': 
     608        elif name == 'unified_power_Rg': 
    609609            pars['level'] = int(pars['level']) 
    610610 
  • sasmodels/kernel_iq.c

    ra34b811 r8973e0d  
    8585static void set_spin_weights(double in_spin, double out_spin, double weight[6]) 
    8686{ 
     87 
     88  double norm; 
    8789  in_spin = clip(in_spin, 0.0, 1.0); 
    8890  out_spin = clip(out_spin, 0.0, 1.0); 
     
    9496  // However, since the weights are applied to the final intensity and 
    9597  // are not interned inside the I(q) function, we want the full 
    96   // weight and not the square root.  Any function using 
    97   // set_spin_weights as part of calculating an amplitude will need to 
    98   // manually take that square root, but there is currently no such 
    99   // function. 
    100   weight[0] = (1.0-in_spin) * (1.0-out_spin); // dd 
    101   weight[1] = (1.0-in_spin) * out_spin;       // du 
    102   weight[2] = in_spin * (1.0-out_spin);       // ud 
    103   weight[3] = in_spin * out_spin;             // uu 
     98  // weight and not the square root.  Anyway no function will ever use 
     99  // set_spin_weights as part of calculating an amplitude, as the weights are 
     100  // related to polarisation efficiency of the instrument. The weights serve to 
     101  // construct various magnet scattering cross sections, which are linear combinations 
     102  // of the spin-resolved cross sections. The polarisation efficiency e_in and e_out 
     103  // are parameters ranging from 0.5 (unpolarised) beam to 1 (perfect optics). 
     104  // For in_spin or out_spin <0.5 one assumes a CS, where the spin is reversed/flipped 
     105  // with respect to the initial supermirror polariser. The actual polarisation efficiency 
     106  // in this case is however e_in/out = 1-in/out_spin. 
     107 
     108  if (out_spin < 0.5){norm=1-out_spin;} 
     109  else{norm=out_spin;} 
     110 
     111 
     112// The norm is needed to make sure that the scattering cross sections are 
     113//correctly weighted, such that the sum of spin-resolved measurements adds up to 
     114// the unpolarised or half-polarised scattering cross section. No intensity weighting 
     115// needed on the incoming polariser side (assuming that a user), has normalised 
     116// to the incoming flux with polariser in for SANSPOl and unpolarised beam, respectively. 
     117 
     118 
     119  weight[0] = (1.0-in_spin) * (1.0-out_spin) / norm; // dd 
     120  weight[1] = (1.0-in_spin) * out_spin / norm;       // du 
     121  weight[2] = in_spin * (1.0-out_spin) / norm;       // ud 
     122  weight[3] = in_spin * out_spin / norm;             // uu 
    104123  weight[4] = weight[1]; // du.imag 
    105124  weight[5] = weight[2]; // ud.imag 
     
    119138    switch (xs) { 
    120139      default: // keep compiler happy; condition ensures xs in [0,1,2,3] 
    121       case 0: // uu => sld - D M_perpx 
     140      case 0: // dd => sld - D M_perpx 
    122141          return sld - px*perp; 
    123       case 1: // ud.real => -D M_perpy 
     142      case 1: // du.real => -D M_perpy 
    124143          return py*perp; 
    125       case 2: // du.real => -D M_perpy 
     144      case 2: // ud.real => -D M_perpy 
    126145          return py*perp; 
    127       case 3: // dd => sld + D M_perpx 
     146      case 3: // uu => sld + D M_perpx 
    128147          return sld + px*perp; 
    129148    } 
  • sasmodels/models/spherical_sld.py

    ra34b811 r627b68b  
    1818sub-shell is described by a line function, with *n_steps* sub-shells per 
    1919interface. The form factor is normalized by the total volume of the sphere. 
     20 
     21.. note:: 
     22 
     23   *n_shells* must be an integer. *n_steps* must be an ODD integer. 
    2024 
    2125Interface shapes are as follows: 
     
    7377    3 \rho_\text{solvent} V(r_N) 
    7478    \Big[ \frac{\sin(qr_N) - qr_N \cos(qr_N)} {qr_N^3} \Big] 
    75  
    7679 
    7780Here we assumed that the SLDs of the core and solvent are constant in $r$. 
     
    156159    \end{align*} 
    157160 
    158  
    159161We assume $\rho_{\text{inter}_j} (r)$ is approximately linear 
    160162within the sub-shell $j$. 
     
    179181    when $P(Q) * S(Q)$ is applied. 
    180182 
    181  
    182183References 
    183184---------- 
     
    194195 
    195196Authorship and Verification 
    196 ---------------------------- 
     197--------------------------- 
    197198 
    198199* **Author:** Jae-Hie Cho **Date:** Nov 1, 2010 
    199200* **Last Modified by:** Paul Kienzle **Date:** Dec 20, 2016 
    200 * **Last Reviewed by:** Paul Butler **Date:** September 8, 2018 
     201* **Last Reviewed by:** Steve King **Date:** March 29, 2019 
    201202* **Source added by :** Steve King **Date:** March 25, 2019 
    202203""" 
     
    207208 
    208209name = "spherical_sld" 
    209 title = "Sperical SLD intensity calculation" 
     210title = "Spherical SLD intensity calculation" 
    210211description = """ 
    211212            I(q) = 
     
    219220# pylint: disable=bad-whitespace, line-too-long 
    220221#            ["name", "units", default, [lower, upper], "type", "description"], 
    221 parameters = [["n_shells",             "",           1,      [1, 10],        "volume", "number of shells"], 
     222parameters = [["n_shells",             "",           1,      [1, 10],        "volume", "number of shells (must be integer)"], 
    222223              ["sld_solvent",          "1e-6/Ang^2", 1.0,    [-inf, inf],    "sld", "solvent sld"], 
    223224              ["sld[n_shells]",        "1e-6/Ang^2", 4.06,   [-inf, inf],    "sld", "sld of the shell"], 
Note: See TracChangeset for help on using the changeset viewer.