Changeset f3377b8 in sasview for src/sas


Ignore:
Timestamp:
May 15, 2015 9:36:38 PM (10 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
1fda506
Parents:
a6f3613
Message:

Work in progress

File:
1 edited

Legend:

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

    ra6f3613 rf3377b8  
    3535each data set. 
    3636 
    37 Instructions on how to load and activate data are in the User Documentation 
    38 section :ref:`Loading_data`. 
     37Instructions on how to load and activate data are in the section :ref:`Loading_data`. 
    3938 
    4039SasView can fit data in one of three ways: 
     
    4241*  in *Single* fit mode - individual data sets are fitted independently one-by-one 
    4342 
    44 *  in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to 
    45 the *same* model with/without constrained parameters (this might be useful, for 
    46 example, if you have measured the same sample at different contrasts) 
    47  
    48 *  in *Batch* fit mode - multiple data sets are fitted sequentially to the 
    49 *same* model (this might be useful, for example, if you have performed a kinetic 
    50 or time-resolved experiment and have *lots* of data sets!) 
     43*  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) 
     44 
     45*  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!) 
    5146 
    5247.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    5853 
    5954*  *Shapes* - models describing 'objects' (spheres, cylinders, etc) 
    60 *  *Shape-Independent* - models describing structure in terms of density 
    61 correlation functions, fractals, peaks, power laws, etc 
     55*  *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc 
    6256*  *Customized Models* - SasView-created (non-library) Python models 
    6357*  *Uncategorised* - other models (for reflectivity, etc) 
     
    6559 
    6660Use the *Category* drop-down menu to chose a category of model, then select 
    67 a model from the drop-down menu beneath. You can decide your own model 
    68 categorizations using the :ref:`Category_Manager`. 
     61a model from the drop-down menu beneath. A graph of the chosen model, calculated 
     62using default parameter values, will appear. The graph will update dynamically 
     63as the parameter values are changed. 
     64 
     65You can decide your own model categorizations using the :ref:`Category_Manager`. 
    6966 
    7067Once you have selected a model you can read its help documentation by clicking 
     
    8481.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    8582 
     83.. _Category_Manager: 
     84 
     85Category Manager 
     86---------------- 
     87 
     88To change the model categorizations, either choose *Category Manager* from the 
     89*View* option on the menubar, or click on the *Modify* button on the *Fit Page*. 
     90 
     91.. image:: cat_fig0.bmp 
     92 
     93The categorization of all models except the customized models can be reassigned, 
     94added to, and removed using *Category Manager*. Models can also be hidden from view 
     95in the drop-down menus. 
     96 
     97.. image:: cat_fig1.bmp 
     98 
     99Changing category 
     100^^^^^^^^^^^^^^^^^ 
     101 
     102To change category, highlight a model in the list by left-clicking on its entry and 
     103then click the *Modify* button. Use the *Change Category* panel that appears to make 
     104the required changes. 
     105 
     106.. image:: cat_fig2.bmp 
     107 
     108To create a category for the selected model, click the *Add* button. In order 
     109to delete a category, select the category name and click the *Remove Selected* 
     110button. Then click *Done*. 
     111 
     112Showing/hiding models 
     113^^^^^^^^^^^^^^^^^^^^^ 
     114 
     115Use the *Enable All/Disable All* buttons and the check boxes beside each model to 
     116select the models to show/hide. To apply the selection, click *Ok*. Otherwise click 
     117*Cancel*. 
     118 
     119*NB: it may be necessary to change to a different category and then back again* 
     120*before any changes take effect.* 
     121 
     122.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     123 
    86124Model Functions 
    87125--------------- 
    88126 
    89 For a complete list of all the models available in SasView, see the section 
     127For a complete list of all the library models available in SasView, see the section 
    90128:ref:`SasView_model_functions`. 
    91129 
    92 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    93  
    94 .. _Category_Manager: 
    95  
    96 Category Manager 
    97 ---------------- 
    98  
    99 To change the model categorizations, click on the *Modify* button on the *Fit Page*. 
    100  
    101 Our SAS models are, by default, classified into 5 categories; shapes, 
    102 shape-independent, structure factor, and customized models, where these 
    103 categories (except the customized models) can be reassigned, added, and 
    104 removed using 'Category Manager'. Each models can also be enabled(shown)/ 
    105 disabled(hidden) from the category that they belong. The Category Manager 
    106 panel is accessible from the model category 'Modify' button in the fitting 
    107 panel or the 'View/Category Manager' menu in the menu bar (Fig. 1). 
    108  
    109 1) Enable/Disable models: Check/uncheck the check boxes to enable/disable the 
    110 models (Fig. 2). 
    111  
    112 2) Change category: Highlight a model in the list by left-clicking and click 
    113 the 'Modify' button. In the 'Change Category' panel, one can create/use a 
    114 category for the model, then click the 'Add' button. In order to delete a 
    115 category, select a category name and click the 'Remove Selected' button 
    116 (Fig. 3). 
    117  
    118 3) To apply the changes made, hit the OK button. Otherwise, click the 'Cancel' 
    119 button (Fig. 2). 
    120  
    121 .. image:: cat_fig0.bmp 
    122  
    123 Fig.1 
    124  
    125 .. image:: cat_fig1.bmp 
    126  
    127 Fig.2 
    128  
    129 .. image:: cat_fig2.bmp 
    130  
    131 Fig.3 
    132  
    133 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    134  
    135  
    136  
    137 Change Model Parameters 
    138 ^^^^^^^^^^^^^^^^^^^^^^^ 
    139  
    140 To visualize model in a different window, from menu click on *Model*. Select 
    141 a type of model and then the name of your model.A new window will appear with 
    142 the plot of your model with default values. Change model's parameters on 
    143 *model view*  tab and view the plotted model with its new parameters. 
    144  
    145 Write your Own Model 
    146 ^^^^^^^^^^^^^^^^^^^^ 
    147  
    148 The custom model editors are provided from 'Fitting' menu in the menu bar. 
    149 See 'Custom model editor' in the side menu on left. Advanced users can write 
    150 your own model and save it (in .py format) into *plugin_models*  directory in 
    151 .sasview of your home directory (eg., username\.sasview>\plugin_models). Your 
    152 plugin model will be added into "<>Customized Models" on the next model 
    153 selection. 
    154  
    155 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     130It is also possible to add your own models. 
     131 
     132.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     133 
     134Adding your own models 
     135---------------------- 
     136 
     137There are currently two ways to add your own models to SasView: 
     138 
     139* using the :ref:`Custom_Model_Editor` 
     140* by :ref:`Writing_a_Plugin` 
     141 
     142*NB: Because of the way these options are implemented, it is not possible for them* 
     143*to use the polydispersity algorithms in SasView. Only models in the model library* 
     144*can do this. At the time of writing (Release 3.1.0) work is in hand to make it* 
     145*easier to add new models to the model library.* 
     146 
     147.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     148 
     149.. _Custom_Model_Editor: 
    156150 
    157151Custom Model Editor 
    158152------------------- 
    159153 
    160 Description 
    161 ^^^^^^^^^^^ 
    162  
    163 This menu (Fitting/Edit Custom Model in the menu bar) interface is to provide 
    164 you an easy way to write your own custom models. The changes in a model 
    165 function are effective after it is re-selected from the combo-box menu. 
     154From the *Fitting* option in the menu bar, select *Edit Custom Model*. 
    166155 
    167156.. image:: edit_model_menu.bmp 
    168157 
     158and then one of the options 
     159 
     160*  *New* - to create a new custom model template 
     161*  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library 
     162*  *Advanced* - to edit a new custom model 
     163*  *Delete* - to delete a custom model 
     164 
    169165New 
    170 --- 
    171  
    172 This option is used to make a new model. A model code generated by this option 
    173 can be viewed and further modified by the 'Advanced' option below. 
     166^^^^ 
    174167 
    175168.. image:: new_model.bmp 
     169 
     170A model template generated by this option can be viewed and further modified using 
     171the :ref:`Advanced` option. 
    176172 
    177173Sum|Multi(p1,p2) 
    178174^^^^^^^^^^^^^^^^ 
    179175 
    180 This option create a new sum (or multiplication) model. Fill up the (sum 
    181 model function) name and the description. The description will show up on 
    182 details button in the application. Then select the p1 or p2 model for the 
    183 sum/multi model, select an operator as necessary and click the Apply button 
    184 for activation. Hit the 'Close' button when it's done. 
    185  
    186176.. image:: sum_model.bmp 
     177 
     178This option creates a custom model of the form 
     179 
     180Custom Model = scale_factor * (model1 +/* model2) 
     181 
     182In the *Easy Sum/Multi Editor* give the new custom model a function name and brief 
     183description (to appear under the *Details* button on the *Fit Page*). Then select 
     184two existing models, as p1 and p2, and the required operator, '+' or '*' between 
     185them. Finally, click the *Apply* button to generate the model and then click *Close*. 
     186 
     187*NB: Any changes to a custom model generated in this way only become effective after* 
     188*it is re-selected from the model drop-down menu on the Fit Page.* 
     189 
     190.. _Advanced: 
    187191 
    188192Advanced 
    189193^^^^^^^^ 
    190194 
    191 The menu option shows all the files in the plugin_models folder. You can edit, 
    192 modify, and save it. It is recommended to modify only the lines with arrow 
    193 (-------). In the end of edit, 'Compile' and 'Run' from the menu bar to 
    194 activate or to see the model working properly. 
     195Selecting this option shows all the custom models in the plugin model folder 
     196 
     197C:\Users\[username]\.sasview\plugin_models - (on Windows) 
     198 
     199You can edit, modify, and save the Python code in any of these models using the 
     200*Advanced Custom Model Editor*. 
     201 
     202*NB: Unless you are confident about what you are doing, it is recommended that you* 
     203*only modify lines denoted with the ## <----- comments!* 
     204 
     205When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An 
     206*Info* box will appear with the results of the compilation and model unit tests. The 
     207model will only be usable if the tests 'pass'. 
     208 
     209To use the model, go to the relevant *Fit Page*, select the *Customized Models* 
     210category and then select the model from the drop-down menu. 
     211 
     212*NB: Any changes to a custom model generated in this way only become effective after* 
     213*it is re-selected from the model drop-down menu on the Fit Page.* 
    195214 
    196215Delete 
    197216^^^^^^ 
    198217 
    199 The menu option is to delete the custom models. Just select the file name to 
    200 delete. 
    201  
    202 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    203  
    204 Key Combinations 
     218Simply highlight the custom model to be removed. This operation is final! 
     219 
     220*NB: Custom models shipped with SasView cannot be removed in this way.* 
     221 
     222.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     223 
     224.. _Writing_a_Plugin: 
     225 
     226Writing a Plugin 
    205227---------------- 
    206228 
    207 Copy & Paste 
    208 ^^^^^^^^^^^^ 
    209  
    210 To copy the parameter values in a Fit(Model) panel to the clipboard: 
    211  
    212 *Ctrl(Cmd on MAC) + Left(Mouse)Click*  on the panel. 
    213  
    214 To paste the parameter values to a Fit(Model)panel from the clipboard: 
    215  
    216 *Ctrl(Cmd on MAC) + Shift + Left(Mouse)Click*  on the panel. 
    217  
    218 If this operation is successful, it will say so in the info line at the 
     229Advanced users can write their own model in Python and save it to the the SasView 
     230*plugin_models* folder 
     231 
     232C:\Users\[username]\.sasview\plugin_models - (on Windows) 
     233 
     234in .py format. The next time SasView is started it will compile the plugin and add 
     235it to the list of *Customized Models*. 
     236 
     237It is recommended that existing plugin models be used as templates. 
     238 
     239.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     240 
     241Fitting Options 
     242--------------- 
     243 
     244It is possible to specify which optimiser SasView should use to fit the data, and 
     245to modify some of the configurational parameters for each optimiser. 
     246 
     247From *Fitting* in the menu bar select *Fit Options*, then select one of the following 
     248optimisers: 
     249 
     250*  DREAM 
     251*  Levenberg-Marquardt 
     252*  Quasi-Newton BFGS 
     253*  Differential Evolution 
     254*  Nelder-Mead Simplex 
     255 
     256These optimisers form the *Bumps* package written by P Kienzle. For more information 
     257on each optimiser, see *Information on the SasView Optimisers* in the documentation 
     258for the :ref:`Fitting Perspective`. 
     259 
     260.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     261 
     262Shortcuts 
     263--------- 
     264 
     265Copy/Paste Parameters 
     266^^^^^^^^^^^^^^^^^^^^^ 
     267 
     268It is possible to copy the parameters from one *Fit Page* and to paste them into 
     269another *Fit Page* using the same model. 
     270 
     271To *copy* parameters, either: 
     272 
     273*  Select *Edit -> Copy Params* from the menu bar, or 
     274*  Use Ctrl(Cmd on Mac) + Left Mouse Click on the *Fit Page*. 
     275 
     276To *paste* parameters, either: 
     277 
     278*  Select *Edit -> Paste Params* from the menu bar, or 
     279*  Use Ctrl(Cmd on Mac) + Shift + Left-click on the *Fit Page*. 
     280 
     281If either operation is successful a message will appear in the info line at the 
    219282bottom of the SasView window. 
    220283 
     
    222285^^^^^^^^ 
    223286 
    224 Bookmark of a fit-panel or model-panel status: 
    225  
    226 *(Mouse)Right-Click*  and select the bookmark in the popup list. 
    227  
    228 Graph Context Menu 
    229 ^^^^^^^^^^^^^^^^^^ 
    230  
    231 To get the graph context menu to print, copy, save data, (2D)average, etc.: 
    232  
    233 *Locate the mouse point on the plot to highlight and *(Mouse) Right Click* 
    234 to bring up the full menu. 
    235  
    236 FTolerance (SciPy) 
    237 ^^^^^^^^^^^^^^^^^^ 
    238  
    239 To change the ftol value of the Scipy FitEngine (leastsq): 
    240  
    241 First, make sure that the Fit panel has data and a model selected. 
    242  
    243 *Ctrl(Cmd on MAC) + Shift + Alt + Right(Mouse)Click*  on the panel. 
    244  
    245 Then, set up the value in the dialog panel. 
    246  
    247 If this operation is successful, the new ftol value will be displayed in the 
    248 info line at the bottom of the SV window.Note that increasing the ftol value 
    249 may cause for the fitting to terminate with higher |chi| sq. 
     287To *Bookmark* a *Fit Page* or model-panel status, either: 
     288 
     289*  Select a *Fit Page* and then click on *Bookmark* in the tool bar, or 
     290*  Right-click and select the *Bookmark* in the popup menu. 
    250291 
    251292.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    323364an empty batch page exists, it will be set there. Otherwise it will create a  
    324365new Batch Page. Set up the model and the parameter values as same as a single  
    325 fitting (see Single Fit help) <Single_Fit_>. Then use 'Fit' button to  
     366fitting (see Single Fit help). Then use 'Fit' button to 
    326367perform the fitting. 
    327368 
Note: See TracChangeset for help on using the changeset viewer.