Changeset cb4ef58 in sasview for src/sas/sasgui
- Timestamp:
- Apr 13, 2016 7:23:07 AM (9 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, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 16b769b
- Parents:
- fa4ea80
- Location:
- src/sas/sasgui/perspectives
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/calculator/model_editor.py
raa03e0d rcb4ef58 1329 1329 SUM_TEMPLATE = """ 1330 1330 # A sample of an experimental model function for Sum/Multiply(Pmodel1,Pmodel2) 1331 import os 1332 import sys 1331 1333 import copy 1334 1335 import nuympy 1336 1332 1337 from sas.sascalc.fit.pluginmodel import Model1DPlugin 1333 1338 from sasmodels.sasview_model import make_class … … 1339 1344 #P2_model: 1340 1345 #from %s import Model as P2 1341 import os1342 import sys1343 1346 1344 1347 class Model(Model1DPlugin): … … 1385 1388 ## Parameter details [units, min, max] 1386 1389 self._set_details() 1387 self.details['scale_factor'] = ['', None, None]1390 self.details['scale_factor'] = ['', 0.0, numpy.inf] 1388 1391 1389 1392 -
src/sas/sasgui/perspectives/fitting/basepage.py
r08959b8 rcb4ef58 1896 1896 for model in self.model_list_box[mod_cat]: 1897 1897 if 'sasmodels.sasview_model.' in str(model): 1898 str_m = model. _model_info['id']1898 str_m = model.id 1899 1899 else: 1900 1900 str_m = str(model).split(".")[0] … … 1945 1945 mlist = [] 1946 1946 for models in list: 1947 model = models() 1948 name = model.__class__.__name__ 1949 if models.__name__ != "NoStructure": 1950 name = model.name 1951 mlist.append((name, models)) 1947 if models.name != "NoStructure": 1948 mlist.append((models.name, models)) 1952 1949 1953 1950 # Sort the models … … 2099 2096 if form_factor != None: 2100 2097 # set multifactor for Mutifunctional models 2101 if form_factor().__class__ in \ 2102 self.model_list_box["Multi-Functions"]: 2098 if form_factor.is_multiplicity_model: 2103 2099 m_id = self.multifactorbox.GetCurrentSelection() 2104 multiplicity = form_factor ().multiplicity_info[0]2100 multiplicity = form_factor.multiplicity_info[0] 2105 2101 self.multifactorbox.Clear() 2106 2102 self._set_multfactor_combobox(multiplicity) 2107 2103 self._show_multfactor_combobox() 2108 2104 #ToDo: this info should be called directly from the model 2109 text = form_factor ().multiplicity_info[1] # 'No. of Shells: '2105 text = form_factor.multiplicity_info[1] # 'No. of Shells: ' 2110 2106 2111 2107 self.mutifactor_text.SetLabel(text) … … 2117 2113 if self.multi_factor == None: 2118 2114 self.multi_factor = 0 2119 form_factor = form_factor(int(self.multi_factor))2120 2115 self.multifactorbox.SetSelection(m_id) 2121 2116 # Check len of the text1 and max_multiplicity … … 2131 2126 else: 2132 2127 self.sld_axes = "" 2133 2134 2128 else: 2135 2129 self._hide_multfactor_combobox() 2136 2130 self.show_sld_button.Hide() 2137 form_factor = form_factor()2138 2131 self.multi_factor = None 2139 2132 else: … … 2147 2140 if struct_factor != None: 2148 2141 from sas.sascalc.fit.MultiplicationModel import MultiplicationModel 2149 self.model = MultiplicationModel(form_factor, struct_factor()) 2142 self.model = MultiplicationModel(form_factor(self.multi_factor), 2143 struct_factor()) 2150 2144 # multifunctional form factor 2151 2145 if len(form_factor.non_fittable) > 0: 2152 2146 self.temp_multi_functional = True 2147 elif form_factor != None: 2148 self.model = form_factor(self.multi_factor) 2153 2149 else: 2154 if form_factor != None: 2155 self.model = form_factor 2156 else: 2157 self.model = None 2158 return self.model 2150 self.model = None 2151 return 2152 2159 2153 # check if model has magnetic parameters 2160 2154 if len(self.model.magnetic_params) > 0: … … 2286 2280 parameter's error of fit, 2287 2281 parameter's minimum value, 2288 par rameter's maximum value ,2282 parameter's maximum value , 2289 2283 parameter's units] 2290 2284 """ -
src/sas/sasgui/perspectives/fitting/fitpage.py
rf27dd1e rcb4ef58 10 10 import math 11 11 import time 12 13 from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 14 12 15 from sas.sasgui.guiframe.events import StatusEvent 13 16 from sas.sasgui.guiframe.events import NewPlotEvent … … 621 624 model_disp = wx.StaticText(self, wx.ID_ANY, 'Function') 622 625 CHECK_STATE = self.cb1.GetValue() 623 #import sas.models.dispersion_models624 #self.polydisp = sas.models.dispersion_models.models625 import sasmodels.weights626 self.polydisp = sasmodels.weights.models627 626 628 627 ix = 0 … … 784 783 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 785 784 style=wx.CB_READONLY, name='%s' % name1) 786 for key, value in self.polydisp.iteritems():785 for key, value in POLYDISPERSITY_MODELS.iteritems(): 787 786 name_disp = str(key) 788 787 disp_box.Append(name_disp, value) … … 948 947 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1), 949 948 style=wx.CB_READONLY, name='%s' % name1) 950 for key, value in self.polydisp.iteritems():949 for key, value in POLYDISPERSITY_MODELS.iteritems(): 951 950 name_disp = str(key) 952 951 disp_box.Append(name_disp, value) -
src/sas/sasgui/perspectives/fitting/models.py
rdcdca68 rcb4ef58 296 296 #Build list automagically from sasmodels package 297 297 for model in load_standard_models(): 298 self.model_dictionary[model. _model_info['name']] = model299 if model. _model_info['structure_factor'] == True:298 self.model_dictionary[model.name] = model 299 if model.is_structure_factor: 300 300 self.struct_list.append(model) 301 if model._model_info['variant_info'] is not None: 301 if model.is_form_factor: 302 self.multiplication_factor.append(model) 303 if model.is_multiplicity_model: 302 304 self.multi_func_list.append(model) 303 305 else: 304 self.model_name_list.append(model._model_info['name']) 305 if model._model_info['ER'] is not None: 306 self.multiplication_factor.append(model) 306 self.model_name_list.append(model.name) 307 307 308 308 #Looking for plugins … … 387 387 Get the multifunctional models 388 388 """ 389 for item in self.plugins: 390 try: 391 # check the multiplicity if any 392 if item.multiplicity_info[0] > 1: 393 self.multi_func_list.append(item) 394 except: 395 # pass to other items 396 pass 389 items = [item for item in self.plugins if item.is_multiplicity_model] 390 self.multi_func_list = items 397 391 398 392 def get_model_list(self):
Note: See TracChangeset
for help on using the changeset viewer.