Changes in / [587ce8c:cb05bfd] in sasview
- Location:
- src/sas/sasgui
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/CategoryInstaller.py
rddbac66 r212bfc2 123 123 compile it and install 124 124 :param homefile: Override the default home directory 125 :param model_list: List of model names except those in Plugin Models 126 which are user supplied. 125 :param model_list: List of model names except customized models 127 126 """ 128 127 _model_dict = { model.name: model for model in model_list} -
src/sas/sasgui/perspectives/calculator/model_editor.py
rddbac66 ra08b89b 5 5 function of y (usually the intensity). It also provides a drop down of 6 6 standard available math functions. Finally a full python editor panel for 7 complete customizati on is provided.8 9 :TODO the writi ng of the file and name checking (and maybe some other10 fun ctions?) should be moved to a computational module which could be called11 fro m a python script. Basically one just needs to pass the name,7 complete customizatin is provided. 8 9 :TODO the writiong of the file and name checking (and maybe some other 10 funtions?) should be moved to a computational module which could be called 11 fropm a python script. Basically one just needs to pass the name, 12 12 description text and function text (or in the case of the composite editor 13 13 the names of the first and second model and the operator to be used). … … 61 61 """ 62 62 Dialog for easy custom composite models. Provides a wx.Dialog panel 63 to choose two existing models (including pre-existing Plugin Models which63 to choose two existing models (including pre-existing custom models which 64 64 may themselves be composite models) as well as an operation on those models 65 65 (add or multiply) the resulting model will add a scale parameter for summed … … 380 380 color = 'blue' 381 381 except: 382 msg = "Easy Sum/Multipy Plugin: Error occurred..."382 msg = "Easy Custom Sum/Multipy: Error occurred..." 383 383 info = 'Error' 384 384 color = 'red' … … 501 501 self.factor = factor 502 502 self._operator = operator 503 self.explanation = " PluginModel = %s %s (model1 %s model2)\n" % \503 self.explanation = " Custom Model = %s %s (model1 %s model2)\n" % \ 504 504 (self.factor, f_oper, self._operator) 505 505 self.explanationctr.SetLabel(self.explanation) … … 617 617 class EditorPanel(wx.ScrolledWindow): 618 618 """ 619 Simple Plugin Model function editor619 Custom model function editor 620 620 """ 621 621 def __init__(self, parent, base, path, title, *args, **kwds): … … 652 652 self.msg_sizer = None 653 653 self.warning = "" 654 #This does not seem to be used anywhere so commenting out for now 655 # -- PDB 2/26/17 656 #self._description = "New Plugin Model" 654 self._description = "New Custom Model" 657 655 self.function_tcl = None 658 656 self.math_combo = None … … 993 991 else: 994 992 self._notes = result 995 msg = "Successful! Please look for %s in PluginModels."%name993 msg = "Successful! Please look for %s in Customized Models."%name 996 994 msg += " " + self._notes 997 995 info = 'Info' … … 1140 1138 def on_help(self, event): 1141 1139 """ 1142 Bring up the New PluginModel Editor Documentation whenever1140 Bring up the Custom Model Editor Documentation whenever 1143 1141 the HELP button is clicked. 1144 1142 … … 1192 1190 #self.Destroy() 1193 1191 1194 ## Templates for pluginmodels1192 ## Templates for custom models 1195 1193 1196 1194 CUSTOM_TEMPLATE = """ -
src/sas/sasgui/perspectives/calculator/pyconsole.py
rddbac66 rd472e86 302 302 success = show_model_output(self, fname) 303 303 304 # Update pluginmodel list in fitpage combobox304 # Update custom model list in fitpage combobox 305 305 if success and self._manager != None and self.panel != None: 306 306 self._manager.set_edit_menu_helper(self.parent) -
src/sas/sasgui/perspectives/fitting/basepage.py
r7a5aedd r9e0aa69a 53 53 ON_MAC = True 54 54 55 CUSTOM_MODEL = 'Plugin Models'56 57 55 class BasicPage(ScrolledPanel, PanelBase): 58 56 """ 59 This class provide general structure of thefitpanel page57 This class provide general structure of fitpanel page 60 58 """ 61 59 # Internal name for the AUI manager … … 679 677 def _copy_info(self, flag): 680 678 """ 681 Send event d epending on flag682 683 : Param flag: flag that distinguish es theevent679 Send event dpemding on flag 680 681 : Param flag: flag that distinguish event 684 682 """ 685 683 # messages depending on the flag … … 1121 1119 :precondition: the page is already drawn or created 1122 1120 1123 :postcondition: the state of the underlying data change sas well as the1121 :postcondition: the state of the underlying data change as well as the 1124 1122 state of the graphic interface 1125 1123 """ … … 1169 1167 self._show_combox(None) 1170 1168 from models import PLUGIN_NAME_BASE 1171 if self.categorybox.GetValue() == CUSTOM_MODEL\1169 if self.categorybox.GetValue() == 'Customized Models' \ 1172 1170 and PLUGIN_NAME_BASE not in state.formfactorcombobox: 1173 1171 state.formfactorcombobox = \ … … 1337 1335 def _selectDlg(self): 1338 1336 """ 1339 open a dialog file to select the customized polydispersity function1337 open a dialog file to selected the customized dispersity 1340 1338 """ 1341 1339 if self.parent is not None: … … 1762 1760 def _set_multfactor_combobox(self, multiplicity=10): 1763 1761 """ 1764 Set comboBox for mu ltitfactor of CoreMultiShellModel1762 Set comboBox for muitfactor of CoreMultiShellModel 1765 1763 :param multiplicit: no. of multi-functionality 1766 1764 """ … … 1800 1798 Fill panel's combo box according to the type of model selected 1801 1799 """ 1802 1800 custom_model = 'Customized Models' 1803 1801 mod_cat = self.categorybox.GetStringSelection() 1804 1802 self.structurebox.SetSelection(0) … … 1809 1807 m_list = [] 1810 1808 try: 1811 if mod_cat == CUSTOM_MODEL:1809 if mod_cat == custom_model: 1812 1810 for model in self.model_list_box[mod_cat]: 1813 1811 m_list.append(self.model_dict[model.name]) … … 3455 3453 fills out the category list box 3456 3454 """ 3457 uncat_str = ' PluginModels'3455 uncat_str = 'Customized Models' 3458 3456 self._read_category_info() 3459 3457 … … 3484 3482 self.model_box.Clear() 3485 3483 3486 if category == ' PluginModels':3484 if category == 'Customized Models': 3487 3485 for model in self.model_list_box[category]: 3488 3486 str_m = str(model).split(".")[0] -
src/sas/sasgui/perspectives/fitting/fitpage.py
r3d55219 r3d55219 31 31 SMEAR_SIZE_L = 0.00 32 32 SMEAR_SIZE_H = 0.00 33 CUSTOM_MODEL = 'Plugin Models' 33 34 34 35 35 class FitPage(BasicPage): … … 1249 1249 wx.PostEvent(self.parent, new_event) 1250 1250 # update list of plugins if new plugin is available 1251 custom_model = CUSTOM_MODEL1251 custom_model = 'Customized Models' 1252 1252 mod_cat = self.categorybox.GetStringSelection() 1253 1253 if mod_cat == custom_model: -
src/sas/sasgui/perspectives/fitting/fitting.py
rddbac66 r73cbeec 225 225 226 226 self.id_edit = wx.NewId() 227 editmodel_help = "Edit customized model sample file" 227 228 self.menu1.AppendMenu(self.id_edit, "Plugin Model Operations", 228 self.edit_model_menu )229 self.edit_model_menu, editmodel_help) 229 230 #create menubar items 230 231 return [(self.menu1, self.sub_menu)] … … 259 260 self.update_custom_combo() 260 261 if os.path.isfile(p_path): 261 msg = "Sorry! unable to delete the default "262 msg += " pluginmodel... \n"262 msg = "Sorry! Could not be able to delete the default " 263 msg += "custom model... \n" 263 264 msg += "Please manually remove the files (.py, .pyc) " 264 265 msg += "in the 'plugin_models' folder \n" … … 273 274 if item.GetLabel() == label: 274 275 self.edit_menu.DeleteItem(item) 275 msg = "The pluginmodel, %s, has been deleted." % label276 msg = "The custom model, %s, has been deleted." % label 276 277 evt = StatusEvent(status=msg, type='stop', info='info') 277 278 wx.PostEvent(self.parent, evt) … … 330 331 temp = self.fit_panel.reset_pmodel_list() 331 332 if temp: 332 # Set the new pluginmodel list for all fit pages333 # Set the new custom model list for all fit pages 333 334 for uid, page in self.fit_panel.opened_pages.iteritems(): 334 335 if hasattr(page, "formfactorbox"): … … 1964 1965 ## then kill itself but cannot. Paul Kienzle came up with 1965 1966 ## this fix to prevent threads from stepping on each other 1966 ## which was causing a simple custom plugin model to crash 1967 ##Sasview. 1967 ## which was causing a simple custom model to crash Sasview. 1968 1968 ## We still don't know why the fit sometimes lauched a second 1969 1969 ## thread -- something which should also be investigated. -
src/sas/sasgui/perspectives/fitting/media/fitting_help.rst
r5295cf5 r26c8be3 34 34 * in *Single* fit mode - individual data sets are fitted independently one-by-one 35 35 36 * in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to 37 the *same* model with/without constrained parameters (this might be useful, 38 for example, if you have measured the same sample at different contrasts) 36 * in *Simultaneous* fit mode - multiple data sets are fitted simultaneously to the *same* model with/without constrained parameters (this might be useful, for example, if you have measured the same sample at different contrasts) 39 37 40 38 * in *Batch* fit mode - multiple data sets are fitted sequentially to the *same* model (this might be useful, for example, if you have performed a kinetic or time-resolved experiment and have *lots* of data sets!) … … 45 43 ----------------- 46 44 47 The models in SasView are grouped into categories. By default these consist of: 48 49 * *Cylinder* - cylindrical shapes (disc, right cylinder, cylinder with endcaps 50 etc) 51 * *Ellipsoid* - ellipsoidal shapes (oblate,prolate, core shell, etc) 52 * *Parellelepiped* - as the name implies 53 * *Sphere* - sheroidal shapes (sphere, core multishell, vesicle, etc) 54 * *Lamellae* - lamellar shapes (lamellar, core shell lamellar, stacked 55 lamellar, etc) 45 By default, the models in SasView are grouped into five categories 46 47 * *Shapes* - models describing 'objects' (spheres, cylinders, etc) 56 48 * *Shape-Independent* - models describing structure in terms of density correlation functions, fractals, peaks, power laws, etc 57 * *Paracrystal* - semi ordered structures (bcc, fcc, etc) 49 * *Customized Models* - SasView- or User-created (non-library) Python models 50 * *Uncategorised* - other models (for reflectivity, etc) 58 51 * *Structure Factor* - S(Q) models 59 * *Plugin Models* - User-created (custom/non-library) Python models60 52 61 53 Use the *Category* drop-down menu to chose a category of model, then select … … 92 84 .. image:: cat_fig0.bmp 93 85 94 The categorization of all models except the user supplied Plugin Models can be95 reassigned, added to, and removed using *Category Manager*. Models can also be 96 hidden from viewin the drop-down menus.86 The categorization of all models except the customized models can be reassigned, 87 added to, and removed using *Category Manager*. Models can also be hidden from view 88 in the drop-down menus. 97 89 98 90 .. image:: cat_fig1.bmp … … 101 93 ^^^^^^^^^^^^^^^^^ 102 94 103 To change category, highlight a model in the list by left-clicking on its entry 104 and then click the *Modify* button. Use the *Change Category* panel that appears 105 t o make the required changes.95 To change category, highlight a model in the list by left-clicking on its entry and 96 then click the *Modify* button. Use the *Change Category* panel that appears to make 97 the required changes. 106 98 107 99 .. image:: cat_fig2.bmp … … 114 106 ^^^^^^^^^^^^^^^^^^^^^ 115 107 116 Use the *Enable All / Disable All* buttons and the check boxes beside each model 117 to select the models to show/hide. To apply the selection, click *Ok*. Otherwise 118 click*Cancel*.108 Use the *Enable All / Disable All* buttons and the check boxes beside each model to 109 select the models to show/hide. To apply the selection, click *Ok*. Otherwise click 110 *Cancel*. 119 111 120 112 *NB: It may be necessary to change to a different category and then back again* … … 126 118 --------------- 127 119 128 For a complete list of all the library models available in SasView, see 129 the `Model Documentation <../../../index.html>`_ . 120 For a complete list of all the library models available in SasView, see the `Model Documentation <../../../index.html>`_ . 130 121 131 122 It is also possible to add your own models. … … 140 131 There are essentially three ways to generate new fitting models for SasView: 141 132 142 * Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners 143 and/or relatively simple models) 144 * By copying/editing an existing model (this can include models generated by 145 the New Plugin Model* dialog) in the :ref:`Python_shell` or 146 :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 147 * By writing a model from scratch outside of SasView (only recommended for code 148 monkeys!) 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!) 149 136 150 137 Please read the guidance on :ref:`Writing_a_Plugin` before proceeding. … … 176 163 ^^^^^^^^^^^^^^^^ 177 164 178 Relatively straightforward models can be programmed directly from the SasView 179 GUIusing the *New Plugin Model Function*.165 Relatively straightforward models can be programmed directly from the SasView GUI 166 using the *New Plugin Model Function*. 180 167 181 168 .. image:: new_model.bmp … … 188 175 *checked*\ . 189 176 190 Also note that the 'Fit Parameters' have been split into two sections: those 191 which can be polydisperse (shape and orientation parameters) and those which are 192 not(eg, scattering length densities).177 Also note that the 'Fit Parameters' have been split into two sections: those which 178 can be polydisperse (shape and orientation parameters) and those which are not 179 (eg, scattering length densities). 193 180 194 181 A model file generated by this option can be viewed and further modified using … … 200 187 .. image:: sum_model.bmp 201 188 202 This option creates a custom Plugin Model of the form::203 204 Plugin Model = scale_factor * {(scale_1 * model_1) +/- (scale_2 * model_2)}+ background189 This option creates a custom model of the form:: 190 191 Custom Model = scale_factor \* {(scale_1 \* model_1) \+ (scale_2 \* model_2)} \+ background 205 192 206 193 or:: 207 194 208 Plugin Model = scale_factor * model_1 /* model_2+ background195 Custom Model = scale_factor \* model_1 \* model_2 \+ background 209 196 210 197 In the *Easy Sum/Multi Editor* give the new model a function name and brief … … 245 232 Simply highlight the plugin model to be removed. The operation is final!!! 246 233 247 *NB: Models shipped with SasView cannot be removed in this way.*234 *NB: Plugin models shipped with SasView cannot be removed in this way.* 248 235 249 236 Load Plugin Models 250 237 ^^^^^^^^^^^^^^^^^^ 251 238 252 This option loads (or re-loads) all models present in the 253 *~\\.sasview\\plugin_models* folder. 239 This option loads (or re-loads) all models present in the *~\\.sasview\\plugin_models* folder. 254 240 255 241 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 414 400 :ref:`Assessing_Fit_Quality`. 415 401 416 *NB: If you need to use a custom Plugin Model, you must ensure that model is417 availablefirst (see* :ref:`Adding_your_own_models` *).*402 *NB: If you need to use a customized model, you must ensure that model is available* 403 *first (see* :ref:`Adding_your_own_models` *).* 418 404 419 405 Method … … 498 484 If multiple data sets are in one file, load just that file. *Unselect All Data*, then 499 485 select a single initial data set to be fitted. Fit that selected data set as described 500 above under :ref:`Single_Fit_Mode` .501 502 *NB: If you need to use a custom Plugin Model, you must ensure that model is503 availablefirst (see* :ref:`Adding_your_own_models` *).*486 above under :ref:`Single_Fit_Mode` . 487 488 *NB: If you need to use a customized model, you must ensure that model is available* 489 *first (see* :ref:`Adding_your_own_models` *).* 504 490 505 491 Method -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r5295cf5 rca6cbc1c 27 27 28 28 the next time SasView is started it will compile the plugin and add 29 it to the list of * PluginModels* in a FitPage.29 it to the list of *Customized Models* in a FitPage. 30 30 31 31 SasView models can be of three types: -
src/sas/sasgui/perspectives/fitting/models.py
re92a352 r0de74af 325 325 self.plugins.append(plug) 326 326 self.model_dictionary[name] = plug 327 self.model_combobox.set_list(" PluginModels", self.plugins)327 self.model_combobox.set_list("Customized Models", self.plugins) 328 328 return self.model_combobox.get_list() 329 329 else: … … 346 346 self.model_dictionary[name] = plug 347 347 348 self.model_combobox.reset_list(" PluginModels", self.plugins)348 self.model_combobox.reset_list("Customized Models", self.plugins) 349 349 return self.model_combobox.get_list() 350 350 … … 389 389 # self.shape_indep_list) 390 390 self.model_combobox.set_list("Structure Factors", self.struct_list) 391 self.model_combobox.set_list(" PluginModels", self.plugins)391 self.model_combobox.set_list("Customized Models", self.plugins) 392 392 self.model_combobox.set_list("P(Q)*S(Q)", self.multiplication_factor) 393 393 self.model_combobox.set_list("multiplication", -
src/sas/sasgui/perspectives/fitting/pagestate.py
r71601312 r6d2b50b 33 33 from sas.sascalc.dataloader.data_info import Data2D, Collimation, Detector 34 34 from sas.sascalc.dataloader.data_info import Process, Aperture 35 36 35 # Information to read/write state as xml 37 36 FITTING_NODE_NAME = 'fitting_plug_in' 38 37 CANSAS_NS = "cansas1d/1.0" 39 40 CUSTOM_MODEL = 'Plugin Models'41 CUSTOM_MODEL_OLD = 'Customized Models'42 38 43 39 LIST_OF_DATA_ATTRIBUTES = [["is_data", "is_data", "bool"], … … 370 366 :return: None 371 367 """ 372 if self.categorycombobox == CUSTOM_MODEL_OLD:373 self.categorycombobox = CUSTOM_MODEL374 368 if self.formfactorcombobox == '': 375 369 FIRST_FORM = { … … 384 378 'Sphere' : 'adsorbed_layer', 385 379 'Structure Factor' : 'hardsphere', 386 CUSTOM_MODEL: ''380 'Customized Models' : '' 387 381 } 388 382 if self.categorycombobox == '':
Note: See TracChangeset
for help on using the changeset viewer.