Changeset 3e1c9e5 in sasview for src/sas/sasgui/perspectives
- Timestamp:
- Oct 10, 2016 5:52:25 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d472e86, 49e000b
- Parents:
- f2261c2
- Location:
- src/sas/sasgui/perspectives/fitting/media
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
rafb93df r3e1c9e5 18 18 ======= 19 19 20 .. note:: If some code blocks are not readable, expand the documentation window 21 20 22 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 21 23 … … 116 118 --------------- 117 119 118 For a complete list of all the library models available in SasView, see the Model Documentation.120 For a complete list of all the library models available in SasView, see the `Model Documentation <../../../index.html>`_ . 119 121 120 122 It is also possible to add your own models. … … 124 126 .. _Adding_your_own_models: 125 127 126 Adding your own models128 Adding your own Models 127 129 ---------------------- 128 130 129 There are currently two ways to add your own models to SasView: 130 131 * Using the :ref:`Custom_Model_Editor` 132 * By :ref:`Writing_a_Plugin` 133 134 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 135 136 .. _Custom_Model_Editor: 137 138 Custom Model Editor 139 ------------------- 140 141 From the *Fitting* option in the menu bar, select *Edit Custom Model*. 131 There are essentially three ways to generate new fitting models for SasView: 132 133 * Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners and/or relatively simple models) 134 * By copying/editing an existing model (this can include models generated by the *New Plugin Model* dialog) in the :ref:`Python_shell` or :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 135 * By writing a model from scratch outside of SasView (only recommended for code monkeys!) 136 137 Please read the guidance on :ref:`Writing_a_Plugin` before proceeding. 138 139 **To be found by SasView your model must reside in the *~\\.sasview\\plugin_models* folder.** 140 141 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 142 143 .. _Plugin_Model_Operations: 144 145 Plugin Model Operations 146 ----------------------- 147 148 From the *Fitting* option in the menu bar, select *Plugin Model Operations* 142 149 143 150 .. image:: edit_model_menu.png 144 151 145 and then one of the options 146 147 * *New* - to create a custom model template with a help dialog 148 * *Sum|Multi(p1,p2)* - to create a custom model by summing/multiplying *existing models* in the model library 149 * *Advanced* - to create/edit a custom model in a Python shell 150 * *Delete* - to delete a custom model 151 * *Load* - to (re-)load custom models 152 153 New 154 ^^^^ 152 and then one of the sub-options 153 154 * *New Plugin Model* - to create a plugin model template with a helper dialog 155 * *Sum|Multi(p1,p2)* - to create a plugin model by summing/multiplying *existing models* in the model library 156 * *Advanced Plugin Editor* - to create/edit a plugin model in a Python shell 157 * *Delete Plugin Models* - to delete a plugin model 158 * *Load Plugin Models* - to (re-)load plugin models 159 160 .. _New_Plugin_Model: 161 162 New Plugin Model 163 ^^^^^^^^^^^^^^^^ 155 164 156 165 .. image:: new_model.bmp 157 166 158 167 A model template generated by this option can be viewed and further modified using 159 the :ref:`Advanced ` option.168 the :ref:`Advanced_Plugin_Editor` . 160 169 161 170 *NB: "Fit Parameters" has been split into two sections, those which can be … … 168 177 .. image:: sum_model.bmp 169 178 170 This option creates a custom model of the form 171 172 Custom Model = scale_factor \* (model1 +/\* model2) 173 174 In the *Easy Sum/Multi Editor* give the new custom model a function name and brief 175 description (to appear under the *Details* button on the *Fit Page*). Then select 179 This option creates a custom model of the form:: 180 181 Custom Model = scale_factor \* {(scale_1 \* model_1) \+ (scale_2 \* model_2)} \+ background 182 183 or:: 184 185 Custom Model = scale_factor \* model_1 \* model_2 \+ background 186 187 In the *Easy Sum/Multi Editor* give the new model a function name and brief 188 description (to appear under the *Details* button on the *FitPage*). Then select 176 189 two existing models, as p1 and p2, and the required operator, '+' or '*' between 177 190 them. Finally, click the *Apply* button to generate the model and then click *Close*. 178 191 179 *NB: Any changes to a custom model generated in this way only become effective after* 180 *it is re-selected from the model drop-down menu on the Fit Page.* 181 182 .. _Advanced: 183 184 Advanced 185 ^^^^^^^^ 186 187 Selecting this option shows all the custom models in the plugin model folder, on Windows this is 192 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. 193 194 .. _Advanced_Plugin_Editor: 195 196 Advanced Plugin Editor 197 ^^^^^^^^^^^^^^^^^^^^^^ 198 199 Selecting this option shows all the plugin models in the plugin model folder, on Windows this is 188 200 189 201 *C:\\Users\\{username}\\.sasview\\plugin_models* 190 202 191 203 You can edit, modify, and save the Python code in any of these models using the 192 *Advanced CustomModel Editor*. Note that this is actually the same tool as the :ref:`Python_shell` .204 *Advanced Plugin Model Editor*. Note that this is actually the same tool as the :ref:`Python_shell` . 193 205 194 206 For details of the SasView plugin model format see :ref:`Writing_a_Plugin` . … … 196 208 .. 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! 197 209 198 When editing is complete, select *Run* > *Check Model* from the *Advanced Custom 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'. 199 200 To use the model, go to the relevant *Fit Page*, select the *Customized Models* 210 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'. 211 212 .. image:: ../calculator/new_pycrust_example_2.png 213 214 To use the model, go to the relevant *Fit Page*, select the *Plugin Models* 201 215 category and then select the model from the drop-down menu. 202 216 203 Any changes to a custommodel generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage.204 205 Delete 206 ^^^^^^ 207 208 Simply highlight the custom model to be removed. This operation is final!209 210 *NB: Custommodels shipped with SasView cannot be removed in this way.*211 212 Load 213 ^^^^ 214 215 This option loads (or re-loads) all models present in the plugin modelfolder.217 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. 218 219 Delete Plugin Models 220 ^^^^^^^^^^^^^^^^^^^^ 221 222 Simply highlight the plugin model to be removed. The operation is final!!! 223 224 *NB: Plugin models shipped with SasView cannot be removed in this way.* 225 226 Load Plugin Models 227 ^^^^^^^^^^^^^^^^^^ 228 229 This option loads (or re-loads) all models present in the *~\\.sasview\\plugin_models* folder. 216 230 217 231 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 601 615 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 602 616 603 .. note:: This help document was last changed by Steve King, 04Jun2015617 .. note:: This help document was last changed by Steve King, 10Oct2016 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r7e6bdf9 r3e1c9e5 9 9 ^^^^^^^^^^^^ 10 10 11 There are currently two ways to add your own models to SasView: 12 13 * Using the :ref:`Custom_Model_Editor` 14 * By Writing a Plugin Model 15 16 The Custom Model Editor lets you combine *existing* SasView library models. For anything more 17 complex, or if you want to apply polydispersity to parameters, you will need to write a Plugin Model. 11 There are essentially three ways to generate new fitting models for SasView: 12 13 * Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners and/or relatively simple models) 14 * By copying/editing an existing model (this can include models generated by the *New Plugin Model* dialog) in the :ref:`Python_shell` or :ref:`Advanced_Plugin_Editor` as described below (suitable for all use cases) 15 * By writing a model from scratch outside of SasView (only recommended for code monkeys!) 18 16 19 17 Overview … … 22 20 If you write your own model and save it to the the SasView *plugin_models* folder 23 21 24 *C:\\Users\\ [username]\\.sasview\\plugin_models* (on Windows)22 *C:\\Users\\{username}\\.sasview\\plugin_models* (on Windows) 25 23 26 24 the next time SasView is started it will compile the plugin and add 27 it to the list of * CustomizedModels* in a FitPage.28 29 SasView has three ways of writing models:30 31 - A s apure python model : Example -25 it to the list of *Plugin Models* in a FitPage. 26 27 SasView models can be of three types: 28 29 - A pure python model : Example - 32 30 `broadpeak.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/broad_peak.py>`_ 33 - A s apython model with embedded C : Example -31 - A python model with embedded C : Example - 34 32 `sphere.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/sphere.py>`_ 35 - A s apython wrapper with separate C code : Example -33 - A python wrapper with separate C code : Example - 36 34 `cylinder.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.py>`_, 37 35 `cylinder.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.c>`_ … … 671 669 ^^^^^^^^^^^^^^^^^^^ 672 670 673 Installed SasView 674 ................. 675 676 If you are editing your model from the SasView GUI, you can test it 677 by selecting *Run > Check Model* from the *Model Editor* menu bar. An 678 *Info* box will appear with the results of the compilation and a 679 check that the model runs. 680 681 682 Built SasView 683 ............. 671 Minimal Testing 672 ............... 673 674 Either open the :ref:`Python_shell` (*Tools* > *Python Shell/Editor*) or the :ref:`Advanced_Plugin_Editor` (*Fitting* > *Plugin Model Operations* > *Advanced 675 Plugin Editor*), load your model, and then select *Run > Check Model* from the 676 menu bar. 677 678 An *Info* box will appear with the results of the compilation and a check that 679 the model runs. 680 681 Recommended Testing 682 ................... 684 683 685 684 If the model compiles and runs, you can next run the unit tests that … … 802 801 consider adding your model to the 803 802 `Model Marketplace <http://marketplace.sasview.org/>`_ so that others may use it! 803 804 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 805 806 .. note:: This help document was last changed by Steve King, 10Oct2016
Note: See TracChangeset
for help on using the changeset viewer.