Changes in / [fdd56a1:f40064d] in sasmodels


Ignore:
Location:
sasmodels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/parallelepiped.py

    r9802ab3 r34a9e4e  
    2222.. note:: 
    2323 
    24    The edge of the solid used to have to satisfy the condition that $A < B < C$. 
    25    After some improvements to the effective radius calculation, used with 
    26    an S(Q), it is beleived that this is no longer the case. 
     24The three dimensions of the parallelepiped (strictly here a cuboid) may be given in  
     25$any$ size order. To avoid multiple fit solutions, especially 
     26with Monte-Carlo fit methods, it may be advisable to restrict their ranges. There may  
     27be a number of closely similar "best fits", so some trial and error, or fixing of some  
     28dimensions at expected values, may help. 
    2729 
    2830The 1D scattering intensity $I(q)$ is calculated as: 
  • sasmodels/models/spherical_sld.py

    r3330bb4 r63a7fe8  
    199199category = "shape:sphere" 
    200200 
    201 SHAPES = [["erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)", 
    202            "Rexp(-|nu|z)", "Lexp(-|nu|z)"]] 
     201SHAPES = ["erf(|nu|*z)", "Rpow(z^|nu|)", "Lpow(z^|nu|)", 
     202          "Rexp(-|nu|z)", "Lexp(-|nu|z)"] 
    203203 
    204204# pylint: disable=bad-whitespace, line-too-long 
     
    209209              ["thickness[n_shells]",  "Ang",        100.0,  [0, inf],       "volume", "thickness shell"], 
    210210              ["interface[n_shells]",  "Ang",        50.0,   [0, inf],       "volume", "thickness of the interface"], 
    211               ["shape[n_shells]",      "",           0,      SHAPES,         "", "interface shape"], 
     211              ["shape[n_shells]",      "",           0,      [SHAPES],       "", "interface shape"], 
    212212              ["nu[n_shells]",         "",           2.5,    [0, inf],       "", "interface shape exponent"], 
    213213              ["n_steps",              "",           35,     [0, inf],       "", "number of steps in each interface (must be an odd integer)"], 
  • sasmodels/models/triaxial_ellipsoid.py

    re645373 r34a9e4e  
    6666    r^2 &= b^2(p_a \sin^2(\phi)(1 - u^2) + 1 + p_c u^2) 
    6767 
     68Though for convenience we describe the three radii of the ellipsoid as equatorial 
     69and polar, they may be given in $any$ size order. To avoid multiple solutions, especially 
     70with Monte-Carlo fit methods, it may be advisable to restrict their ranges. For typical 
     71small angle diffraction situations there may be a number of closely similar "best fits", 
     72so some trial and error, or fixing of some radii at expected values, may help. 
     73     
    6874To provide easy access to the orientation of the triaxial ellipsoid, 
    6975we define the axis of the cylinder using the angles $\theta$, $\phi$ 
    70 and $\psi$. These angles are defined analogously to the elliptical_cylinder below 
     76and $\psi$. These angles are defined analogously to the elliptical_cylinder below, note that 
     77angle $\phi$ is now NOT the same as in the equations above. 
    7178 
    7279.. figure:: img/elliptical_cylinder_angle_definition.png 
    7380 
    74     Definition of angles for oriented triaxial ellipsoid, where radii shown 
    75     here are $a < b << c$ and angle $\Psi$ is a rotation around the axis 
    76     of the particle. 
     81    Definition of angles for oriented triaxial ellipsoid, where radii are for illustration here  
     82    $a < b << c$ and angle $\Psi$ is a rotation around the axis of the particle. 
    7783 
    7884For oriented ellipsoids the *theta*, *phi* and *psi* orientation parameters will appear when fitting 2D data,  
     
    8389.. figure:: img/triaxial_ellipsoid_angle_projection.png 
    8490 
    85     Some example angles for oriented ellipsoid. 
     91    Some examples for an oriented triaxial ellipsoid. 
    8692 
    8793The radius-of-gyration for this system is  $R_g^2 = (R_a R_b R_c)^2/5$. 
     
    9298 
    9399NB: The 2nd virial coefficient of the triaxial solid ellipsoid is 
    94 calculated based on the polar radius $R_p = R_c$ and equatorial 
    95 radius $R_e = \sqrt{R_a R_b}$, and used as the effective radius for 
     100calculated after sorting the three radii to give the most appropriate 
     101prolate or oblate form, from the new polar radius $R_p = R_c$ and effective equatorial 
     102radius,  $R_e = \sqrt{R_a R_b}$, to then be used as the effective radius for 
    96103$S(q)$ when $P(q) \cdot S(q)$ is applied. 
    97104 
     
    125132 
    126133description = """ 
    127    Note - fitting ensure that the inequality ra<rb<rc is not 
    128    violated. Otherwise the calculation may not be correct. 
     134   Triaxial ellipsoid - see main documentation. 
    129135""" 
    130136category = "shape:ellipsoid" 
  • sasmodels/rst2html.py

    rc4e3215 rf2f5413  
    155155    return frame 
    156156 
     157def view_html_wxapp(html, url=""): 
     158    import wx  # type: ignore 
     159    app = wx.App() 
     160    frame = wxview(html, url) 
     161    app.MainLoop() 
     162 
     163def view_url_wxapp(url): 
     164    import wx  # type: ignore 
     165    from wx.html2 import WebView 
     166    app = wx.App() 
     167    frame = wx.Frame(None, -1, size=(850, 540)) 
     168    view = WebView.New(frame) 
     169    view.LoadURL(url) 
     170    frame.Show() 
     171    app.MainLoop() 
     172 
    157173def qtview(html, url=""): 
    158174    try: 
     
    167183    return helpView 
    168184 
    169 def view_html_wxapp(html, url=""): 
    170     import wx  # type: ignore 
    171     app = wx.App() 
    172     frame = wxview(html, url) 
    173     app.MainLoop() 
    174  
    175185def view_html_qtapp(html, url=""): 
    176186    import sys 
     
    183193    sys.exit(app.exec_()) 
    184194 
    185 def view_rst_app(filename, qt=False): 
     195def view_url_qtapp(url): 
     196    import sys 
     197    try: 
     198        from PyQt5.QtWidgets import QApplication 
     199    except ImportError: 
     200        from PyQt4.QtGui import QApplication 
     201    app = QApplication([]) 
     202    try: 
     203        from PyQt5.QtWebKitWidgets import QWebView 
     204        from PyQt5.QtCore import QUrl 
     205    except ImportError: 
     206        from PyQt4.QtWebkit import QWebView 
     207        from PyQt4.QtCore import QUrl 
     208    frame = QWebView() 
     209    frame.load(QUrl(url)) 
     210    frame.show() 
     211    sys.exit(app.exec_()) 
     212 
     213def view_help(filename, qt=False): 
    186214    import os 
    187     html = load_rst_as_html(filename) 
    188     url="file://"+os.path.abspath(filename)+"/" 
    189     if qt: 
    190         view_html_qtapp(html, url) 
     215    url="file:///"+os.path.abspath(filename).replace("\\","/") 
     216    if filename.endswith('.rst'): 
     217        html = load_rst_as_html(filename) 
     218        if qt: 
     219            view_html_qtapp(html, url) 
     220        else: 
     221            view_html_wxapp(html, url) 
    191222    else: 
    192         view_html_wxapp(html, url) 
     223        if qt: 
     224            view_url_qtapp(url) 
     225        else: 
     226            view_url_wxapp(url) 
    193227 
    194228if __name__ == "__main__": 
    195229    import sys 
    196     view_rst_app(sys.argv[1], qt=True) 
    197  
     230    view_help(sys.argv[1], qt=True) 
     231 
Note: See TracChangeset for help on using the changeset viewer.