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