Changeset f485ba0 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Sep 15, 2017 10:45:36 AM (7 years ago)
Author:
smk78
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, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
203669a
Parents:
c6a298c
Message:

Updated fitting_help.rst amd plugin.rst in light of work on #767 & #861

Location:
src/sas/sasgui/perspectives/fitting/media
Files:
2 edited

Legend:

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

    r05b0bf6 rf485ba0  
    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, [-numpy.inf, numpy.inf], 'volume', ''], 
     215                     ['volfraction', '', 1, [-numpy.inf, numpy.inf], '', ''], 
     216                                         . 
     217                                         . 
     218 
     219and to the declarations of the functions Iq and Iqxy::: 
     220 
     221     def Iq(x , radius_effective, volfraction, ...): 
     222 
     223     def Iqxy(x, y, radius_effective, volfraction, ...): 
     224 
     225Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once  
     226a P(Q) model has been selected). 
     227 
    197228Sum|Multi(p1,p2) 
    198229^^^^^^^^^^^^^^^^ 
     
    206237or:: 
    207238 
    208      Plugin Model = scale_factor * model_1 /* model_2 + background 
     239     Plugin Model = scale_factor * (model1 * model2) + background 
    209240 
    210241In the *Easy Sum/Multi Editor* give the new model a function name and brief 
    211242description (to appear under the *Details* button on the *FitPage*). Then select 
    212243two 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. 
     244them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 
     245 
     246Any changes to a plugin model generated in this way only become effective *after* it is re-selected from 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 = 'My Plugin Model' 
     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 (+ - * /) 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 assignments ought to be obvious when you load the plugin. 
     270 
     271This streamlined approach to building complex plugin models from existing library models, or models  
     272available on the *Model Marketplace*, also permits the creation of P(Q)S(Q) plugin models, something  
     273that was not possible in earlier versions of SasView.  
    216274 
    217275.. _Advanced_Plugin_Editor: 
  • src/sas/sasgui/perspectives/fitting/media/plugin.rst

    r72100ee rf485ba0  
    1818* By writing a model from scratch outside of SasView (only recommended for 
    1919  code monkeys!) 
     20 
     21Also see :ref:`Adding_your_own_models`. 
    2022 
    2123Overview 
Note: See TracChangeset for help on using the changeset viewer.