Changeset 9687d58 in sasview for src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
- Timestamp:
- Apr 10, 2017 4:01:46 AM (8 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
rf237c05 r9687d58 18 18 ======= 19 19 20 .. note:: If some code blocks are not readable, expand the documentation window 21 20 22 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 21 23 … … 32 34 * in *Single* fit mode - individual data sets are fitted independently one-by-one 33 35 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) 35 39 36 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!) … … 41 45 ----------------- 42 46 43 By default, the models in SasView are grouped into five categories 44 45 * *Shapes* - models describing 'objects' (spheres, cylinders, etc) 47 The 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) 46 56 * *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) 49 58 * *Structure Factor* - S(Q) models 59 * *Plugin Models* - User-created (custom/non-library) Python models 50 60 51 61 Use the *Category* drop-down menu to chose a category of model, then select … … 82 92 .. image:: cat_fig0.bmp 83 93 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.94 The categorization of all models except the user supplied Plugin Models can be 95 reassigned, added to, and removed using *Category Manager*. Models can also be 96 hidden from view in the drop-down menus. 87 97 88 98 .. image:: cat_fig1.bmp … … 91 101 ^^^^^^^^^^^^^^^^^ 92 102 93 To change category, highlight a model in the list by left-clicking on its entry and94 then click the *Modify* button. Use the *Change Category* panel that appears to make 95 t he required changes.103 To change category, highlight a model in the list by left-clicking on its entry 104 and then click the *Modify* button. Use the *Change Category* panel that appears 105 to make the required changes. 96 106 97 107 .. image:: cat_fig2.bmp … … 104 114 ^^^^^^^^^^^^^^^^^^^^^ 105 115 106 Use the *Enable All / Disable All* buttons and the check boxes beside each model to107 select the models to show/hide. To apply the selection, click *Ok*. Otherwise click 108 *Cancel*.116 Use the *Enable All / Disable All* buttons and the check boxes beside each model 117 to select the models to show/hide. To apply the selection, click *Ok*. Otherwise 118 click *Cancel*. 109 119 110 120 *NB: It may be necessary to change to a different category and then back again* … … 116 126 --------------- 117 127 118 For a complete list of all the library models available in SasView, see the Model Documentation. 128 For a complete list of all the library models available in SasView, see 129 the `Model Documentation <../../../index.html>`_ . 119 130 120 131 It is also possible to add your own models. … … 124 135 .. _Adding_your_own_models: 125 136 126 Adding your own models137 Adding your own Models 127 138 ---------------------- 128 139 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 ^^^^ 140 There 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 150 Please 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 158 Plugin Model Operations 159 ----------------------- 160 161 From the *Fitting* option in the menu bar, select *Plugin Model Operations* 162 163 .. image:: edit_model_menu.png 164 165 and 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 175 New Plugin Model 176 ^^^^^^^^^^^^^^^^ 177 178 Relatively straightforward models can be programmed directly from the SasView 179 GUI using the *New Plugin Model Function*. 154 180 155 181 .. image:: new_model.bmp 156 182 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).* 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 188 *checked*\ . 189 190 Also note that the 'Fit Parameters' have been split into two sections: those 191 which can be polydisperse (shape and orientation parameters) and those which are 192 not (eg, scattering length densities). 193 194 A model file generated by this option can be viewed and further modified using 195 the :ref:`Advanced_Plugin_Editor` . 163 196 164 197 Sum|Multi(p1,p2) … … 167 200 .. image:: sum_model.bmp 168 201 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 202 This 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 206 or:: 207 208 Plugin Model = scale_factor * model_1 /* model_2 + background 209 210 In the *Easy Sum/Multi Editor* give the new model a function name and brief 211 description (to appear under the *Details* button on the *FitPage*). Then select 175 212 two existing models, as p1 and p2, and the required operator, '+' or '*' between 176 213 them. Finally, click the *Apply* button to generate the model and then click *Close*. 177 214 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) 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. 216 217 .. _Advanced_Plugin_Editor: 218 219 Advanced Plugin Editor 220 ^^^^^^^^^^^^^^^^^^^^^^ 221 222 Selecting this option shows all the plugin models in the plugin model folder, on Windows this is 223 224 *C:\\Users\\{username}\\.sasview\\plugin_models* 189 225 190 226 You 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 229 For 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 233 When 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 237 To use the model, go to the relevant *Fit Page*, select the *Plugin Models* 204 238 category and then select the model from the drop-down menu. 205 239 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. 240 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. 241 242 Delete Plugin Models 243 ^^^^^^^^^^^^^^^^^^^^ 244 245 Simply 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 249 Load Plugin Models 250 ^^^^^^^^^^^^^^^^^^ 251 252 This option loads (or re-loads) all models present in the 253 *~\\.sasview\\plugin_models* folder. 232 254 233 255 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 392 414 :ref:`Assessing_Fit_Quality`. 393 415 394 *NB: If you need to use a custom ized 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 417 available first (see* :ref:`Adding_your_own_models` *).* 396 418 397 419 Method … … 476 498 If multiple data sets are in one file, load just that file. *Unselect All Data*, then 477 499 select 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 custom ized model, you must ensure that model is available*481 *first (see* :ref:`Adding_your_own_models` *).*500 above under :ref:`Single_Fit_Mode`. 501 502 *NB: If you need to use a custom Plugin Model, you must ensure that model is 503 available first (see* :ref:`Adding_your_own_models` *).* 482 504 483 505 Method … … 617 639 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 618 640 619 .. note:: This help document was last changed by Steve King, 04Jun2015641 .. note:: This help document was last changed by Steve King, 10Oct2016
Note: See TracChangeset
for help on using the changeset viewer.