Changeset 5582b078 in sasview for src


Ignore:
Timestamp:
Oct 21, 2017 3:00:12 PM (7 years ago)
Author:
GitHub <noreply@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
c926a97, b6b81a3, 3d950a9, 61f329f0, fca1f50
Parents:
5543ff6 (diff), c22b621 (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.
git-author:
Andrew Jackson <andrew.jackson@…> (10/21/17 15:00:12)
git-committer:
GitHub <noreply@…> (10/21/17 15:00:12)
Message:

Merge pull request #110 from SasView?/ticket-947-sasmodels-docs

close ticket 947 sasmodels docs

Location:
src/sas
Files:
59 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/corfunc/corfunc_calculator.py

    rb916afa ra26f67f  
    177177        """ 
    178178        Extract the interesting measurements from a correlation function 
    179         :param transformed_data: Fourier transformation of the 
    180             extrapolated data 
     179 
     180        :param transformed_data: Fourier transformation of the extrapolated data 
    181181        """ 
    182182        # Calculate indexes of maxima and minima 
  • src/sas/sascalc/data_util/registry.py

    rdc8d1c2 ra26f67f  
    121121        Call the loader for the file type of path. 
    122122 
    123         :raise ValueError: if no loader is available. 
    124         :raise KeyError: if format is not available. 
     123        :raises ValueError: if no loader is available. 
     124        :raises KeyError: if format is not available. 
     125 
    125126        May raise a loader-defined exception if loader fails. 
    126127        """ 
  • src/sas/sascalc/file_converter/c_ext/__init__.py

    r18e7309 ra26f67f  
     1""" 
     2    Data loader for the Diamond BSL beamline. 
     3""" 
  • src/sas/sasgui/guiframe/CategoryInstaller.py

    rb963b20 ra26f67f  
    112112    def check_install(homedir = None, model_list=None): 
    113113        """ 
    114         the main method of this class 
    115         makes sure categories.json exists and if not 
    116         compile it and install 
     114        Makes sure categories.json exists and if not compile it and install. 
     115 
     116        This is the main method of this class. 
     117 
    117118        :param homefile: Override the default home directory 
    118         :param model_list: List of model names except those in Plugin Models 
    119               which are user supplied. 
     119        :param model_list: List of model names except those in 
     120            Plugin Models which are user supplied. 
    120121        """ 
    121122        _model_dict = {model.name: model for model in model_list} 
  • src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_slicer.py

    r47d93073 ra26f67f  
    395395        """ 
    396396        Event based parameter setting. 
     397 
    397398        :param evt: Event triggered to apply parameters to a list of plots 
    398                     evt should have attrs plot_list and params 
     399           evt should have attrs plot_list and params 
     400 
    399401        """ 
    400402        if evt is None: 
     
    467469        """ 
    468470        Send a list of data to the fitting perspective 
    469         :param fit: fit type desired  
     471        :param fit: fit type desired 
    470472        :param file_list: list of loaded file names to send to fit 
    471473        """ 
  • src/sas/sasgui/perspectives/file_converter/converter_panel.py

    r19296dc ra26f67f  
    9393        <SasData> element. 
    9494 
    95         :param frame_data: If single_file is true, an array of Data1D objects. 
    96         If single_file is false, a dictionary of the form frame_number: Data1D. 
     95        :param frame_data: If single_file is true, an array of Data1D 
     96            objects. If single_file is false, a dictionary of the 
     97            form *{frame_number: Data1D}*. 
    9798        :param filepath: Where to save the CanSAS file 
    98         :param single_file: If true, array is saved as a single file, if false, 
    99         each item in the array is saved to it's own file 
     99        :param single_file: If true, array is saved as a single file, 
     100            if false, each item in the array is saved to it's own file 
    100101        """ 
    101102        writer = CansasWriter() 
     
    192193        :return x_data: A 1D array containing all the x coordinates of the data 
    193194        :return y_data: A 1D array containing all the y coordinates of the data 
    194         :return frame_data: A dictionary of the form frame_number: data, where 
    195         data is a 2D numpy array containing the intensity data 
     195        :return frame_data: A dictionary of the form *{frame_number: data}*, where data is a 2D numpy array containing the intensity data 
    196196        """ 
    197197        loader = BSLLoader(filename) 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    rd3b0c77 r3bd677b  
    28162816                                              "", name + " Help") 
    28172817        else: 
    2818             _TreeLocation = 'user/index.html' 
     2818            _TreeLocation = 'user/sasgui/perspectives/fitting/models/index.html' 
    28192819            _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
    28202820                                              "", "General Model Help") 
     
    28872887        """ 
    28882888 
    2889         _TreeLocation = "user/magnetism.html" 
     2889        _TreeLocation = "user/sasgui/perspectives/fitting/magnetism/magnetism.html" 
    28902890        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 
    28912891                                          "Polarized Beam/Magnetc Help") 
     
    29332933        """ 
    29342934 
    2935         _TreeLocation = "user/sasgui/perspectives/fitting/pd_help.html" 
     2935        _TreeLocation = "user/sasgui/perspectives/fitting/pd/polydispersity.html" 
    29362936        _PageAnchor = "" 
    29372937        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r0315b63 r3bd677b  
    10791079        """ 
    10801080 
    1081         _TreeLocation = "user/sasgui/perspectives/fitting/sm_help.html" 
     1081        _TreeLocation = "user/sasgui/perspectives/fitting/resolution.html" 
    10821082        _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "", 
    10831083                                          "Instrumental Resolution Smearing \ 
  • src/sas/sasgui/perspectives/fitting/gpu_options.py

    r73cbeec r3bd677b  
    318318        Provide help on opencl options. 
    319319        """ 
    320         TreeLocation = "user/gpu_computations.html" 
     320        TreeLocation = "user/sasgui/perspectives/fitting/gpu_setup.html" 
    321321        anchor = "#device-selection" 
    322322        DocumentationWindow(self, -1, 
  • src/sas/sasgui/perspectives/fitting/media/fitting.rst

    r46dfee9 r3bd677b  
    1313   Assessing Fit Quality <residuals_help> 
    1414 
    15    Polydispersity Distributions <pd_help> 
     15   Polydispersity Distributions <pd/polydispersity> 
    1616 
    17    Smearing Functions <sm_help> 
     17   Smearing Functions <resolution> 
    1818 
    19    Polarisation/Magnetic Scattering <mag_help> 
     19   Polarisation/Magnetic Scattering <magnetism/magnetism> 
    2020 
    21    Information on the SasView Optimisers <optimizer.rst> 
    22        
    23    Converting SANS to SESANS for Fitting <../../../sans_to_sesans> 
    24     
    25    Fitting SESANS Data <../../../sesans_fitting.rst> 
    26     
    27    Writing a Plugin Model <plugin.rst> 
    28        
    29    Computations with a GPU <../../../gpu_computations> 
    30     
     21   Information on the SasView Optimisers <optimizer> 
     22 
     23   Converting SANS to SESANS for Fitting <sesans/sans_to_sesans> 
     24 
     25   Fitting SESANS Data <sesans/sesans_fitting> 
     26 
     27   Writing a Plugin Model <plugin> 
     28 
     29   Computations with a GPU <gpu_setup> 
     30 
     31   Scripting interface to sasmodels <scripting> 
     32 
     33   References <refs> 
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    rc5cfb20 r5005ae0  
    33.. This is a port of the original SasView html help file to ReSTructured text 
    44.. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. 
    5  
    6 .. |inlineimage004| image:: sm_image004.png 
    7 .. |inlineimage005| image:: sm_image005.png 
    8 .. |inlineimage008| image:: sm_image008.png 
    9 .. |inlineimage009| image:: sm_image009.png 
    10 .. |inlineimage010| image:: sm_image010.png 
    11 .. |inlineimage011| image:: sm_image011.png 
    12 .. |inlineimage012| image:: sm_image012.png 
    13 .. |inlineimage018| image:: sm_image018.png 
    14 .. |inlineimage019| image:: sm_image019.png 
    15  
    165 
    176Fitting 
     
    3827   for example, if you have measured the same sample at different contrasts) 
    3928 
    40 *  in *Batch* fit mode - multiple data sets are fitted sequentially to the *same* model (this might be useful, for example, if you have performed a kinetic or time-resolved experiment and have *lots* of data sets!) 
     29*  in *Batch* fit mode - multiple data sets are fitted sequentially to the 
     30   *same* model (this might be useful, for example, if you have performed 
     31   a kinetic or time-resolved experiment and have *lots* of data sets!) 
    4132 
    4233.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    5445*  *Lamellae* - lamellar shapes (lamellar, core shell lamellar, stacked 
    5546   lamellar, etc) 
    56 *  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc 
     47*  *Shape-Independent* - models describing structure in terms of density 
     48   correlation functions, fractals, peaks, power laws, etc 
    5749*  *Paracrystal* - semi ordered structures (bcc, fcc, etc) 
    5850*  *Structure Factor* - S(Q) models 
     
    143135   and/or relatively simple models) 
    144136*  By copying/editing an existing model (this can include models generated by 
    145    the New Plugin Model* dialog) in the :ref:`Python_shell` or  
     137   the New Plugin Model* dialog) in the :ref:`Python_shell` or 
    146138   :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 
    147139*  By writing a model from scratch outside of SasView (only recommended for code 
     
    181173.. image:: new_model.png 
    182174 
    183 When using this feature, be aware that even if your code has errors, including  
    184 syntax errors, a model file is still generated. When you then correct the errors  
    185 and click 'Apply' again to re-compile you will get an error informing you that  
    186 the model already exists if the 'Overwrite' box is not checked. In this case you  
    187 will need to supply a new model function name. By default the 'Overwrite' box is  
     175When using this feature, be aware that even if your code has errors, including 
     176syntax errors, a model file is still generated. When you then correct the errors 
     177and click 'Apply' again to re-compile you will get an error informing you that 
     178the model already exists if the 'Overwrite' box is not checked. In this case you 
     179will need to supply a new model function name. By default the 'Overwrite' box is 
    188180*checked*\ . 
    189181 
     
    195187the :ref:`Advanced_Plugin_Editor` . 
    196188 
    197 **SasView version 4.2** made it possible to specify whether a plugin created with  
    198 the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor  
    199 S(Q). To do this, simply add one or other of the following lines under the *import*  
     189**SasView version 4.2** made it possible to specify whether a plugin created with 
     190the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor 
     191S(Q). To do this, simply add one or other of the following lines under the *import* 
    200192statements. 
    201193 
     
    203195 
    204196     form_factor = True 
    205           
     197 
    206198or for a structure factor:: 
    207199 
    208200     structure_factor = True 
    209           
    210 If the plugin is a structure factor it is *also* necessary to add two variables to  
     201 
     202If the plugin is a structure factor it is *also* necessary to add two variables to 
    211203the parameter list:: 
    212204 
    213      parameters = [  
     205     parameters = [ 
    214206                     ['radius_effective', '', 1, [0.0, numpy.inf], 'volume', ''], 
    215207                     ['volfraction', '', 1, [0.0, 1.0], '', ''], 
     
    222214     def Iqxy(x, y, radius_effective, volfraction, ...): 
    223215 
    224 Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once  
     216Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once 
    225217a P(Q) model has been selected). 
    226218 
     
    243235them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 
    244236 
    245 Any changes to a plugin model generated in this way only become effective *after* it is re-selected  
    246 from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a  
     237Any changes to a plugin model generated in this way only become effective *after* it is re-selected 
     238from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a 
    247239recompilation of the plugins by selecting *Fitting* > *Plugin Model Operations* > *Load Plugin Models*. 
    248240 
    249 **SasView version 4.2** introduced a much simplified and more extensible structure for plugin models  
    250 generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model  
     241**SasView version 4.2** introduced a much simplified and more extensible structure for plugin models 
     242generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model 
    251243with a power law model now looks like this:: 
    252244 
    253245     from sasmodels.core import load_model_info 
    254246     from sasmodels.sasview_model import make_model_from_info 
    255       
     247 
    256248     model_info = load_model_info('sphere+power_law') 
    257249     model_info.name = 'MyPluginModel' 
     
    259251     Model = make_model_from_info(model_info) 
    260252 
    261 To change the models or operators contributing to this plugin it is only necessary to edit the string  
    262 in the brackets after *load_model_info*, though it would also be a good idea to update the model name  
     253To change the models or operators contributing to this plugin it is only necessary to edit the string 
     254in the brackets after *load_model_info*, though it would also be a good idea to update the model name 
    263255and description too!!! 
    264256 
    265 The model specification string can handle multiple models and combinations of operators (+ or *) which  
    266 are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would  
    267 multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be  
    268 prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little  
    269 confusing, unless you were creating a plugin model from multiple instances of the same model the parameter  
     257The model specification string can handle multiple models and combinations of operators (+ or *) which 
     258are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would 
     259multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be 
     260prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little 
     261confusing, unless you were creating a plugin model from multiple instances of the same model the parameter 
    270262assignments ought to be obvious when you load the plugin. 
    271263 
    272 If you need to include another plugin model in the model specification string, just prefix the name of  
     264If you need to include another plugin model in the model specification string, just prefix the name of 
    273265that model with *custom*. For instance:: 
    274266 
     
    278270 
    279271     sphere@hardsphere 
    280       
    281 This streamlined approach to building complex plugin models from existing library models, or models  
    282 available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something  
    283 that was not possible in earlier versions of SasView.  
     272 
     273This streamlined approach to building complex plugin models from existing library models, or models 
     274available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something 
     275that was not possible in earlier versions of SasView. 
    284276 
    285277.. _Advanced_Plugin_Editor: 
     
    471463 
    472464This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data 
    473 sets *to the same model* simultaneously. If necessary it is possible to constrain  
     465sets *to the same model* simultaneously. If necessary it is possible to constrain 
    474466fit parameters between data sets (eg, to fix a background level, or radius, etc). 
    475467 
     
    689681recognises the operators +, -, \*, /, or 'pow', and allows the following 
    690682types of expression : 
    691   
     683 
    692684  1) if an axis label range is a function of 1 or more *columns*, write 
    693685     this type of expression 
     
    706698 
    707699     Example: radius [2 : 5] , radius [10 : 25] 
    708       
     700 
    709701.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    710702 
     
    756748   p#_ appended to the beginning and thus radius and p1_radius will not be 
    757749   recognized as the same parameter. 
    758     
     750 
    759751.. image:: combine_batch_grid.png 
    760752 
     
    764756time is not listed in the file but the file name contains the information. As 
    765757described in :ref:`Grid_Window`, a column can be added manually, in this case 
    766 called time, and the peak position plotted against time.  
     758called time, and the peak position plotted against time. 
    767759 
    768760.. image:: combine_batch_plot.png 
  • src/sas/sasgui/perspectives/fitting/media/residuals_help.rst

    r940d034 r99ded31  
    2626^^^^ 
    2727 
    28 Chi2 is a statistical parameter that quantifies the differences between an observed 
    29 data set and an expected dataset (or 'theory'). 
     28$\chi^2$ is a statistical parameter that quantifies the differences between 
     29an observed data set and an expected dataset (or 'theory'). 
    3030 
    31 *SasView* actually returns this parameter normalized to the number of data points, 
    32 *Npts* such that 
     31When showing the a model with the data, *SasView* displays this parameter 
     32normalized to the number of data points, $N_\mathrm{pts}$ such that 
    3333 
    3434.. math:: 
    3535 
    36   \chi^2/N_{pts} =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_{pts} 
     36  \chi^2_N 
     37  =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] / N_\mathrm{pts} 
    3738 
    38 This differs slightly from what is sometimes called the 'reduced $\chi^2$' 
    39 because it does not take into account the number of fitting parameters (to 
    40 calculate the number of 'degrees of freedom'), but the 'normalized $\chi^2$ 
    41 and the 'reduced $\chi^2$ are very close to each other when $N_{pts} \gg 
    42 \text{number of parameters}. 
     39When performing a fit, *SasView* instead displays the reduced $\chi^2_R$, 
     40which takes into account the number of fitting parameters $N_\mathrm{par}$ 
     41(to calculate the number of 'degrees of freedom'). This is computed as 
    4342 
    44 For a good fit, $\chi^2/N_{pts}$ tends to 1. 
     43.. math:: 
    4544 
    46 $\chi^2/N_{pts}$ is sometimes referred to as the 'goodness-of-fit' parameter. 
     45  \chi^2_R 
     46  =  \sum[(Y_i - \mathrm{theory}_i)^2 / \mathrm{error}_i^2] 
     47  / [N_\mathrm{pts} - N_\mathrm{par}] 
     48 
     49The normalized $\chi^2_N$ and the reduced $\chi^2_R$ are very close to each 
     50other when $N_\mathrm{pts} \gg N_\mathrm{par}$. 
     51 
     52For a good fit, $\chi^2_R$ tends to 1. 
     53 
     54$\chi^2_R$ is sometimes referred to as the 'goodness-of-fit' parameter. 
    4755 
    4856.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    5260 
    5361A residual is the difference between an observed value and an estimate of that 
    54 value, such as a 'theory' calculation (whereas the difference between an observed 
    55 value and its *true* value is its error). 
     62value, such as a 'theory' calculation (whereas the difference between an 
     63observed value and its *true* value is its error). 
    5664 
    5765*SasView* calculates 'normalized residuals', $R_i$, for each data point in the 
     
    6068.. math:: 
    6169 
    62   R_i = (Y_i - Y_theory_i) / (Y_err_i) 
     70  R_i = (Y_i - \mathrm{theory}_i) / \mathrm{error}_i 
    6371 
    64 For a good fit, $R_i \sim 0$. 
     72Think of each normalized residual as the number of standard deviations 
     73between the measured value and the theory.  For a good fit, 68% of $R_i$ 
     74will be within one standard deviation, which will show up in the Residuals 
     75plot as $R_i$ values between $-1$ and $+1$.  Almost all the values should 
     76be between $-3$ and $+3$. 
     77 
     78Residuals values larger than $\pm 3$ indicate that the model 
     79is not fit correctly, the wrong model was chosen (e.g., because there is 
     80more than one phase in your system), or there are problems in 
     81the data reduction.  Since the goodness of fit is calculated from the 
     82sum-squared residuals, these extreme values will drive the choice of fit 
     83parameters.  Any uncertainties calculated for the fitting parameters will 
     84be meaningless. 
    6585 
    6686.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    6787 
    68 .. note::  This help document was last changed by Steve King, 08Jun2015 
     88*Document History* 
     89 
     90| 2015-06-08 Steve King 
     91| 2017-09-28 Paul Kienzle 
  • src/sas/sasgui/perspectives/fitting/plugin_models/__init__.py

    ra7c4ad2 r64cdb0d  
     1""" 
     2Example plugin models to be added to the SasView plugin directory on startup 
     3if no plugins are present. 
     4 
     5This is currently empty. 
     6""" 
  • src/sas/sasgui/plottools/LineModel.py

    r959eb01 ra26f67f  
    22""" 
    33Provide Line function (y= Ax + B). Until July 10, 2016 this function provided 
    4 (y= A + Bx).  This however was contrary to all the other code using it which  
     4(y= A + Bx).  This however was contrary to all the other code using it which 
    55assumed (y= mx+b) or in this nomenclature (y=Ax + B). This lead to some 
    66contortions in the code and worse incorrect calculations until now for at least 
     
    6767        Evaluate the model 
    6868 
    69         :note: This is the function called by fitDialog to calculate the 
    70         the y(xmin) and y(xmax), but the only difference between this and 
    71         runXY is when the if statement is true. I however cannot see what that 
    72         function is for.  It needs to be documented here or removed. 
    73         PDB 7/10/16  
    74  
    7569        :param x: simple value 
    7670 
    7771        :return: (Line value) 
     72 
     73        .. note:: 
     74            This is the function called by fitDialog to calculate the 
     75            the y(xmin) and y(xmax), but the only difference between this and 
     76            runXY is when the if statement is true. I however cannot see what 
     77            that function is for.  It needs to be documented here or removed. 
     78            PDB 7/10/16 
    7879        """ 
    7980        if x.__class__.__name__ == 'list': 
     
    8990        """ 
    9091        Evaluate the model. 
    91          
    92         :note: This is to be what is called by fitDialog for the actual fit 
    93         but the only difference between this and run is when the if  
    94         statement is true. I however cannot see what that function 
    95         is for.  It needs to be documented here or removed. PDB 7/10/16  
    9692 
    9793        :param x: simple value 
     
    9995        :return: Line value 
    10096 
     97        .. note:: 
     98            This is to be what is called by fitDialog for the actual fit 
     99            the only difference between this and run is when the if 
     100            statement is true. I however cannot see what that function 
     101            is for.  It needs to be documented here or removed. PDB 7/10/16 
    101102        """ 
    102103        if x.__class__.__name__ == 'list': 
Note: See TracChangeset for help on using the changeset viewer.