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