[ec392464] | 1 | .. fitting_help.rst |
---|
| 2 | |
---|
| 3 | .. This is a port of the original SasView html help file to ReSTructured text |
---|
| 4 | .. by S King, ISIS, during SasView CodeCamp-III in Feb 2015. |
---|
| 5 | |
---|
[6aad2e8] | 6 | .. |inlineimage004| image:: sm_image004.png |
---|
| 7 | .. |inlineimage005| image:: sm_image005.png |
---|
| 8 | .. |inlineimage008| image:: sm_image008.png |
---|
| 9 | .. |inlineimage009| image:: sm_image009.png |
---|
| 10 | .. |inlineimage010| image:: sm_image010.png |
---|
| 11 | .. |inlineimage011| image:: sm_image011.png |
---|
| 12 | .. |inlineimage012| image:: sm_image012.png |
---|
| 13 | .. |inlineimage018| image:: sm_image018.png |
---|
| 14 | .. |inlineimage019| image:: sm_image019.png |
---|
[98b30b4] | 15 | |
---|
[ec392464] | 16 | |
---|
[b64b87c] | 17 | Fitting |
---|
| 18 | ======= |
---|
[ec392464] | 19 | |
---|
[3e1c9e5] | 20 | .. note:: If some code blocks are not readable, expand the documentation window |
---|
| 21 | |
---|
[a6f3613] | 22 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 23 | |
---|
| 24 | Preparing to fit data |
---|
| 25 | --------------------- |
---|
| 26 | |
---|
| 27 | To fit some data you must first load some data, activate one or more data sets, |
---|
[b64b87c] | 28 | send those data sets to fitting, and select a model to fit to each data set. |
---|
[a6f3613] | 29 | |
---|
[f3377b8] | 30 | Instructions on how to load and activate data are in the section :ref:`Loading_data`. |
---|
[ec392464] | 31 | |
---|
[a6f3613] | 32 | SasView can fit data in one of three ways: |
---|
[ec392464] | 33 | |
---|
[a6f3613] | 34 | * in *Single* fit mode - individual data sets are fitted independently one-by-one |
---|
[ec392464] | 35 | |
---|
[5295cf5] | 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) |
---|
[ec392464] | 39 | |
---|
[f3377b8] | 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!) |
---|
[a6f3613] | 41 | |
---|
| 42 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[ec392464] | 43 | |
---|
[a6f3613] | 44 | Selecting a model |
---|
| 45 | ----------------- |
---|
[ec392464] | 46 | |
---|
[5295cf5] | 47 | The models in SasView are grouped into categories. By default these consist of: |
---|
[ec392464] | 48 | |
---|
[5295cf5] | 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) |
---|
[f3377b8] | 56 | * *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc |
---|
[5295cf5] | 57 | * *Paracrystal* - semi ordered structures (bcc, fcc, etc) |
---|
[a6f3613] | 58 | * *Structure Factor* - S(Q) models |
---|
[5295cf5] | 59 | * *Plugin Models* - User-created (custom/non-library) Python models |
---|
[ec392464] | 60 | |
---|
[a6f3613] | 61 | Use the *Category* drop-down menu to chose a category of model, then select |
---|
[f3377b8] | 62 | a model from the drop-down menu beneath. A graph of the chosen model, calculated |
---|
| 63 | using default parameter values, will appear. The graph will update dynamically |
---|
| 64 | as the parameter values are changed. |
---|
| 65 | |
---|
| 66 | You can decide your own model categorizations using the :ref:`Category_Manager`. |
---|
[ce62e75] | 67 | |
---|
[a6f3613] | 68 | Once you have selected a model you can read its help documentation by clicking |
---|
| 69 | on the *Description* button to the right. |
---|
| 70 | |
---|
| 71 | Show 1D/2D |
---|
| 72 | ^^^^^^^^^^ |
---|
| 73 | |
---|
| 74 | Models are normally fitted to 1D (ie, I(Q) vs Q) data sets, but some models in |
---|
| 75 | SasView can also be fitted to 2D (ie, I(Qx,Qy) vs Qx vs Qy) data sets. |
---|
| 76 | |
---|
| 77 | *NB: Magnetic scattering can only be fitted in SasView in 2D.* |
---|
| 78 | |
---|
| 79 | To activate 2D fitting mode, click the *Show 2D* button on the *Fit Page*. To |
---|
| 80 | return to 1D fitting model, click the same button (which will now say *Show 1D*). |
---|
[ce62e75] | 81 | |
---|
[ec392464] | 82 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 83 | |
---|
[a6f3613] | 84 | .. _Category_Manager: |
---|
[a0637de] | 85 | |
---|
[a6f3613] | 86 | Category Manager |
---|
| 87 | ---------------- |
---|
| 88 | |
---|
[f3377b8] | 89 | To change the model categorizations, either choose *Category Manager* from the |
---|
| 90 | *View* option on the menubar, or click on the *Modify* button on the *Fit Page*. |
---|
[a6f3613] | 91 | |
---|
[6aad2e8] | 92 | .. image:: cat_fig0.png |
---|
[a6f3613] | 93 | |
---|
[5295cf5] | 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. |
---|
[a6f3613] | 97 | |
---|
[6aad2e8] | 98 | .. image:: cat_fig1.png |
---|
[a6f3613] | 99 | |
---|
[f3377b8] | 100 | Changing category |
---|
| 101 | ^^^^^^^^^^^^^^^^^ |
---|
[a6f3613] | 102 | |
---|
[5295cf5] | 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. |
---|
[a6f3613] | 106 | |
---|
[6aad2e8] | 107 | .. image:: cat_fig2.png |
---|
[a6f3613] | 108 | |
---|
[f3377b8] | 109 | To create a category for the selected model, click the *Add* button. In order |
---|
| 110 | to delete a category, select the category name and click the *Remove Selected* |
---|
| 111 | button. Then click *Done*. |
---|
[a6f3613] | 112 | |
---|
[f3377b8] | 113 | Showing/hiding models |
---|
| 114 | ^^^^^^^^^^^^^^^^^^^^^ |
---|
[a6f3613] | 115 | |
---|
[5295cf5] | 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*. |
---|
[a6f3613] | 119 | |
---|
[8570246] | 120 | *NB: It may be necessary to change to a different category and then back again* |
---|
[f3377b8] | 121 | *before any changes take effect.* |
---|
[a6f3613] | 122 | |
---|
| 123 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 124 | |
---|
[f3377b8] | 125 | Model Functions |
---|
| 126 | --------------- |
---|
[a6f3613] | 127 | |
---|
[5295cf5] | 128 | For a complete list of all the library models available in SasView, see |
---|
| 129 | the `Model Documentation <../../../index.html>`_ . |
---|
[a6f3613] | 130 | |
---|
[f3377b8] | 131 | It is also possible to add your own models. |
---|
[a6f3613] | 132 | |
---|
[f3377b8] | 133 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[a6f3613] | 134 | |
---|
[b5846a10] | 135 | .. _Adding_your_own_models: |
---|
| 136 | |
---|
[3e1c9e5] | 137 | Adding your own Models |
---|
[f3377b8] | 138 | ---------------------- |
---|
[a6f3613] | 139 | |
---|
[3e1c9e5] | 140 | There are essentially three ways to generate new fitting models for SasView: |
---|
| 141 | |
---|
[5295cf5] | 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!) |
---|
[3e1c9e5] | 149 | |
---|
| 150 | Please read the guidance on :ref:`Writing_a_Plugin` before proceeding. |
---|
[f3377b8] | 151 | |
---|
[3e1c9e5] | 152 | **To be found by SasView your model must reside in the *~\\.sasview\\plugin_models* folder.** |
---|
[f3377b8] | 153 | |
---|
[a6f3613] | 154 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 155 | |
---|
[3e1c9e5] | 156 | .. _Plugin_Model_Operations: |
---|
[f3377b8] | 157 | |
---|
[3e1c9e5] | 158 | Plugin Model Operations |
---|
| 159 | ----------------------- |
---|
[a6f3613] | 160 | |
---|
[3e1c9e5] | 161 | From the *Fitting* option in the menu bar, select *Plugin Model Operations* |
---|
[a6f3613] | 162 | |
---|
[82b0b05e] | 163 | .. image:: edit_model_menu.png |
---|
[a6f3613] | 164 | |
---|
[3e1c9e5] | 165 | and then one of the sub-options |
---|
[f3377b8] | 166 | |
---|
[3e1c9e5] | 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 |
---|
[a6f3613] | 172 | |
---|
[3e1c9e5] | 173 | .. _New_Plugin_Model: |
---|
| 174 | |
---|
| 175 | New Plugin Model |
---|
| 176 | ^^^^^^^^^^^^^^^^ |
---|
[a6f3613] | 177 | |
---|
[5295cf5] | 178 | Relatively straightforward models can be programmed directly from the SasView |
---|
| 179 | GUI using the *New Plugin Model Function*. |
---|
[26c8be3] | 180 | |
---|
[6aad2e8] | 181 | .. image:: new_model.png |
---|
[a6f3613] | 182 | |
---|
[26c8be3] | 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*\ . |
---|
[f3377b8] | 189 | |
---|
[5295cf5] | 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). |
---|
[26c8be3] | 193 | |
---|
| 194 | A model file generated by this option can be viewed and further modified using |
---|
| 195 | the :ref:`Advanced_Plugin_Editor` . |
---|
[05829fb] | 196 | |
---|
[f485ba0] | 197 | **SasView version 4.2** made it possible to specify whether a plugin created with |
---|
| 198 | the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor |
---|
| 199 | S(Q). To do this, simply add one or other of the following lines under the *import* |
---|
| 200 | statements. |
---|
| 201 | |
---|
| 202 | For a form factor:: |
---|
| 203 | |
---|
| 204 | form_factor = True |
---|
| 205 | |
---|
| 206 | or for a structure factor:: |
---|
| 207 | |
---|
| 208 | structure_factor = True |
---|
| 209 | |
---|
| 210 | If the plugin is a structure factor it is *also* necessary to add two variables to |
---|
| 211 | the parameter list:: |
---|
| 212 | |
---|
| 213 | parameters = [ |
---|
[ca383a0] | 214 | ['radius_effective', '', 1, [0.0, numpy.inf], 'volume', ''], |
---|
| 215 | ['volfraction', '', 1, [0.0, 1.0], '', ''], |
---|
[e081946] | 216 | [...], |
---|
[f485ba0] | 217 | |
---|
| 218 | and 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 | |
---|
| 224 | Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once |
---|
| 225 | a P(Q) model has been selected). |
---|
| 226 | |
---|
[a6f3613] | 227 | Sum|Multi(p1,p2) |
---|
| 228 | ^^^^^^^^^^^^^^^^ |
---|
| 229 | |
---|
[6aad2e8] | 230 | .. image:: sum_model.png |
---|
[a0637de] | 231 | |
---|
[5295cf5] | 232 | This option creates a custom Plugin Model of the form:: |
---|
[f3377b8] | 233 | |
---|
[5295cf5] | 234 | Plugin Model = scale_factor * {(scale_1 * model_1) +/- (scale_2 * model_2)} + background |
---|
[f3377b8] | 235 | |
---|
[3e1c9e5] | 236 | or:: |
---|
| 237 | |
---|
[f485ba0] | 238 | Plugin Model = scale_factor * (model1 * model2) + background |
---|
[3e1c9e5] | 239 | |
---|
| 240 | In the *Easy Sum/Multi Editor* give the new model a function name and brief |
---|
| 241 | description (to appear under the *Details* button on the *FitPage*). Then select |
---|
[f3377b8] | 242 | two existing models, as p1 and p2, and the required operator, '+' or '*' between |
---|
[f485ba0] | 243 | them. Finally, click the *Apply* button to generate and test the model and then click *Close*. |
---|
[f3377b8] | 244 | |
---|
[e081946] | 245 | Any changes to a plugin model generated in this way only become effective *after* it is re-selected |
---|
| 246 | from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a |
---|
[f485ba0] | 247 | recompilation 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 |
---|
| 250 | generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model |
---|
| 251 | with 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') |
---|
[e081946] | 257 | model_info.name = 'MyPluginModel' |
---|
[f485ba0] | 258 | model_info.description = 'sphere + power_law' |
---|
| 259 | Model = make_model_from_info(model_info) |
---|
| 260 | |
---|
| 261 | To change the models or operators contributing to this plugin it is only necessary to edit the string |
---|
| 262 | in the brackets after *load_model_info*, though it would also be a good idea to update the model name |
---|
| 263 | and description too!!! |
---|
| 264 | |
---|
[ca383a0] | 265 | The model specification string can handle multiple models and combinations of operators (+ or *) which |
---|
[f485ba0] | 266 | are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would |
---|
| 267 | multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be |
---|
[e081946] | 268 | prefixed A (for model2), B (for model3) and C (for model1). Whilst this might appear a little |
---|
| 269 | confusing, unless you were creating a plugin model from multiple instances of the same model the parameter |
---|
| 270 | assignments ought to be obvious when you load the plugin. |
---|
[f485ba0] | 271 | |
---|
[e081946] | 272 | If you need to include another plugin model in the model specification string, just prefix the name of |
---|
| 273 | that model with *custom*. For instance:: |
---|
| 274 | |
---|
| 275 | sphere+custom.MyPluginModel |
---|
| 276 | |
---|
| 277 | To create a P(Q)*\S(Q) model use the @ symbol instead of * like this:: |
---|
| 278 | |
---|
| 279 | sphere@hardsphere |
---|
| 280 | |
---|
[f485ba0] | 281 | This streamlined approach to building complex plugin models from existing library models, or models |
---|
[203669a] | 282 | available on the *Model Marketplace*, also permits the creation of P(Q)*\S(Q) plugin models, something |
---|
[f485ba0] | 283 | that was not possible in earlier versions of SasView. |
---|
[f3377b8] | 284 | |
---|
[3e1c9e5] | 285 | .. _Advanced_Plugin_Editor: |
---|
[f3377b8] | 286 | |
---|
[3e1c9e5] | 287 | Advanced Plugin Editor |
---|
| 288 | ^^^^^^^^^^^^^^^^^^^^^^ |
---|
[ec392464] | 289 | |
---|
[3e1c9e5] | 290 | Selecting this option shows all the plugin models in the plugin model folder, on Windows this is |
---|
[f3377b8] | 291 | |
---|
[afb93df] | 292 | *C:\\Users\\{username}\\.sasview\\plugin_models* |
---|
[f3377b8] | 293 | |
---|
| 294 | You can edit, modify, and save the Python code in any of these models using the |
---|
[3e1c9e5] | 295 | *Advanced Plugin Model Editor*. Note that this is actually the same tool as the :ref:`Python_shell` . |
---|
[f3377b8] | 296 | |
---|
[afb93df] | 297 | For details of the SasView plugin model format see :ref:`Writing_a_Plugin` . |
---|
[05829fb] | 298 | |
---|
[afb93df] | 299 | .. 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! |
---|
[f3377b8] | 300 | |
---|
[3e1c9e5] | 301 | 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'. |
---|
[f3377b8] | 302 | |
---|
[3e1c9e5] | 303 | .. image:: ../calculator/new_pycrust_example_2.png |
---|
| 304 | |
---|
| 305 | To use the model, go to the relevant *Fit Page*, select the *Plugin Models* |
---|
[f3377b8] | 306 | category and then select the model from the drop-down menu. |
---|
| 307 | |
---|
[3e1c9e5] | 308 | 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. |
---|
[a6f3613] | 309 | |
---|
[3e1c9e5] | 310 | Delete Plugin Models |
---|
| 311 | ^^^^^^^^^^^^^^^^^^^^ |
---|
[a6f3613] | 312 | |
---|
[3e1c9e5] | 313 | Simply highlight the plugin model to be removed. The operation is final!!! |
---|
[f3377b8] | 314 | |
---|
[5295cf5] | 315 | *NB: Models shipped with SasView cannot be removed in this way.* |
---|
[ec392464] | 316 | |
---|
[3e1c9e5] | 317 | Load Plugin Models |
---|
| 318 | ^^^^^^^^^^^^^^^^^^ |
---|
[afb93df] | 319 | |
---|
[5295cf5] | 320 | This option loads (or re-loads) all models present in the |
---|
| 321 | *~\\.sasview\\plugin_models* folder. |
---|
[afb93df] | 322 | |
---|
[ec392464] | 323 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 324 | |
---|
[4666660] | 325 | .. _Fitting_Options: |
---|
| 326 | |
---|
[f3377b8] | 327 | Fitting Options |
---|
| 328 | --------------- |
---|
[a6f3613] | 329 | |
---|
[f3377b8] | 330 | It is possible to specify which optimiser SasView should use to fit the data, and |
---|
| 331 | to modify some of the configurational parameters for each optimiser. |
---|
| 332 | |
---|
| 333 | From *Fitting* in the menu bar select *Fit Options*, then select one of the following |
---|
| 334 | optimisers: |
---|
[a6f3613] | 335 | |
---|
[f3377b8] | 336 | * DREAM |
---|
| 337 | * Levenberg-Marquardt |
---|
| 338 | * Quasi-Newton BFGS |
---|
| 339 | * Differential Evolution |
---|
| 340 | * Nelder-Mead Simplex |
---|
[a6f3613] | 341 | |
---|
[6af2785] | 342 | The DREAM optimiser is the most sophisticated, but may not necessarily be the best |
---|
| 343 | option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser |
---|
| 344 | initially. |
---|
| 345 | |
---|
[f3377b8] | 346 | These optimisers form the *Bumps* package written by P Kienzle. For more information |
---|
[4666660] | 347 | on each optimiser, see the :ref:`Fitting_Documentation`. |
---|
[a6f3613] | 348 | |
---|
[f3377b8] | 349 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[a6f3613] | 350 | |
---|
[5ac0a7a] | 351 | Fitting Limits |
---|
| 352 | -------------- |
---|
| 353 | |
---|
| 354 | By default, *SasView* will attempt to model fit the full range of the data; ie, |
---|
| 355 | across all *Q* values. If necessary, however, it is possible to specify only a |
---|
| 356 | sub-region of the data for fitting. |
---|
| 357 | |
---|
| 358 | In a *FitPage* or *BatchPage* change the *Q* values in the *Min* and/or *Max* |
---|
| 359 | text boxes. Vertical coloured bars will appear on the graph with the data and |
---|
| 360 | 'theory' indicating the current *Q* limits (red = *Qmin*, purple = *Qmax*). |
---|
| 361 | |
---|
| 362 | To return to including all data in the fit, click the *Reset* button. |
---|
| 363 | |
---|
| 364 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 365 | |
---|
| 366 | |
---|
[f3377b8] | 367 | Shortcuts |
---|
| 368 | --------- |
---|
[a6f3613] | 369 | |
---|
[f3377b8] | 370 | Copy/Paste Parameters |
---|
| 371 | ^^^^^^^^^^^^^^^^^^^^^ |
---|
[a6f3613] | 372 | |
---|
[f3377b8] | 373 | It is possible to copy the parameters from one *Fit Page* and to paste them into |
---|
| 374 | another *Fit Page* using the same model. |
---|
[a6f3613] | 375 | |
---|
[f3377b8] | 376 | To *copy* parameters, either: |
---|
[a6f3613] | 377 | |
---|
[f3377b8] | 378 | * Select *Edit -> Copy Params* from the menu bar, or |
---|
| 379 | * Use Ctrl(Cmd on Mac) + Left Mouse Click on the *Fit Page*. |
---|
[a6f3613] | 380 | |
---|
[f3377b8] | 381 | To *paste* parameters, either: |
---|
| 382 | |
---|
| 383 | * Select *Edit -> Paste Params* from the menu bar, or |
---|
| 384 | * Use Ctrl(Cmd on Mac) + Shift + Left-click on the *Fit Page*. |
---|
| 385 | |
---|
| 386 | If either operation is successful a message will appear in the info line at the |
---|
| 387 | bottom of the SasView window. |
---|
| 388 | |
---|
| 389 | Bookmark |
---|
| 390 | ^^^^^^^^ |
---|
[a6f3613] | 391 | |
---|
[1fda506] | 392 | To *Bookmark* a *Fit Page* either: |
---|
[a6f3613] | 393 | |
---|
[f3377b8] | 394 | * Select a *Fit Page* and then click on *Bookmark* in the tool bar, or |
---|
| 395 | * Right-click and select the *Bookmark* in the popup menu. |
---|
[a6f3613] | 396 | |
---|
| 397 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 398 | |
---|
[4666660] | 399 | .. _Status_bar: |
---|
| 400 | |
---|
[1fda506] | 401 | Status Bar & Console |
---|
| 402 | -------------------- |
---|
| 403 | |
---|
| 404 | The status bar is located at the bottom of the SasView window and displays |
---|
| 405 | messages, hints, warnings and errors. |
---|
| 406 | |
---|
| 407 | At the right-hand side of the status bar is a button marked *Console*. The *Console* |
---|
| 408 | displays available message history and some run-time traceback information. |
---|
| 409 | |
---|
| 410 | During a long task the *Console* can also be used to monitor the progress. |
---|
| 411 | |
---|
| 412 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 413 | |
---|
[6af2785] | 414 | .. _Single_Fit_Mode: |
---|
| 415 | |
---|
[a6f3613] | 416 | Single Fit Mode |
---|
| 417 | --------------- |
---|
[ec392464] | 418 | |
---|
[4666660] | 419 | *NB: Before proceeding, ensure that the Single Mode radio button at the bottom of* |
---|
| 420 | *the Data Explorer is checked (see the section* :ref:`Loading_data` *).* |
---|
| 421 | |
---|
[63d314b] | 422 | This mode fits one data set. |
---|
| 423 | |
---|
[b64b87c] | 424 | When data is sent to the fitting it is plotted in a graph window as markers. |
---|
[4666660] | 425 | |
---|
| 426 | If a graph does not appear, or a graph window appears but is empty, then the data |
---|
| 427 | has not loaded correctly. Check to see if there is a message in the :ref:`Status_Bar` |
---|
| 428 | or in the *Console* window. |
---|
| 429 | |
---|
| 430 | Assuming the data has loaded correctly, when a model is selected a green model |
---|
| 431 | calculation (or what SasView calls a 'Theory') line will appear in the earlier graph |
---|
| 432 | window, and a second graph window will appear displaying the residuals (the |
---|
| 433 | difference between the experimental data and the theory) at the same X-data values. |
---|
[f9250dc] | 434 | See :ref:`Assessing_Fit_Quality`. |
---|
[4666660] | 435 | |
---|
| 436 | The objective of model-fitting is to find a *physically-plausible* model, and set |
---|
| 437 | of model parameters, that generate a theory that reproduces the experimental data |
---|
| 438 | and gives residual values as close to zero as possible. |
---|
| 439 | |
---|
| 440 | Change the default values of the model parameters by hand until the theory line |
---|
| 441 | starts to represent the experimental data. Then uncheck the tick boxes alongside |
---|
| 442 | all parameters *except* the 'background' and the 'scale'. Click the *Fit* button. |
---|
| 443 | SasView will optimise the values of the 'background' and 'scale' and also display |
---|
| 444 | the corresponding uncertainties on the optimised values. |
---|
| 445 | |
---|
| 446 | *NB: If no uncertainty is shown it generally means that the model is not very* |
---|
| 447 | *dependent on the corresponding parameter (or that one or more parameters are* |
---|
| 448 | *'correlated').* |
---|
| 449 | |
---|
| 450 | In the bottom left corner of the *Fit Page* is a box displaying the normalised value |
---|
[5ed76f8] | 451 | of the statistical $\chi^2$ parameter returned by the optimiser. |
---|
[4666660] | 452 | |
---|
| 453 | Now check the box for another model parameter and click *Fit* again. Repeat this |
---|
| 454 | process until most or all parameters are checked and have been optimised. As the |
---|
| 455 | fit of the theory to the experimental data improves the value of 'chi2/Npts' will |
---|
| 456 | decrease. A good model fit should easily produce values of 'chi2/Npts' that are |
---|
[5ed76f8] | 457 | close to one, and certainly <100. See :ref:`Assessing_Fit_Quality`. |
---|
[4666660] | 458 | |
---|
| 459 | SasView has a number of different optimisers (see the section :ref:`Fitting_Options`). |
---|
| 460 | The DREAM optimiser is the most sophisticated, but may not necessarily be the best |
---|
| 461 | option for fitting simple models. If uncertain, try the Levenberg-Marquardt optimiser |
---|
| 462 | initially. |
---|
[ec392464] | 463 | |
---|
| 464 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 465 | |
---|
[a6f3613] | 466 | Simultaneous Fit Mode |
---|
| 467 | --------------------- |
---|
[ec392464] | 468 | |
---|
[63d314b] | 469 | *NB: Before proceeding, ensure that the Single Mode radio button at the bottom of* |
---|
| 470 | *the Data Explorer is checked (see the section* :ref:`Loading_data` *).* |
---|
[ec392464] | 471 | |
---|
[6af2785] | 472 | This mode is an extension of the :ref:`Single_Fit_Mode` that fits two or more data |
---|
[63d314b] | 473 | sets *to the same model* simultaneously. If necessary it is possible to constrain |
---|
| 474 | fit parameters between data sets (eg, to fix a background level, or radius, etc). |
---|
| 475 | |
---|
[b5846a10] | 476 | If the data to be fit are in multiple files, load each file, then select each file |
---|
| 477 | in the *Data Explorer*, and *Send To Fitting*. If multiple data sets are in one file, |
---|
| 478 | load that file, *Unselect All Data*, select just those data sets to be fitted, and |
---|
| 479 | *Send To Fitting*. Either way, the result should be that for *n* data sets you have |
---|
[6af2785] | 480 | 2\ *n* graphs (*n* of the data and model fit, and *n* of the resulting residuals). But |
---|
[f9250dc] | 481 | it may be helpful to minimise the residuals plots for clarity. Also see |
---|
| 482 | :ref:`Assessing_Fit_Quality`. |
---|
[b5846a10] | 483 | |
---|
[5295cf5] | 484 | *NB: If you need to use a custom Plugin Model, you must ensure that model is |
---|
| 485 | available first (see* :ref:`Adding_your_own_models` *).* |
---|
[b5846a10] | 486 | |
---|
[6af2785] | 487 | Method |
---|
| 488 | ^^^^^^ |
---|
| 489 | |
---|
[b5846a10] | 490 | Now go to each *FitPage* in turn and: |
---|
| 491 | |
---|
| 492 | Select the required category and model; |
---|
| 493 | |
---|
| 494 | Unselect all the model parameters; |
---|
| 495 | |
---|
| 496 | Enter some starting guesses for the parameters; |
---|
| 497 | |
---|
| 498 | Enter any parameter limits (recommended); |
---|
[63d314b] | 499 | |
---|
[b5846a10] | 500 | Select which parameters will refine (selecting all is generally a bad idea...); |
---|
[63d314b] | 501 | |
---|
[b5846a10] | 502 | When done, select *Constrained or Simultaneous Fit* under *Fitting* in the menu bar. |
---|
| 503 | |
---|
| 504 | In the *Const & Simul Fit* page that appears, select which data sets are to be |
---|
| 505 | simultaneously fitted (this will probably be all of them or you would not have loaded |
---|
| 506 | them in the first place!). |
---|
| 507 | |
---|
| 508 | To tie parameters between the data sets with constraints, check the 'yes' radio button |
---|
| 509 | next to *Add Constraint?* in the *Fit Constraints* box. |
---|
| 510 | |
---|
| 511 | *NB: You can only constrain parameters that are set to refine.* |
---|
| 512 | |
---|
| 513 | When ready, click the *Fit* button on the *Const & Simul Fit* page, NOT the *Fit* |
---|
| 514 | button on the individual *FitPage*'s. |
---|
[63d314b] | 515 | |
---|
| 516 | Simultaneous Fits without Constraints |
---|
| 517 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
[ec392464] | 518 | |
---|
[b5846a10] | 519 | The results of the model-fitting will be returned to each of the individual |
---|
| 520 | *FitPage*'s. |
---|
[ec392464] | 521 | |
---|
[b5846a10] | 522 | Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To |
---|
[6af2785] | 523 | see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the |
---|
[f9250dc] | 524 | bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`. |
---|
[ec392464] | 525 | |
---|
[63d314b] | 526 | Simultaneous Fits with Constraints |
---|
| 527 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
---|
[ec392464] | 528 | |
---|
[b5846a10] | 529 | Use the *Easy Setup* drop-down buttons in the *Const & Simul Fit* page to set |
---|
| 530 | up constraints between *FitPage*'s. |
---|
| 531 | |
---|
[6af2785] | 532 | Constraints will generally be of the form |
---|
| 533 | |
---|
| 534 | Mi Parameter1 = Mj.Parameter1 |
---|
| 535 | |
---|
| 536 | however the text box after the '=' sign can be used to adjust this |
---|
| 537 | relationship; for example |
---|
| 538 | |
---|
| 539 | Mi Parameter1 = scalar \* Mj.Parameter1 |
---|
| 540 | |
---|
| 541 | A 'free-form' constraint box is also provided. |
---|
[b5846a10] | 542 | |
---|
| 543 | Many constraints can be entered for a single fit. |
---|
| 544 | |
---|
| 545 | The results of the model-fitting will be returned to each of the individual |
---|
| 546 | *FitPage*'s. |
---|
[ec392464] | 547 | |
---|
[b5846a10] | 548 | Note that the chi2/Npts value returned is the SUM of the chi2/Npts of each fit. To |
---|
[6af2785] | 549 | see the chi2/Npts value for a specific *FitPage*, click the *Compute* button at the |
---|
[f9250dc] | 550 | bottom of that *FitPage* to recalculate. Also see :ref:`Assessing_Fit_Quality`. |
---|
[ec392464] | 551 | |
---|
| 552 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 553 | |
---|
[e6c74e8] | 554 | .. _Batch_Fit_Mode: |
---|
| 555 | |
---|
[a6f3613] | 556 | Batch Fit Mode |
---|
| 557 | -------------- |
---|
[ec392464] | 558 | |
---|
[6af2785] | 559 | *NB: Before proceeding, ensure that the Single Mode radio button at the bottom of* |
---|
| 560 | *the Data Explorer is checked (see the section* :ref:`Loading_data` *). The Batch* |
---|
| 561 | *Mode button will be used later on!* |
---|
[63d314b] | 562 | |
---|
[6af2785] | 563 | This mode *sequentially* fits two or more data sets *to the same model*. Unlike in |
---|
| 564 | simultaneous fitting, in batch fitting it is not possible to constrain fit parameters |
---|
| 565 | between data sets. |
---|
[ec392464] | 566 | |
---|
[6af2785] | 567 | If the data to be fit are in multiple files, load each file in the *Data Explorer*. |
---|
| 568 | If multiple data sets are in one file, load just that file. *Unselect All Data*, then |
---|
| 569 | select a single initial data set to be fitted. Fit that selected data set as described |
---|
[5295cf5] | 570 | above under :ref:`Single_Fit_Mode`. |
---|
[ec392464] | 571 | |
---|
[5295cf5] | 572 | *NB: If you need to use a custom Plugin Model, you must ensure that model is |
---|
| 573 | available first (see* :ref:`Adding_your_own_models` *).* |
---|
[ec392464] | 574 | |
---|
[6af2785] | 575 | Method |
---|
| 576 | ^^^^^^ |
---|
[ec392464] | 577 | |
---|
[6af2785] | 578 | Now *Select All Data* in the *Data Explorer*, check the *Batch Mode* radio button |
---|
| 579 | at the bottom of that panel and *Send To Fitting*. A *BatchPage* will be created. |
---|
[ec392464] | 580 | |
---|
[6aad2e8] | 581 | .. image:: batch_button_area.png |
---|
[ec392464] | 582 | |
---|
[6af2785] | 583 | *NB: The Batch Page can also be created by checking the Batch Mode radio button* |
---|
| 584 | *and selecting New Fit Page under Fitting in the menu bar.* |
---|
[ec392464] | 585 | |
---|
[6af2785] | 586 | Using the drop-down menus in the *BatchPage*, now set up the *same* data set |
---|
| 587 | with the *same* model that you just fitted in single fit mode. A quick way to |
---|
| 588 | set the model parameter values is to just copy them from the earlier Single |
---|
| 589 | Fit. To do this, go back to the Single Fit *FitPage*, select *Copy Params* |
---|
| 590 | under *Edit* in the menu bar, then go back to the *BatchPage* and *Paste Params*. |
---|
[ec392464] | 591 | |
---|
[6af2785] | 592 | When ready, use the *Fit* button on the *BatchPage* to perform the fitting, NOT |
---|
| 593 | the *Fit* button on the individual *FitPage*'s. |
---|
[ec392464] | 594 | |
---|
[6af2785] | 595 | Unlike in single fit mode, the results of batch fits are not returned to |
---|
| 596 | the *BatchPage*. Instead, a spreadsheet-like :ref:`Grid_Window` will appear. |
---|
[ec392464] | 597 | |
---|
[6af2785] | 598 | If you want to visually check a graph of a particular fit, click on the name of |
---|
| 599 | a *Data set* in the *Grid Window* and then click the *View Fits* button. The |
---|
| 600 | data and the model fit will be displayed. If you select mutliple data sets they |
---|
| 601 | will all appear on one graph. |
---|
[ec392464] | 602 | |
---|
[6aad2e8] | 603 | .. image:: view_button.png |
---|
[ec392464] | 604 | |
---|
[6af2785] | 605 | *NB: In theory, returning to the BatchPage and changing the name of the I(Q)* |
---|
| 606 | *data source should also work, but at the moment whilst this does change the* |
---|
| 607 | *data set displayed it always superimposes the 'theory' corresponding to the* |
---|
| 608 | *starting parameters.* |
---|
[ec392464] | 609 | |
---|
[6af2785] | 610 | If you select a 'Chi2' value and click the *View Fits* button a graph of the |
---|
| 611 | residuals for that data set is displayed. Again, if you select multiple 'Chi2' |
---|
[f9250dc] | 612 | values then all the residuals data will appear on one graph. Also see |
---|
| 613 | :ref:`Assessing_Fit_Quality`. |
---|
[ec392464] | 614 | |
---|
[6af2785] | 615 | Chain Fitting |
---|
| 616 | ^^^^^^^^^^^^^ |
---|
[ec392464] | 617 | |
---|
[6af2785] | 618 | By default, the *same* parameter values copied from the initial single fit into |
---|
| 619 | the *BatchPage* will be used as the starting parameters for all batch fits. It |
---|
| 620 | is, however, possible to get *SasView* to use the results of a fit to a preceding |
---|
| 621 | data set as the starting parameters for the next fit in the sequence. This |
---|
| 622 | variation of batch fitting is called *Chain Fitting*, and will considerably speed |
---|
| 623 | up model-fitting if you have lots of very similar data sets where a few parameters |
---|
| 624 | are gradually changing. Do not use chain fitting on disparate data sets. |
---|
[ec392464] | 625 | |
---|
[6af2785] | 626 | To use chain fitting, select *Chain Fitting* under *Fitting* in the menu bar. It |
---|
| 627 | toggles on/off, so selecting it again will switch back to normal batch fitting. |
---|
[ec392464] | 628 | |
---|
[6af2785] | 629 | .. _Grid_Window: |
---|
[ec392464] | 630 | |
---|
[6af2785] | 631 | Grid Window |
---|
| 632 | ^^^^^^^^^^^ |
---|
[ec392464] | 633 | |
---|
[6af2785] | 634 | The *Grid Window* provides an easy way to view the results from batch fitting. |
---|
| 635 | It will be displayed automatically when a batch fit completes, but may be |
---|
| 636 | opened at any time by selecting *Show Grid Window* under *View* in the menu |
---|
| 637 | bar. |
---|
[ec392464] | 638 | |
---|
[6aad2e8] | 639 | .. image:: restore_batch_window.png |
---|
[ec392464] | 640 | |
---|
[6af2785] | 641 | Once a batch fit is completed, all model parameters are displayed but *not* |
---|
| 642 | their uncertainties. To view the uncertainties, click on a given column then |
---|
| 643 | go to *Edit* in the menu bar, select *Insert Column Before* and choose the |
---|
| 644 | required data from the list. An empty column can be inserted in the same way. |
---|
[ec392464] | 645 | |
---|
[6af2785] | 646 | To remove a column from the grid, click on the column header and choose |
---|
| 647 | *Remove Column* under *Edit* in the menu bar. The same functionality also |
---|
| 648 | allows you to re-order columns. |
---|
[ec392464] | 649 | |
---|
[6af2785] | 650 | *NB: You cannot insert/remove/re-order the rows in the Grid Window.* |
---|
[ec392464] | 651 | |
---|
[6af2785] | 652 | All of the above functions are also available by right-clicking on a column |
---|
| 653 | label. |
---|
[ec392464] | 654 | |
---|
[6aad2e8] | 655 | .. image:: edit_menu.png |
---|
[ec392464] | 656 | |
---|
[6af2785] | 657 | *NB: If there is an existing Grid Window and another batch fit is performed,* |
---|
| 658 | *an additional 'Table' tab will be added to the Grid Window.* |
---|
[ec392464] | 659 | |
---|
[6af2785] | 660 | The parameter values in the *currently selected* table of the *Grid Window* |
---|
| 661 | can be output to a CSV file by choosing *Save As* under *File* in the (*Grid* |
---|
| 662 | *Window*) menu bar. The default filename includes the date and time that the |
---|
| 663 | batch fit was performed. |
---|
[ec392464] | 664 | |
---|
[6af2785] | 665 | Saved CSV files can be reloaded by choosing *Open* under *File* in the *Grid* |
---|
| 666 | *Window* menu bar. The loaded parameters will appear in a new table tab. |
---|
[ec392464] | 667 | |
---|
[6aad2e8] | 668 | .. image:: file_menu.png |
---|
[ec392464] | 669 | |
---|
[6af2785] | 670 | *NB: Saving the Grid Window does not save any experimental data, residuals* |
---|
| 671 | *or actual model fits. Consequently if you reload a saved CSV file the* |
---|
| 672 | *ability to View Fits will be lost.* |
---|
[ec392464] | 673 | |
---|
[6af2785] | 674 | Parameter Plots |
---|
| 675 | ^^^^^^^^^^^^^^^ |
---|
[ec392464] | 676 | |
---|
[6af2785] | 677 | Any column of *numeric* parameter values can be plotted against another using |
---|
| 678 | the *Grid Window*. Simply select one column at the time and click the *Add* |
---|
| 679 | button next to the required *X/Y-axis Selection Range* text box. When both |
---|
| 680 | the X and Y axis boxes have been completed, click the *Plot* button. |
---|
[ec392464] | 681 | |
---|
[6af2785] | 682 | When the *Add* button is clicked, *SasView* also automatically completes the |
---|
| 683 | *X/Y-axis Label* text box with the heading from Row 1 of the selected table, |
---|
| 684 | but different labels and units can be entered manually. |
---|
[ec392464] | 685 | |
---|
[6aad2e8] | 686 | .. image:: plot_button.png |
---|
[ec392464] | 687 | |
---|
[6af2785] | 688 | The *X/Y-axis Selection Range* can be edited manually. The text control box |
---|
| 689 | recognises the operators +, -, \*, /, or 'pow', and allows the following |
---|
| 690 | types of expression : |
---|
| 691 | |
---|
| 692 | 1) if an axis label range is a function of 1 or more *columns*, write |
---|
| 693 | this type of expression |
---|
[ec392464] | 694 | |
---|
[6af2785] | 695 | constant1 * column_name1 [minimum row index : maximum row index] |
---|
| 696 | operator constant2 * column_name2 [minimum row index : maximum row index] |
---|
[ec392464] | 697 | |
---|
[6af2785] | 698 | Example: radius [2 : 5] -3 * scale [2 : 5] |
---|
[ec392464] | 699 | |
---|
[6af2785] | 700 | 2) if only some *values* of a given column are needed but the range between |
---|
| 701 | the first row and the last row used is not continuous, write this type of |
---|
| 702 | expression |
---|
[ec392464] | 703 | |
---|
[6af2785] | 704 | column_name1 [minimum row index1 : maximum row index1] , column_name1 |
---|
| 705 | [minimum row index2 : maximum row index2] |
---|
[ec392464] | 706 | |
---|
[6af2785] | 707 | Example: radius [2 : 5] , radius [10 : 25] |
---|
[9d93c37] | 708 | |
---|
| 709 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
| 710 | |
---|
| 711 | Combined Batch Fit Mode |
---|
| 712 | ----------------------- |
---|
| 713 | |
---|
[e6c74e8] | 714 | The purpose of the Combined Batch Fit is to allow running two or more batch |
---|
| 715 | fits in sequence without overwriting the output table of results. This may be |
---|
| 716 | of interest for example if one is fitting a series of data sets where there is |
---|
| 717 | a shape change occurring in the series that requires changing the model part |
---|
| 718 | way through the series; for example a sphere to rod transition. Indeed the |
---|
| 719 | regular batch mode does not allow for multiple models and requires all the |
---|
| 720 | files in the series to be fit with single model and set of parameters. While |
---|
| 721 | it is of course possible to just run part of the series as a batch fit using |
---|
| 722 | model one followed by running another batch fit on the rest of the series with |
---|
| 723 | model two (and/or model three etc), doing so will overwrite the table of |
---|
| 724 | outputs from the previous batch fit(s). This may not be desirable if one is |
---|
| 725 | interested in comparing the parameters: for example the sphere radius of set |
---|
[05b0bf6] | 726 | one and the cylinder radius of set two. |
---|
[e6c74e8] | 727 | |
---|
| 728 | Method |
---|
| 729 | ^^^^^^ |
---|
[9d93c37] | 730 | |
---|
[e6c74e8] | 731 | In order to use the *Combined Batch Fit*, first load all the data needed as |
---|
| 732 | described in :ref:`Loading_data`. Next start up two or more *BatchPage* fits |
---|
| 733 | following the instructions in :ref:`Batch_Fit_Mode` but **DO NOT PRESS FIT**. |
---|
| 734 | At this point the *Combine Batch Fit* menu item under the *Fitting menu* should |
---|
| 735 | be active (if there is one or no *BatchPage* the menu item will be greyed out |
---|
| 736 | and inactive). Clicking on *Combine Batch Fit* will bring up a new panel, |
---|
| 737 | similar to the *Const & Simult Fit* panel. In this case there will be a |
---|
| 738 | checkbox for each *BatchPage* instead of each *FitPage* that should be included |
---|
| 739 | in the fit. Once all are selected, click the Fit button on |
---|
| 740 | the *BatchPage* to run each batch fit in *sequence* |
---|
[9d93c37] | 741 | |
---|
| 742 | .. image:: combine_batch_page.png |
---|
| 743 | |
---|
[e6c74e8] | 744 | The batch table will then pop up at the end as for the case of the simple Batch |
---|
| 745 | Fitting with the following caveats: |
---|
[9d93c37] | 746 | |
---|
| 747 | .. note:: |
---|
| 748 | The order matters. The parameters in the table will be taken from the model |
---|
[e6c74e8] | 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. |
---|
[9d93c37] | 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 | |
---|
[e6c74e8] | 761 | In the example shown above the data is a time series with a shifting peak. |
---|
| 762 | The first part of the series was fitted using the *broad_peak* model, while |
---|
| 763 | the rest of the data were fit using the *gaussian_peak* model. Unfortunately the |
---|
| 764 | time is not listed in the file but the file name contains the information. As |
---|
| 765 | described in :ref:`Grid_Window`, a column can be added manually, in this case |
---|
| 766 | called time, and the peak position plotted against time. |
---|
[9d93c37] | 767 | |
---|
| 768 | .. image:: combine_batch_plot.png |
---|
| 769 | |
---|
[05b0bf6] | 770 | Note the discontinuity in the peak position. This reflects the fact that the |
---|
| 771 | Gaussian fit is a rather poor model for the data and is not actually |
---|
[e6c74e8] | 772 | finding the peak. |
---|
[ec392464] | 773 | |
---|
| 774 | .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ |
---|
[6af2785] | 775 | |
---|
[e6c74e8] | 776 | .. note:: This help document was last changed by Paul Butler, 10 September |
---|
| 777 | 2017 |
---|