Changeset b52e00f in sasmodels for doc


Ignore:
Timestamp:
Jun 16, 2017 10:01:31 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:
c26897a
Parents:
a03fad8 (diff), c1114bf (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 branch 'master' into doc_update

Location:
doc
Files:
13 added
3 deleted
8 edited
9 moved

Legend:

Unmodified
Added
Removed
  • doc/guide/gpu/gpu_computations.rst

    r8ae8532 rb52e00f  
    3131from available OpenCL platforms. 
    3232 
     33OpenCL devices can be set from OpenCL options dialog in Fitting menu or as 
     34enviromental variables. 
     35 
     36**If you don't want to use OpenCL, you can select "No OpenCL" option from** 
     37**GUI dialog or set *SAS_OPENCL=None* in your environment settings** 
     38**This will only use normal programs.** 
     39 
    3340SasView prefers AMD or NVIDIA drivers for GPU, and prefers Intel or 
    3441Apple drivers for CPU. Both GPU and CPU are included on the assumption that CPU 
     
    3946chose to run the model. 
    4047 
    41 **If you don't want to use OpenCL, you can set** *SAS_OPENCL=None* 
    42 **in your environment settings, and it will only use normal programs.** 
    43  
    44 If you want to use one of the other devices, you can run the following 
    45 from the python console in SasView:: 
     48If you want to use one of the other devices, you can select it from OpenCL 
     49options dialog (accessible from Fitting menu) or run the following from 
     50the python console in SasView:: 
    4651 
    4752    import pyopencl as cl 
  • doc/conf.py

    r39674a0 r8ae8532  
    4242             ] 
    4343 
     44# Redirect mathjax to a different CDN 
     45mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML" 
     46 
    4447# Add any paths that contain templates here, relative to this directory. 
    4548templates_path = ['_templates'] 
  • doc/developer/calculator.rst

    re822c97 r2e66ef5  
    77model calculator which implements the polydispersity and magnetic SLD 
    88calculations.  There are three separate implementations of this layer, 
    9 *kernelcl.py* for OpenCL, which operates on a single Q value at a time, 
    10 *kerneldll.c* for the DLL, which loops over a vector of Q values, and 
    11 *kernelpy.py* for python models which operates on vector Q values. 
     9:mod:`kernelcl` for OpenCL, which operates on a single Q value at a time, 
     10:mod:`kerneldll` for the DLL, which loops over a vector of Q values, and 
     11:mod:`kernelpy` for python models which operates on vector Q values. 
    1212 
    1313Each implementation provides three different calls *Iq*, *Iqxy* and *Imagnetic* 
  • doc/developer/index.rst

    rb85be2d r2e66ef5  
    77   :maxdepth: 4 
    88 
     9   overview.rst 
    910   calculator.rst 
  • doc/genapi.py

    ra5b8477 r2e66ef5  
    22import os.path 
    33 
    4 MODULE_TEMPLATE=""".. Autogenerated by genmods.py 
     4MODULE_TEMPLATE = """.. Autogenerated by genmods.py 
    55 
    66****************************************************************************** 
     
    1919""" 
    2020 
    21 INDEX_TEMPLATE=""".. Autogenerated by genmods.py 
     21INDEX_TEMPLATE = """.. Autogenerated by genmods.py 
    2222 
    2323.. _api-index: 
     
    4646        os.makedirs(dir) 
    4747 
    48     for module,name in modules: 
    49         with open(os.path.join(dir,module+'.rst'), 'w') as f: 
     48    for module, name in modules: 
     49        with open(os.path.join(dir, module+'.rst'), 'w') as f: 
    5050            f.write(MODULE_TEMPLATE%locals()) 
    5151 
    52     rsts = "\n   ".join(module+'.rst' for module,name in modules) 
    53     with open(os.path.join(dir,'index.rst'),'w') as f: 
     52    rsts = "\n   ".join(module+'.rst' for module, name in modules) 
     53    with open(os.path.join(dir, 'index.rst'), 'w') as f: 
    5454        f.write(INDEX_TEMPLATE%locals()) 
    5555 
    5656 
    57 modules=[ 
    58     #('__init__', 'Top level namespace'), 
     57modules = [ 
     58    ('__init__', 'Sasmodels package'), 
    5959    #('alignment', 'GPU data alignment [unused]'), 
    6060    ('bumps_model', 'Bumps interface'), 
     61    ('compare_many', 'Batch compare models on different compute engines'), 
    6162    ('compare', 'Compare models on different compute engines'), 
    6263    ('convert', 'Sasview to sasmodel converter'), 
     
    6667    ('direct_model', 'Simple interface'), 
    6768    ('exception', 'Annotate exceptions'), 
    68     #('frozendict', 'Freeze a dictionary to make it immutable'), 
    6969    ('generate', 'Model parser'), 
    7070    ('kernel', 'Evaluator type definitions'), 
     
    7979    ('resolution', '1-D resolution functions'), 
    8080    ('resolution2d', '2-D resolution functions'), 
     81    ('rst2html', 'Convert doc strings the web pages'), 
    8182    ('sasview_model', 'Sasview interface'), 
    8283    ('sesans', 'SESANS calculation routines'), 
    83     #('transition', 'Model stepper for automatic model selection'), 
    8484    ('weights', 'Distribution functions'), 
    8585] 
    86 package='sasmodels' 
    87 package_name='Reference' 
     86package = 'sasmodels' 
     87package_name = 'Reference' 
    8888genfiles(package, package_name, modules) 
  • doc/gentoc.py

    r40a87fa r990d8df  
    1616    from sasmodels.modelinfo import ModelInfo 
    1717 
    18 TEMPLATE="""\ 
     18TEMPLATE = """\ 
    1919.. 
    2020    Generated from doc/gentoc.py -- DO NOT EDIT -- 
     
    3030""" 
    3131 
    32 MODEL_TOC_PATH = "ref/models" 
     32MODEL_TOC_PATH = "guide/models" 
    3333 
    3434def _make_category(category_name, label, title, parent=None): 
     
    6565        # assume model is in sasmodels/models/name.py, and ignore the full path 
    6666        model_name = basename(item)[:-3] 
    67         if model_name.startswith('_'): continue 
     67        if model_name.startswith('_'): 
     68            continue 
    6869        model_info = load_model_info(model_name) 
    6970        if model_info.category is None: 
    7071            print("Missing category for", item, file=sys.stderr) 
    7172        else: 
    72             category.setdefault(model_info.category,[]).append(model_name) 
     73            category.setdefault(model_info.category, []).append(model_name) 
    7374 
    7475    # Check category names 
    75     for k,v in category.items(): 
     76    for k, v in category.items(): 
    7677        if len(v) == 1: 
    77             print("Category %s contains only %s"%(k,v[0]), file=sys.stderr) 
     78            print("Category %s contains only %s"%(k, v[0]), file=sys.stderr) 
    7879 
    7980    # Generate category files for the table of contents. 
     
    8687    # alphabetical order before them. 
    8788 
    88     if not exists(MODEL_TOC_PATH): mkdir(MODEL_TOC_PATH) 
     89    if not exists(MODEL_TOC_PATH): 
     90        mkdir(MODEL_TOC_PATH) 
    8991    model_toc = _make_category( 
    90         'index',  'Models', 'Model Functions') 
     92        'index', 'Models', 'Model Functions') 
    9193    #shape_toc = _make_category( 
    9294    #    'shape',  'Shapes', 'Shape Functions', model_toc) 
    9395    free_toc = _make_category( 
    94         'shape-independent',  'Shape-independent', 
     96        'shape-independent', 'Shape-independent', 
    9597        'Shape-Independent Functions') 
    9698    struct_toc = _make_category( 
    97         'structure-factor',  'Structure-factor', 'Structure Factors') 
    98     custom_toc = _make_category( 
    99         'custom-models', 'Custom-models', 'Custom Models') 
     99        'structure-factor', 'Structure-factor', 'Structure Factors') 
     100    #custom_toc = _make_category( 
     101    #    'custom-models', 'Custom-models', 'Custom Models') 
    100102 
    101103    # remember to top level categories 
     
    105107        'shape-independent':free_toc, 
    106108        'structure-factor': struct_toc, 
    107         'custom': custom_toc, 
     109        #'custom': custom_toc, 
    108110        } 
    109111 
    110112    # Process the model lists 
    111     for k,v in sorted(category.items()): 
     113    for k, v in sorted(category.items()): 
    112114        if ':' in k: 
    113             cat,subcat = k.split(':') 
     115            cat, subcat = k.split(':') 
    114116            _maybe_make_category(cat, v, cat_files, model_toc) 
    115117            cat_file = cat_files[cat] 
    116             label = "-".join((cat,subcat)) 
     118            label = "-".join((cat, subcat)) 
    117119            filename = label 
    118             title = subcat.capitalize()+" Functions" 
     120            title = subcat.capitalize() + " Functions" 
    119121            sub_toc = _make_category(filename, label, title, cat_file) 
    120122            for model in sorted(v): 
     
    130132    _add_subcategory('shape-independent', model_toc) 
    131133    _add_subcategory('structure-factor', model_toc) 
    132     _add_subcategory('custom-models', model_toc) 
     134    #_add_subcategory('custom-models', model_toc) 
    133135 
    134136    # Close the top-level category files 
    135137    #model_toc.close() 
    136     for f in cat_files.values(): f.close() 
     138    for f in cat_files.values(): 
     139        f.close() 
    137140 
    138141 
  • doc/guide/gpu/opencl_installation.rst

    rec8b9a3 r990d8df  
    44OpenCL Installation 
    55******************* 
    6 *Warning! GPU devices do not in general offer the same level of memory protection as CPU devices. If your code attempts to write outside allocated memory buffers unpredicatable behaviour may result (eg, your video display may freeze, or your system may crash, etc). Do not install OpenCL drivers without first checking for known issues (eg, some computer manufacturers install modified graphics drivers so replacing these may not be a good idea!). If in doubt, seek advice from an IT professional before proceeding further.* 
     6*Warning! GPU devices do not in general offer the same level of memory 
     7protection as CPU devices. If your code attempts to write outside allocated 
     8memory buffers unpredicatable behaviour may result (eg, your video display 
     9may freeze, or your system may crash, etc). Do not install OpenCL drivers 
     10ithout first checking for known issues (eg, some computer manufacturers 
     11install modified graphics drivers so replacing these may not be a good 
     12idea!). If in doubt, seek advice from an IT professional before proceeding 
     13further.* 
    714 
    8151. Check if you have OpenCL already installed 
     
    2532Mac OSX 
    2633....... 
    27     For OS X operating systems higher than 10.6 OpenCL is shipped along with the system. 
     34    For OS X operating systems higher than 10.6 OpenCL is shipped along with 
     35    the system. 
    2836 
    29     However, OpenCL has had a rocky history on Macs. Apple provide a useful compatibility table at https://support.apple.com/en-us/HT202823 
     37    However, OpenCL has had a rocky history on Macs. Apple provide a useful 
     38    compatibility table at https://support.apple.com/en-us/HT202823 
    3039 
    3140 
     
    4453....... 
    4554    N/A 
    46          
    47         You cannot download OpenCL driver updates for your Mac. They are packaged with the normal quarterly OS X updates from Apple.  
     55 
     56 You cannot download OpenCL driver updates for your Mac. They are packaged 
     57 with the normal quarterly OS X updates from Apple. 
    4858 
    4959 
    5060.. note:: 
    51     Intel provides OpenCL drivers for Intel processors at     https://software.intel.com/en-us/articles/opencl-drivers  
     61    Intel provides OpenCL drivers for Intel processors at 
     62    https://software.intel.com/en-us/articles/opencl-drivers 
    5263    These can sometimes make use of special vector instructions across multiple 
    5364    processors, so it is worth installing if the GPU does not support double 
     
    5566    or AMD. 
    5667 
    57          
     68 
    5869.. note:: 
    5970    This help document was last changed by Steve King, 08Oct2016 
  • doc/guide/index.rst

    rbb6f0f3 r2e66ef5  
    1 ********** 
    2 SAS Models 
    3 ********** 
     1**************** 
     2SAS Models Guide 
     3**************** 
    44 
    5 Small angle X-ray and Neutron (SAXS and SANS) scattering examines the 
    6 scattering patterns produced by a beam travelling through the sample 
    7 and scattering at low angles.  The scattering is computed as a function 
    8 of $q_x$ and $q_y$, which for a given beam wavelength corresponds to 
    9 particular scattering angles. Each pixel on the detector corresponds to 
    10 a different scattering angle. If the sample is unoriented, the scattering 
    11 pattern will appear as rings on the detector.  In this case, a circular 
    12 average can be taken with 1-dimension data at $q = \surd (q_x^2 + q_y^2)$ 
    13 compared to the orientationally averaged SAS scattering pattern. 
     5.. toctree:: 
     6   :numbered: 4 
     7   :maxdepth: 4 
    148 
    15 Models have certain features in common. 
    16  
    17 Every model has a *scale* and a *background*. 
    18  
    19 Talk about orientation, with diagrams for orientation so that we don't need 
    20 a link on every model page? 
    21  
    22 .. _orientation: 
    23  
    24 .. figure: img/orientation1.jpg 
    25  
    26     Orientation in 3D 
    27  
    28 .. figure: img/orientation2.jpg 
    29  
    30     Orientation cross sections 
    31  
    32 Talk about polydispersity. 
    33  
    34 Talk about magnetism, converting the magnetism help file to inline text here, 
    35 with links so that models can point back to it. 
    36  
    37 Need to talk about structure factors even though we don't have any 
    38 implemented yet. 
     9   intro.rst 
     10   install.rst 
     11   pd/polydispersity.rst 
     12   resolution.rst 
     13   magnetism/magnetism.rst 
     14   sesans/sans_to_sesans.rst 
     15   sesans/sesans_fitting.rst 
     16   plugin.rst 
     17   scripting.rst 
     18   refs.rst 
  • doc/guide/magnetism/magnetism.rst

    rdeb854f r990d8df  
    22 
    33Polarisation/Magnetic Scattering 
    4 ======================================================= 
     4================================ 
    55 
    6 In earlier versions of SasView magnetic scattering was implemented in just five  
    7 (2D) models 
    8  
    9 *  :ref:`sphere` 
    10 *  :ref:`core-shell-sphere` 
    11 *  :ref:`core-multi-shell` 
    12 *  :ref:`cylinder` 
    13 *  :ref:`parallelepiped` 
    14  
    15 From SasView 4.x it is implemented on most models in the 'shape' category. 
    16  
    17 In general, the scattering length density (SLD = $\beta$) in each region where the 
    18 SLD is uniform, is a combination of the nuclear and magnetic SLDs and, for polarised 
    19 neutrons, also depends on the spin states of the neutrons. 
     6Models which define a scattering length density parameter can be evaluated 
     7 as magnetic models. In general, the scattering length density (SLD = 
     8 $\beta$) in each region where the SLD is uniform, is a combination of the 
     9 nuclear and magnetic SLDs and, for polarised neutrons, also depends on the 
     10 spin states of the neutrons. 
    2011 
    2112For magnetic scattering, only the magnetization component $\mathbf{M_\perp}$ 
     
    9889.. note:: 
    9990    This help document was last changed by Steve King, 02May2015 
     91 
     92* Document History * 
     93 
     94| 2017-05-08 Paul Kienzle 
  • doc/guide/sesans/sesans_fitting.rst

    r3330bb4 r8ae8532  
    77=================== 
    88 
    9 .. note:: A proper installation of the developers setup of SasView (http://trac.sasview.org/wiki/AnacondaSetup) is a prerequisite for using these instructions. 
     9.. note:: 
     10 
     11    A proper installation of the developers setup of SasView 
     12    (http://trac.sasview.org/wiki/AnacondaSetup) is a prerequisite for 
     13    using these instructions. 
    1014 
    1115It is possible to fit SESANS measurements from the command line in Python. 
     
    1317Simple Fits 
    1418........... 
    15 In the folder sasmodels/example the file sesans_sphere_2micron.py gives an example of how to fit a shape to a measurement. 
     19In the folder sasmodels/example the file sesans_sphere_2micron.py gives 
     20an example of how to fit a shape to a measurement. 
    1621 
    1722The command:: 
     
    2328.. image:: sesans_img/SphereLineFitSasView.png 
    2429 
    25 All the parameters and names in sesans_sphere_2micron.py (shown below) can be adjusted to fit your own problem:: 
     30All the parameters and names in sesans_sphere_2micron.py (shown below) can 
     31be adjusted to fit your own problem:: 
    2632 
    2733  """ 
     
    6470  # Constraints 
    6571  # model.param_name = f(other params) 
    66   # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is 
    67   # a custom parameter 
     72  # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius 
     73  # and scale are model functions and phi is a custom parameter 
    6874  model.scale = phi*(1-phi) 
    6975 
     
    7480Incorporating a Structure Factor 
    7581................................ 
    76 An example of how to also include a structure factor can be seen in the following example taken from Washington et al.,  
    77 *Soft Matter*\, (2014), 10, 3016 (dx.doi.org/10.1039/C3SM53027B). These are time-of-flight measurements, which is the  
    78 reason that not the polarisation is plotted, but the :math:`\frac{log(P/P_0)}{\lambda^2}` . The sample is a dispersion  
    79 of core-shell colloids at a high volume fraction with hard sphere interactions. 
     82An example of how to also include a structure factor can be seen in the 
     83following example taken from Washington et al., *Soft Matter*\, (2014), 10, 3016 
     84(dx.doi.org/10.1039/C3SM53027B). These are time-of-flight measurements, which 
     85is the reason that not the polarisation is plotted, but the 
     86:math:`\frac{log(P/P_0)}{\lambda^2}` . The sample is a dispersion of 
     87core-shell colloids at a high volume fraction with hard sphere interactions. 
    8088 
    8189The fit can be started by:: 
     
    8795.. image:: sesans_img/HardSphereLineFitSasView.png 
    8896 
    89 The code sesans_parameters_css-hs.py can then be used as a template for a fitting problem with a structure factor:: 
     97The code sesans_parameters_css-hs.py can then be used as a template for a 
     98fitting problem with a structure factor:: 
    9099 
    91100 """ 
     
    131140 # Constraints 
    132141 # model.param_name = f(other params) 
    133  # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is 
    134  # a custom parameter 
     142 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius 
     143 # and scale are model functions and phi is a custom parameter 
    135144 model.scale = phi*(1-phi) 
    136145 model.volfraction = phi 
  • doc/index.rst

    r7bb290c r8ae8532  
    1 Introduction 
    2 ============ 
     1sasmodels 
     2========= 
     3Small angle X-ray and Neutron scattering (SAXS and SANS) examines the 
     4scattering patterns produced by a beam travelling through the sample 
     5and scattering at low angles.  The scattering is computed as a function 
     6of reciprocal space $q$, which arises from a combination of beam wavelength 
     7and scattering angles. Each pixel on the detector corresponds to 
     8a different scattering angle, and has a distinct $q_x$ and $q_y$. If the 
     9sample is unoriented, the scattering pattern will appear as rings on the 
     10detector.  In this case, a circular average can be taken with 1-dimension 
     11data at $q = \surd (q_x^2 + q_y^2)$ compared to the orientationally 
     12averaged SAS scattering pattern. 
     13 
    314The sasmodels package provides theory functions for small angle scattering 
    4 calculations. 
     15calculations for different shapes, including the effects of resolution, 
     16polydispersity and orientational dispersion. 
    517 
    618.. htmlonly:: 
     
    1527 
    1628   guide/index.rst 
     29   guide/models/index.rst 
    1730   developer/index.rst 
    18    ref/index.rst 
    19    ref/models/index.rst 
    2031   api/index.rst 
    2132 
     
    2839.. htmlonly:: 
    2940  * :ref:`search` 
    30  
    31  
    32  
    33  
    34    
    35  
Note: See TracChangeset for help on using the changeset viewer.