Ignore:
Timestamp:
Apr 10, 2017 4:01:46 AM (8 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
6c8fb2c
Parents:
9208346 (diff), c6f3aec (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 ESS_GUI

File:
1 edited

Legend:

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

    rf237c05 r9687d58  
    1818======= 
    1919 
     20.. note:: If some code blocks are not readable, expand the documentation window 
     21 
    2022.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    2123 
     
    3234*  in *Single* fit mode - individual data sets are fitted independently one-by-one 
    3335 
    34 *  in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to the *same* model with/without constrained parameters (this might be useful, for example, if you have measured the same sample at different contrasts) 
     36*  in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to 
     37   the *same* model with/without constrained parameters (this might be useful, 
     38   for example, if you have measured the same sample at different contrasts) 
    3539 
    3640*  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!) 
     
    4145----------------- 
    4246 
    43 By default, the models in SasView are grouped into five categories 
    44  
    45 *  *Shapes* - models describing 'objects' (spheres, cylinders, etc) 
     47The models in SasView are grouped into categories. By default these consist of: 
     48 
     49*  *Cylinder* - cylindrical shapes (disc, right cylinder, cylinder with endcaps 
     50   etc) 
     51*  *Ellipsoid* - ellipsoidal shapes (oblate,prolate, core shell, etc) 
     52*  *Parellelepiped* - as the name implies 
     53*  *Sphere* - sheroidal shapes (sphere, core multishell, vesicle, etc) 
     54*  *Lamellae* - lamellar shapes (lamellar, core shell lamellar, stacked 
     55   lamellar, etc) 
    4656*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc 
    47 *  *Customized Models* - SasView- or User-created (non-library) Python models 
    48 *  *Uncategorised* - other models (for reflectivity, etc) 
     57*  *Paracrystal* - semi ordered structures (bcc, fcc, etc) 
    4958*  *Structure Factor* - S(Q) models 
     59*  *Plugin Models* - User-created (custom/non-library) Python models 
    5060 
    5161Use the *Category* drop-down menu to chose a category of model, then select 
     
    8292.. image:: cat_fig0.bmp 
    8393 
    84 The categorization of all models except the customized models can be reassigned, 
    85 added to, and removed using *Category Manager*. Models can also be hidden from view 
    86 in the drop-down menus. 
     94The categorization of all models except the user supplied Plugin Models can be 
     95reassigned, added to, and removed using *Category Manager*. Models can also be 
     96hidden from view in the drop-down menus. 
    8797 
    8898.. image:: cat_fig1.bmp 
     
    91101^^^^^^^^^^^^^^^^^ 
    92102 
    93 To change category, highlight a model in the list by left-clicking on its entry and 
    94 then click the *Modify* button. Use the *Change Category* panel that appears to make 
    95 the required changes. 
     103To change category, highlight a model in the list by left-clicking on its entry 
     104and then click the *Modify* button. Use the *Change Category* panel that appears 
     105to make the required changes. 
    96106 
    97107.. image:: cat_fig2.bmp 
     
    104114^^^^^^^^^^^^^^^^^^^^^ 
    105115 
    106 Use the *Enable All / Disable All* buttons and the check boxes beside each model to 
    107 select the models to show/hide. To apply the selection, click *Ok*. Otherwise click 
    108 *Cancel*. 
     116Use the *Enable All / Disable All* buttons and the check boxes beside each model 
     117to select the models to show/hide. To apply the selection, click *Ok*. Otherwise 
     118click *Cancel*. 
    109119 
    110120*NB: It may be necessary to change to a different category and then back again* 
     
    116126--------------- 
    117127 
    118 For a complete list of all the library models available in SasView, see the Model Documentation. 
     128For a complete list of all the library models available in SasView, see 
     129the `Model Documentation <../../../index.html>`_ . 
    119130 
    120131It is also possible to add your own models. 
     
    124135.. _Adding_your_own_models: 
    125136 
    126 Adding your own models 
     137Adding your own Models 
    127138---------------------- 
    128139 
    129 There are currently two ways to add your own models to SasView: 
    130  
    131 * Using the :ref:`Custom_Model_Editor` 
    132 * By :ref:`Writing_a_Plugin` 
    133  
    134 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    135  
    136 .. _Custom_Model_Editor: 
    137  
    138 Custom Model Editor 
    139 ------------------- 
    140  
    141 From the *Fitting* option in the menu bar, select *Edit Custom Model*. 
    142  
    143 .. image:: edit_model_menu.bmp 
    144  
    145 and then one of the options 
    146  
    147 *  *New* - to create a new custom model template 
    148 *  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library 
    149 *  *Advanced* - to edit a new custom model 
    150 *  *Delete* - to delete a custom model 
    151  
    152 New 
    153 ^^^^ 
     140There are essentially three ways to generate new fitting models for SasView: 
     141 
     142*  Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners 
     143   and/or relatively simple models) 
     144*  By copying/editing an existing model (this can include models generated by 
     145   the New Plugin Model* dialog) in the :ref:`Python_shell` or  
     146   :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 
     147*  By writing a model from scratch outside of SasView (only recommended for code 
     148   monkeys!) 
     149 
     150Please read the guidance on :ref:`Writing_a_Plugin` before proceeding. 
     151 
     152**To be found by SasView your model must reside in the *~\\.sasview\\plugin_models* folder.** 
     153 
     154.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     155 
     156.. _Plugin_Model_Operations: 
     157 
     158Plugin Model Operations 
     159----------------------- 
     160 
     161From the *Fitting* option in the menu bar, select *Plugin Model Operations* 
     162 
     163.. image:: edit_model_menu.png 
     164 
     165and then one of the sub-options 
     166 
     167*  *New Plugin Model* - to create a plugin model template with a helper dialog 
     168*  *Sum|Multi(p1,p2)* - to create a plugin model by summing/multiplying *existing models* in the model library 
     169*  *Advanced Plugin Editor* - to create/edit a plugin model in a Python shell 
     170*  *Delete Plugin Models* - to delete a plugin model 
     171*  *Load Plugin Models* - to (re-)load plugin models 
     172 
     173.. _New_Plugin_Model: 
     174 
     175New Plugin Model 
     176^^^^^^^^^^^^^^^^ 
     177 
     178Relatively straightforward models can be programmed directly from the SasView 
     179GUI using the *New Plugin Model Function*. 
    154180 
    155181.. image:: new_model.bmp 
    156182 
    157 A model template generated by this option can be viewed and further modified using 
    158 the :ref:`Advanced` option. 
    159  
    160 *NB: "Fit Parameters" has been split into two sections, those which can be 
    161 polydisperse (shape and orientation parameters) and those which are not 
    162 (scattering length densities, for example).* 
     183When using this feature, be aware that even if your code has errors, including  
     184syntax errors, a model file is still generated. When you then correct the errors  
     185and click 'Apply' again to re-compile you will get an error informing you that  
     186the model already exists if the 'Overwrite' box is not checked. In this case you  
     187will need to supply a new model function name. By default the 'Overwrite' box is  
     188*checked*\ . 
     189 
     190Also note that the 'Fit Parameters' have been split into two sections: those 
     191which can be polydisperse (shape and orientation parameters) and those which are 
     192not (eg, scattering length densities). 
     193 
     194A model file generated by this option can be viewed and further modified using 
     195the :ref:`Advanced_Plugin_Editor` . 
    163196 
    164197Sum|Multi(p1,p2) 
     
    167200.. image:: sum_model.bmp 
    168201 
    169 This option creates a custom model of the form 
    170  
    171 Custom Model = scale_factor \* (model1 +/\* model2) 
    172  
    173 In the *Easy Sum/Multi Editor* give the new custom model a function name and brief 
    174 description (to appear under the *Details* button on the *Fit Page*). Then select 
     202This option creates a custom Plugin Model of the form:: 
     203 
     204     Plugin Model = scale_factor * {(scale_1 * model_1) +/- (scale_2 * model_2)} + background 
     205 
     206or:: 
     207 
     208     Plugin Model = scale_factor * model_1 /* model_2 + background 
     209 
     210In the *Easy Sum/Multi Editor* give the new model a function name and brief 
     211description (to appear under the *Details* button on the *FitPage*). Then select 
    175212two existing models, as p1 and p2, and the required operator, '+' or '*' between 
    176213them. Finally, click the *Apply* button to generate the model and then click *Close*. 
    177214 
    178 *NB: Any changes to a custom model generated in this way only become effective after* 
    179 *it is re-selected from the model drop-down menu on the Fit Page.* 
    180  
    181 .. _Advanced: 
    182  
    183 Advanced 
    184 ^^^^^^^^ 
    185  
    186 Selecting this option shows all the custom models in the plugin model folder 
    187  
    188   *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows) 
     215Any 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. 
     216 
     217.. _Advanced_Plugin_Editor: 
     218 
     219Advanced Plugin Editor 
     220^^^^^^^^^^^^^^^^^^^^^^ 
     221 
     222Selecting this option shows all the plugin models in the plugin model folder, on Windows this is 
     223 
     224  *C:\\Users\\{username}\\.sasview\\plugin_models* 
    189225 
    190226You can edit, modify, and save the Python code in any of these models using the 
    191 *Advanced Custom Model Editor*. 
    192  
    193 See :ref:`Writing_a_Plugin` for details on the plugin format. 
    194  
    195 *NB: Sum/Product models are still using the SasView 3.x model format.  Unless 
    196 you are confident about what you are doing, it is recommended that you 
    197 only modify lines denoted with the ## <----- comments!* 
    198  
    199 When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An 
    200 *Info* box will appear with the results of the compilation and model unit tests. The 
    201 model will only be usable if the tests 'pass'. 
    202  
    203 To use the model, go to the relevant *Fit Page*, select the *Customized Models* 
     227*Advanced Plugin Model Editor*. Note that this is actually the same tool as the :ref:`Python_shell` . 
     228 
     229For details of the SasView plugin model format see :ref:`Writing_a_Plugin` . 
     230 
     231.. note:: Model files generated with the Sum/Multi option are still using the SasView 3.x model format. Unless you are confident about what you are doing, it is recommended that you only modify lines denoted with the ## <----- comments! 
     232 
     233When editing is complete, select *Run* > *Check Model* from the *Advanced Plugin Model Editor* menu bar. An *Info* box will appear with the results of the compilation and model unit tests. The model will only be usable if the tests 'pass'. 
     234 
     235.. image:: ../calculator/new_pycrust_example_2.png 
     236 
     237To use the model, go to the relevant *Fit Page*, select the *Plugin Models* 
    204238category and then select the model from the drop-down menu. 
    205239 
    206 *NB: Any changes to a custom model generated in this way only become effective after* 
    207 *it is re-selected from the model drop-down menu on the Fit Page.* 
    208  
    209 Delete 
    210 ^^^^^^ 
    211  
    212 Simply highlight the custom model to be removed. This operation is final! 
    213  
    214 *NB: Custom models shipped with SasView cannot be removed in this way.* 
    215  
    216 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    217  
    218   .. _Writing_a_Plugin: 
    219  
    220   Writing a Plugin 
    221   ---------------- 
    222  
    223   Advanced users can write their own model in Python and save it to the the SasView 
    224   *plugin_models* folder 
    225  
    226     *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows) 
    227  
    228   in .py format. The next time SasView is started it will compile the plugin and add 
    229   it to the list of *Customized Models*. 
    230  
    231   It is recommended that existing plugin models be used as templates. 
     240Any 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. 
     241 
     242Delete Plugin Models 
     243^^^^^^^^^^^^^^^^^^^^ 
     244 
     245Simply highlight the plugin model to be removed. The operation is final!!! 
     246 
     247*NB: Models shipped with SasView cannot be removed in this way.* 
     248 
     249Load Plugin Models 
     250^^^^^^^^^^^^^^^^^^ 
     251 
     252This option loads (or re-loads) all models present in the 
     253*~\\.sasview\\plugin_models* folder. 
    232254 
    233255.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    392414:ref:`Assessing_Fit_Quality`. 
    393415 
    394 *NB: If you need to use a customized model, you must ensure that model is available* 
    395 *first (see* :ref:`Adding_your_own_models` *).* 
     416*NB: If you need to use a custom Plugin Model, you must ensure that model is 
     417available first (see* :ref:`Adding_your_own_models` *).* 
    396418 
    397419Method 
     
    476498If multiple data sets are in one file, load just that file. *Unselect All Data*, then 
    477499select a single initial data set to be fitted. Fit that selected data set as described 
    478 above under :ref:`Single_Fit_Mode` . 
    479  
    480 *NB: If you need to use a customized model, you must ensure that model is available* 
    481 *first (see* :ref:`Adding_your_own_models` *).* 
     500above under :ref:`Single_Fit_Mode`. 
     501 
     502*NB: If you need to use a custom Plugin Model, you must ensure that model is 
     503available first (see* :ref:`Adding_your_own_models` *).* 
    482504 
    483505Method 
     
    617639.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    618640 
    619 .. note::  This help document was last changed by Steve King, 04Jun2015 
     641.. note::  This help document was last changed by Steve King, 10Oct2016 
Note: See TracChangeset for help on using the changeset viewer.