Changeset f485ba0 in sasview
- Timestamp:
- Sep 15, 2017 10:45:36 AM (7 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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 203669a
- Parents:
- c6a298c
- Location:
- src/sas/sasgui/perspectives/fitting/media
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r05b0bf6 rf485ba0 195 195 the :ref:`Advanced_Plugin_Editor` . 196 196 197 **SasView version 4.2** made it possible to specify whether a plugin created with 198 the *New Plugin Model* dialog is actually a form factor P(Q) or a structure factor 199 S(Q). To do this, simply add one or other of the following lines under the *import* 200 statements. 201 202 For a form factor:: 203 204 form_factor = True 205 206 or for a structure factor:: 207 208 structure_factor = True 209 210 If the plugin is a structure factor it is *also* necessary to add two variables to 211 the parameter list:: 212 213 parameters = [ 214 ['radius_effective', '', 1, [-numpy.inf, numpy.inf], 'volume', ''], 215 ['volfraction', '', 1, [-numpy.inf, numpy.inf], '', ''], 216 . 217 . 218 219 and to the declarations of the functions Iq and Iqxy::: 220 221 def Iq(x , radius_effective, volfraction, ...): 222 223 def Iqxy(x, y, radius_effective, volfraction, ...): 224 225 Such a plugin should then be available in the S(Q) drop-down box on a FitPage (once 226 a P(Q) model has been selected). 227 197 228 Sum|Multi(p1,p2) 198 229 ^^^^^^^^^^^^^^^^ … … 206 237 or:: 207 238 208 Plugin Model = scale_factor * model_1 /* model_2+ background239 Plugin Model = scale_factor * (model1 * model2) + background 209 240 210 241 In the *Easy Sum/Multi Editor* give the new model a function name and brief 211 242 description (to appear under the *Details* button on the *FitPage*). Then select 212 243 two existing models, as p1 and p2, and the required operator, '+' or '*' between 213 them. Finally, click the *Apply* button to generate the model and then click *Close*. 214 215 Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage. 244 them. Finally, click the *Apply* button to generate and test the model and then click *Close*. 245 246 Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the plugin models drop-down menu on the FitPage. If the model is not listed you can force a 247 recompilation of the plugins by selecting *Fitting* > *Plugin Model Operations* > *Load Plugin Models*. 248 249 **SasView version 4.2** introduced a much simplified and more extensible structure for plugin models 250 generated through the Easy Sum/Multi Editor. For example, the code for a combination of a sphere model 251 with a power law model now looks like this:: 252 253 from sasmodels.core import load_model_info 254 from sasmodels.sasview_model import make_model_from_info 255 256 model_info = load_model_info('sphere+power_law') 257 model_info.name = 'My Plugin Model' 258 model_info.description = 'sphere + power_law' 259 Model = make_model_from_info(model_info) 260 261 To change the models or operators contributing to this plugin it is only necessary to edit the string 262 in the brackets after *load_model_info*, though it would also be a good idea to update the model name 263 and description too!!! 264 265 The model specification string can handle multiple models and combinations of operators (+ - * /) which 266 are processed according to normal conventions. Thus 'model1+model2*model3' would be valid and would 267 multiply model2 by model3 before adding model1. In this example, parameters in the *FitPage* would be 268 prefixed A_ (for model2), B_ (for model3) and C_ (for model1). Whilst this might appear a little 269 confusing, unless you were creating a plugin model from multiple instances of the same model the parameter assignments ought to be obvious when you load the plugin. 270 271 This streamlined approach to building complex plugin models from existing library models, or models 272 available on the *Model Marketplace*, also permits the creation of P(Q)S(Q) plugin models, something 273 that was not possible in earlier versions of SasView. 216 274 217 275 .. _Advanced_Plugin_Editor: -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r72100ee rf485ba0 18 18 * By writing a model from scratch outside of SasView (only recommended for 19 19 code monkeys!) 20 21 Also see :ref:`Adding_your_own_models`. 20 22 21 23 Overview
Note: See TracChangeset
for help on using the changeset viewer.