Ignore:
Timestamp:
Sep 18, 2017 12:19:13 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
1e6d9340
Parents:
1659f54 (diff), cfd27dd (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 ticket-639-katex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    r5ed76f8 rc5cfb20  
    195195the :ref:`Advanced_Plugin_Editor` . 
    196196 
     197**SasView version 4.2** made it possible to specify whether a plugin created with  
     198the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor  
     199S(Q). To do this, simply add one or other of the following lines under the *import*  
     200statements. 
     201 
     202For a form factor:: 
     203 
     204     form_factor = True 
     205          
     206or for a structure factor:: 
     207 
     208     structure_factor = True 
     209          
     210If the plugin is a structure factor it is *also* necessary to add two variables to  
     211the parameter list:: 
     212 
     213     parameters = [  
     214                     ['radius_effective', '', 1, [0.0, numpy.inf], 'volume', ''], 
     215                     ['volfraction', '', 1, [0.0, 1.0], '', ''], 
     216                     [...], 
     217 
     218and to the declarations of the functions Iq and Iqxy::: 
     219 
     220     def Iq(x , radius_effective, volfraction, ...): 
     221 
     222     def Iqxy(x, y, radius_effective, volfraction, ...): 
     223 
     224Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once  
     225a P(Q) model has been selected). 
     226 
    197227Sum|Multi(p1,p2) 
    198228^^^^^^^^^^^^^^^^ 
     
    206236or:: 
    207237 
    208      Plugin Model = scale_factor * model_1 /* model_2 + background 
     238     Plugin Model = scale_factor * (model1 * model2) + background 
    209239 
    210240In the *Easy Sum/Multi Editor* give the new model a function name and brief 
    211241description (to appear under the *Details* button on the *FitPage*). Then select 
    212242two existing models, as p1 and p2, and the required operator, '+' or '*' between 
    213 them. Finally, click the *Apply* button to generate the model and then click *Close*. 
    214  
    215 Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage. 
     243them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 
     244 
     245Any changes to a plugin model generated in this way only become effective *after* it is re-selected  
     246from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a  
     247recompilation of the plugins by selecting *Fitting* > *Plugin Model Operations* > *Load Plugin Models*. 
     248 
     249**SasView version 4.2** introduced a much simplified and more extensible structure for plugin models  
     250generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model  
     251with a power law model now looks like this:: 
     252 
     253     from sasmodels.core import load_model_info 
     254     from sasmodels.sasview_model import make_model_from_info 
     255      
     256     model_info = load_model_info('sphere+power_law') 
     257     model_info.name = 'MyPluginModel' 
     258     model_info.description = 'sphere + power_law' 
     259     Model = make_model_from_info(model_info) 
     260 
     261To change the models or operators contributing to this plugin it is only necessary to edit the string  
     262in the brackets after *load_model_info*, though it would also be a good idea to update the model name  
     263and description too!!! 
     264 
     265The model specification string can handle multiple models and combinations of operators (+ or *) which  
     266are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would  
     267multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be  
     268prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little  
     269confusing, unless you were creating a plugin model from multiple instances of the same model the parameter  
     270assignments ought to be obvious when you load the plugin. 
     271 
     272If you need to include another plugin model in the model specification string, just prefix the name of  
     273that model with *custom*. For instance:: 
     274 
     275     sphere+custom.MyPluginModel 
     276 
     277To create a P(Q)*\S(Q) model use the @ symbol instead of * like this:: 
     278 
     279     sphere@hardsphere 
     280      
     281This streamlined approach to building complex plugin models from existing library models, or models  
     282available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something  
     283that was not possible in earlier versions of SasView.  
    216284 
    217285.. _Advanced_Plugin_Editor: 
     
    484552.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    485553 
     554.. _Batch_Fit_Mode: 
     555 
    486556Batch Fit Mode 
    487557-------------- 
     
    636706 
    637707     Example: radius [2 : 5] , radius [10 : 25] 
    638  
    639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    640  
    641 .. note::  This help document was last changed by Steve King, 10Oct2016 
     708      
     709.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     710 
     711Combined Batch Fit Mode 
     712----------------------- 
     713 
     714The purpose of the Combined Batch Fit is to allow running two or more batch 
     715fits in sequence without overwriting the output table of results.  This may be 
     716of interest for example if one is fitting a series of data sets where there is 
     717a shape change occurring in the series that requires changing the model part 
     718way through the series; for example a sphere to rod transition.  Indeed the 
     719regular batch mode does not allow for multiple models and requires all the 
     720files in the series to be fit with single model and set of parameters.  While 
     721it is of course possible to just run part of the series as a batch fit using 
     722model one followed by running another batch fit on the rest of the series with 
     723model two (and/or model three etc), doing so will overwrite the table of 
     724outputs from the previous batch fit(s).  This may not be desirable if one is 
     725interested in comparing the parameters: for example the sphere radius of set 
     726one and the cylinder radius of set two. 
     727 
     728Method 
     729^^^^^^ 
     730 
     731In order to use the *Combined Batch Fit*, first load all the data needed as 
     732described in :ref:`Loading_data`. Next start up two or more *BatchPage* fits 
     733following the instructions in :ref:`Batch_Fit_Mode` but **DO NOT PRESS FIT**. 
     734At this point the *Combine Batch Fit* menu item under the *Fitting menu* should 
     735be active (if there is one or no *BatchPage* the menu item will be greyed out 
     736and inactive).  Clicking on *Combine Batch Fit* will bring up a new panel, 
     737similar to the *Const & Simult Fit* panel. In this case there will be a 
     738checkbox for each *BatchPage* instead of each *FitPage* that should be included 
     739in the fit.  Once all are selected, click the Fit button on 
     740the *BatchPage* to run each batch fit in *sequence* 
     741 
     742.. image:: combine_batch_page.png 
     743 
     744The batch table will then pop up at the end as for the case of the simple Batch 
     745Fitting with the following caveats: 
     746 
     747.. note:: 
     748   The order matters.  The parameters in the table will be taken from the model 
     749   used in the first *BatchPage* of the list.  Any parameters from the 
     750   second and later *BatchPage* s that have the same name as a parameter in the 
     751   first will show up allowing for plotting of that parameter across the 
     752   models. The other parameters will not be available in the grid. 
     753.. note:: 
     754   a corralary of the above is that currently models created as a sum|multiply 
     755   model will not work as desired because the generated model parameters have a 
     756   p#_ appended to the beginning and thus radius and p1_radius will not be 
     757   recognized as the same parameter. 
     758    
     759.. image:: combine_batch_grid.png 
     760 
     761In the example shown above the data is a time series with a shifting peak. 
     762The first part of the series was fitted using the *broad_peak* model, while 
     763the rest of the data were fit using the *gaussian_peak* model. Unfortunately the 
     764time is not listed in the file but the file name contains the information. As 
     765described in :ref:`Grid_Window`, a column can be added manually, in this case 
     766called time, and the peak position plotted against time.  
     767 
     768.. image:: combine_batch_plot.png 
     769 
     770Note the discontinuity in the peak position.  This reflects the fact that the 
     771Gaussian fit is a rather poor model for the data and is not actually 
     772finding the peak. 
     773 
     774.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     775 
     776.. note::  This help document was last changed by Paul Butler, 10 September 
     777   2017 
Note: See TracChangeset for help on using the changeset viewer.