Changeset df7a7e3 in sasview for fittingview/src
- Timestamp:
- Sep 17, 2012 5:11:50 PM (12 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:
- b71a53b
- Parents:
- cf7653d3
- Location:
- fittingview/src/sans/perspectives/fitting
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/basepage.py
r2a66329 rdf7a7e3 2 2 Base Page for fitting 3 3 """ 4 4 5 import sys 5 6 import os … … 10 11 import math 11 12 import string 13 import cPickle as pickle 14 import shutil 15 from collections import defaultdict 12 16 from wx.lib.scrolledpanel import ScrolledPanel 13 17 from sans.guiframe.panel_base import PanelBase … … 22 26 from sans.dataloader.data_info import Source 23 27 from sans.perspectives.fitting.pagestate import PageState 28 from sans.guiframe.CategoryInstaller import CategoryInstaller 29 30 24 31 25 32 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() … … 130 137 self.sld_axes = None 131 138 self.multi_factor = None 139 self.model_name = None 140 self.model_dict = {} 132 141 133 142 self.disp_cb_dict = {} … … 161 170 self.disp_list = [] 162 171 self.disp_name = "" 172 173 ## category stuff 174 self.category_box = None 175 self.model_box = None 163 176 164 177 ## list of orientation parameters … … 213 226 ## layout 214 227 self.set_layout() 228 229 215 230 216 231 def set_index_model(self, index): … … 459 474 self.model_list_box = page_info.model_list_box 460 475 ## Data member to store the dispersion object created 461 self.populate_box(dict=self.model_list_box) 476 462 477 463 478 def onContextMenu(self, event): … … 562 577 self.state.manager = manager 563 578 564 def populate_box(self, dict):579 def populate_box(self, m_dict): 565 580 """ 566 581 Store list of model … … 569 584 570 585 """ 571 self.model_list_box = dict 572 self.state.model_list_box = self.model_list_box 573 self.initialize_combox() 574 586 self.model_list_box = m_dict 587 # self.state.model_list_box = self.model_list_box 588 # self.initialize_combox() 589 590 def set_model_dictionary(self, model_dict): 591 """ 592 Store a dictionary linking model name -> model object 593 594 :param model_dict: dictionary containing list of models 595 """ 596 self.model_dict = model_dict 597 575 598 def initialize_combox(self): 576 599 """ … … 580 603 if self.model_list_box is None: 581 604 return 582 if len(self.model_list_box) > 0:583 self._populate_box(self.formfactorbox,584 self.model_list_box["Shapes"])585 605 586 606 if len(self.model_list_box) > 0: … … 881 901 self.state.structurecombobox = self.structurebox.\ 882 902 GetString(s_select) 883 if self.formfactorbox != None:884 f_select = self.formfactorbox.GetSelection()885 if f_select > 0:886 self.state.formfactorcombobox = self.formfactorbox.\887 GetString(f_select)903 # if self.formfactorbox != None: 904 # f_select = self.formfactorbox.GetSelection() 905 # if f_select > 0: 906 self.state.formfactorcombobox = \ 907 self.model_box.GetStringSelection() 888 908 889 909 #save radiobutton state for model selection 890 self.state.shape_rbutton = self.shape_rbutton.GetValue() 891 self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 892 self.state.struct_rbutton = self.struct_rbutton.GetValue() 893 self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 910 # ILL 911 # self.state.shape_rbutton = self.shape_rbutton.GetValue() 912 # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 913 # self.state.struct_rbutton = self.struct_rbutton.GetValue() 914 # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 894 915 895 916 self.state.enable2D = copy.deepcopy(self.enable2D) … … 1040 1061 self.disp_list = state.disp_list 1041 1062 1042 ## set the state of the radio box1043 self.shape_rbutton.SetValue(state.shape_rbutton)1044 self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)1045 self.struct_rbutton.SetValue(state.struct_rbutton)1046 self.plugin_rbutton.SetValue(state.plugin_rbutton)1047 1048 ## fill model combobox1049 1063 self._show_combox_helper() 1050 #select the current model 1051 try: 1052 # to support older version 1053 formfactor_pos = int(state.formfactorcombobox) 1054 except: 1055 formfactor_pos = 0 1056 for ind_form in range(self.formfactorbox.GetCount()): 1057 if self.formfactorbox.GetString(ind_form) == \ 1058 state.formfactorcombobox: 1059 formfactor_pos = int(ind_form) 1060 break 1061 1062 self.formfactorbox.Select(formfactor_pos) 1063 1064 1065 # select the model in the gui 1066 self._regenerate_model_dict() 1067 if(len(self.by_model_dict[state.formfactorcombobox]) == 0): 1068 self.category_box.SetStringSelection('Uncategorized') 1069 self.model_box.SetStringSelection(state.formfactorcombobox) 1070 else: 1071 self.category_box.SetStringSelection(\ 1072 self.by_model_dict[state.formfactorcombobox][0] ) 1073 self.model_box.SetStringSelection(state.formfactorcombobox) 1074 1075 1064 1076 try: 1065 1077 # to support older version … … 1106 1118 state.disp_cb_dict[item]) 1107 1119 # Create the dispersion objects 1108 from sans.models.dispersion_models import ArrayDispersion 1120 from sans.models.dispersion_models \ 1121 import ArrayDispersion 1109 1122 disp_model = ArrayDispersion() 1110 1123 if hasattr(state, "values") and \ … … 1205 1218 self.disp_list = state.disp_list 1206 1219 1207 ## set the state of the radio box1208 self.shape_rbutton.SetValue(state.shape_rbutton)1209 self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton)1210 self.struct_rbutton.SetValue(state.struct_rbutton)1211 self.plugin_rbutton.SetValue(state.plugin_rbutton)1212 1220 1213 1221 ## fill model combobox 1214 1222 self._show_combox_helper() 1215 1223 #select the current model 1216 try: 1217 # to support older version 1218 formfactor_pos = int(state.formfactorcombobox) 1219 except: 1220 formfactor_pos = 0 1221 for ind_form in range(self.formfactorbox.GetCount()): 1222 if self.formfactorbox.GetString(ind_form) == \ 1223 (state.formfactorcombobox): 1224 formfactor_pos = int(ind_form) 1225 break 1226 1227 self.formfactorbox.Select(formfactor_pos) 1228 1224 1225 1226 self._regenerate_model_dict() 1227 if(len(self.by_model_dict[state.formfactorcombobox]) == 0): 1228 self.category_box.SetStringSelection('Uncategorized') 1229 self.model_box.SetStringSelection(state.formfactorcombobox) 1230 else: 1231 self.category_box.SetStringSelection(\ 1232 self.by_model_dict[state.formfactorcombobox][0] ) 1233 self.model_box.SetStringSelection(state.formfactorcombobox) 1234 1229 1235 try: 1230 1236 # to support older version … … 1426 1432 save radiobutton containing the type model that can be selected 1427 1433 """ 1428 self.state.shape_rbutton = self.shape_rbutton.GetValue()1429 self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue()1430 self.state.struct_rbutton = self.struct_rbutton.GetValue()1431 self.state.plugin_rbutton = self.plugin_rbutton.GetValue()1434 # self.state.shape_rbutton = self.shape_rbutton.GetValue() 1435 # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 1436 # self.state.struct_rbutton = self.struct_rbutton.GetValue() 1437 # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 1432 1438 self.state.structurecombobox = self.structurebox.GetLabel() 1433 self.state.formfactorcombobox = self. formfactorbox.GetLabel()1439 self.state.formfactorcombobox = self.model_box.GetStringSelection() 1434 1440 1435 1441 ## post state to fit panel … … 1766 1772 class_name = model.p_model.__class__ 1767 1773 name = model.p_model.name 1768 self.formfactorbox.Clear()1774 # self.formfactorbox.Clear() 1769 1775 1770 1776 for k, list in self.model_list_box.iteritems(): 1771 1777 if k in["P(Q)*S(Q)", "Shapes"] and \ 1772 1778 class_name in self.model_list_box["Shapes"]: 1773 self.shape_rbutton.SetValue(True)1779 # self.shape_rbutton.SetValue(True) 1774 1780 ## fill the form factor list with new model 1775 self._populate_box(self.formfactorbox,1776 self.model_list_box["Shapes"])1777 items = self.formfactorbox.GetItems()1778 # # set comboxbox to the selected item1779 for i in range(len(items)):1780 if items[i] == str(name):1781 self.formfactorbox.SetSelection(i)1782 break1781 # self._populate_box(self.formfactorbox, 1782 # self.model_list_box["Shapes"]) 1783 # items = self.formfactorbox.GetItems() 1784 # ## set comboxbox to the selected item 1785 # for i in range(len(items)): 1786 # if items[i] == str(name): 1787 # self.formfactorbox.SetSelection(i) 1788 # break 1783 1789 return 1784 elif k == "Shape-Independent":1785 self.shape_indep_rbutton.SetValue(True)1786 elif k == "Structure Factors":1787 self.struct_rbutton.SetValue(True)1788 elif k == "Multi-Functions":1789 continue1790 else:1791 self.plugin_rbutton.SetValue(True)1790 # elif k == "Shape-Independent": 1791 # self.shape_indep_rbutton.SetValue(True) 1792 # elif k == "Structure Factors": 1793 # self.struct_rbutton.SetValue(True) 1794 # elif k == "Multi-Functions": 1795 # continue 1796 # else: 1797 # self.plugin_rbutton.SetValue(True) 1792 1798 1793 if class_name in list:1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 else:1799 # if class_name in list: 1800 # # ## fill the form factor list with new model 1801 # # self._populate_box(self.formfactorbox, list) 1802 # # items = self.formfactorbox.GetItems() 1803 # # ## set comboxbox to the selected item 1804 # # for i in range(len(items)): 1805 # # if items[i] == str(name): 1806 # # self.formfactorbox.SetSelection(i) 1807 # # break 1808 # # break 1809 # else: 1804 1810 ## Select the model from the menu 1805 1811 class_name = model.__class__ 1806 1812 name = model.name 1807 self.formfactorbox.Clear()1808 items = self.formfactorbox.GetItems()1813 ## self.formfactorbox.Clear() 1814 # items = self.formfactorbox.GetItems() 1809 1815 1810 1816 for k, list in self.model_list_box.iteritems(): … … 1824 1830 self.text2.Disable() 1825 1831 1826 self.shape_rbutton.SetValue(True)1832 # self.shape_rbutton.SetValue(True) 1827 1833 ## fill the form factor list with new model 1828 self._populate_box(self.formfactorbox,1829 self.model_list_box["Shapes"])1830 items = self.formfactorbox.GetItems()1831 # # set comboxbox to the selected item1832 for i in range(len(items)):1833 if items[i] == str(name):1834 self.formfactorbox.SetSelection(i)1835 break1834 # self._populate_box(self.formfactorbox, 1835 # self.model_list_box["Shapes"]) 1836 # items = self.formfactorbox.GetItems() 1837 # ## set comboxbox to the selected item 1838 # for i in range(len(items)): 1839 # if items[i] == str(name): 1840 # self.formfactorbox.SetSelection(i) 1841 # break 1836 1842 return 1837 elif k == "Shape-Independent":1838 self.shape_indep_rbutton.SetValue(True)1839 elif k == "Structure Factors":1840 self.struct_rbutton.SetValue(True)1841 elif k == "Multi-Functions":1842 continue1843 else:1844 self.plugin_rbutton.SetValue(True)1843 # elif k == "Shape-Independent": 1844 # self.shape_indep_rbutton.SetValue(True) 1845 # elif k == "Structure Factors": 1846 # self.struct_rbutton.SetValue(True) 1847 # elif k == "Multi-Functions": 1848 # continue 1849 # else: 1850 # self.plugin_rbutton.SetValue(True) 1845 1851 if class_name in list: 1846 1852 self.structurebox.SetSelection(0) … … 1848 1854 self.text2.Disable() 1849 1855 ## fill the form factor list with new model 1850 self._populate_box(self.formfactorbox, list)1851 items = self.formfactorbox.GetItems()1856 # self._populate_box(self.formfactorbox, list) 1857 # items = self.formfactorbox.GetItems() 1852 1858 ## set comboxbox to the selected item 1853 for i in range(len(items)):1854 if items[i] == str(name):1855 self.formfactorbox.SetSelection(i)1856 break1859 # for i in range(len(items)): 1860 # if items[i] == str(name): 1861 # self.formfactorbox.SetSelection(i) 1862 # break 1857 1863 break 1858 1864 … … 1952 1958 Fill panel's combo box according to the type of model selected 1953 1959 """ 1954 if self.shape_rbutton.GetValue():1955 ##fill the combobox with form factor list1956 self.structurebox.SetSelection(0)1957 self.structurebox.Disable()1958 1959 1960 1961 if self.shape_indep_rbutton.GetValue():1962 ##fill the combobox with shape independent factor list1963 self.structurebox.SetSelection(0)1964 self.structurebox.Disable()1965 self.formfactorbox.Clear()1966 self._populate_box(self.formfactorbox,1967 self.model_list_box["Shape-Independent"])1968 if self.struct_rbutton.GetValue():1969 ##fill the combobox with structure factor list1970 self.structurebox.SetSelection(0)1971 self.structurebox.Disable()1972 1973 self._populate_box(self.formfactorbox,1974 self.model_list_box["Structure Factors"])1975 if self.plugin_rbutton.GetValue():1976 ##fill the combobox with form factor list1977 self.structurebox.Disable()1978 1979 self._populate_box(self.formfactorbox,1980 self.model_list_box["Customized Models"])1960 # if self.shape_rbutton.GetValue(): 1961 # ##fill the combobox with form factor list 1962 # self.structurebox.SetSelection(0) 1963 # self.structurebox.Disable() 1964 # # self.formfactorbox.Clear() 1965 # # self._populate_box(self.formfactorbox, 1966 # # self.model_list_box["Shapes"]) 1967 # if self.shape_indep_rbutton.GetValue(): 1968 # ##fill the combobox with shape independent factor list 1969 # self.structurebox.SetSelection(0) 1970 # self.structurebox.Disable() 1971 # # self.formfactorbox.Clear() 1972 # self._populate_box(self.formfactorbox, 1973 # self.model_list_box["Shape-Independent"]) 1974 # if self.struct_rbutton.GetValue(): 1975 # ##fill the combobox with structure factor list 1976 # self.structurebox.SetSelection(0) 1977 # self.structurebox.Disable() 1978 # # self.formfactorbox.Clear() 1979 # self._populate_box(self.formfactorbox, 1980 # self.model_list_box["Structure Factors"]) 1981 # if self.plugin_rbutton.GetValue(): 1982 # ##fill the combobox with form factor list 1983 # self.structurebox.Disable() 1984 # # self.formfactorbox.Clear() 1985 # self._populate_box(self.formfactorbox, 1986 # self.model_list_box["Customized Models"]) 1981 1987 1982 1988 def _show_combox(self, event=None): … … 1994 2000 self.Refresh() 1995 2001 1996 def _populate_box(self, combobox, list):2002 def _populate_box(self, combobox, model_list): 1997 2003 """ 1998 2004 fill combox box with dict item … … 2002 2008 """ 2003 2009 mlist = [] 2004 for models in list:2010 for models in model_list: 2005 2011 model = models() 2006 2012 name = model.__class__.__name__ … … 2133 2139 """ 2134 2140 ## reset dictionary containing reference to dispersion 2141 if self.model_name == None: 2142 return 2143 2135 2144 self._disp_obj_dict = {} 2136 2145 self.disp_cb_dict = {} 2137 2146 self.temp_multi_functional = False 2138 f_id = self.formfactorbox.GetCurrentSelection() 2139 #For MAC 2140 form_factor = None 2141 if f_id >= 0: 2142 form_factor = self.formfactorbox.GetClientData(f_id) 2147 2148 form_factor = self.model_dict[self.model_name] 2143 2149 2144 2150 if not form_factor in self.model_list_box["multiplication"]: … … 2154 2160 self.text2.Enable() 2155 2161 2162 2163 2156 2164 if form_factor != None: 2157 2165 # set multifactor for Mutifunctional models … … 2331 2339 return flag 2332 2340 2333 def _check_value_enter(self, list, modified):2334 """ 2335 :param list: model parameter and panel info2336 :Note: each item of the list should be as follow:2341 def _check_value_enter(self, m_list, modified): 2342 """ 2343 :param m_list: model parameter and panel info 2344 :Note: each item of the m_list should be as follow: 2337 2345 item=[check button state, parameter's name, 2338 2346 paramater's value, string="+/-", … … 2343 2351 """ 2344 2352 is_modified = modified 2345 if len( list) == 0:2353 if len(m_list) == 0: 2346 2354 return is_modified 2347 for item in list:2355 for item in m_list: 2348 2356 #skip angle parameters for 1D 2349 2357 if not self.enable2D: … … 2895 2903 if self.model == None: 2896 2904 name = 'FuncHelp' 2897 else: 2898 name = self.formfactorbox.GetValue() 2905 2899 2906 frame = HelpWindow(None, -1, pageToOpen=model_path) 2900 2907 # If model name exists and model is not a custom model 2901 if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue():2902 frame.Show(True)2903 frame.rhelp.ScrollToAnchor(name)2904 else:2905 if self.model != None:2906 frame.Destroy()2907 msg = 'Model description:\n'2908 if str(self.model.description).rstrip().lstrip() == '':2909 msg += "Sorry, no information is available for this model."2910 else:2911 msg += self.model.description + '\n'2912 info = "Info"2913 wx.MessageBox(msg, info)2914 else:2915 frame.Show(True)2908 # if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue(): 2909 # frame.Show(True) 2910 # frame.rhelp.ScrollToAnchor(name) 2911 # else: 2912 # if self.model != None: 2913 # frame.Destroy() 2914 # msg = 'Model description:\n' 2915 # if str(self.model.description).rstrip().lstrip() == '': 2916 # msg += "Sorry, no information is available for this model." 2917 # else: 2918 # msg += self.model.description + '\n' 2919 # info = "Info" 2920 # wx.MessageBox(msg, info) 2921 # else: 2922 # frame.Show(True) 2916 2923 2917 2924 def on_pd_help_clicked(self, event): … … 3290 3297 return 3291 3298 3299 def _read_category_info(self): 3300 """ 3301 Reads the categories in from file 3302 """ 3303 3304 # # ILL mod starts here - July 2012 kieranrcampbell@gmail.com 3305 self.master_category_dict = defaultdict(list) 3306 self.by_model_dict = defaultdict(list) 3307 self.model_enabled_dict = defaultdict(bool) 3308 3309 categorization_file = CategoryInstaller.get_user_file() 3310 3311 3312 try: 3313 cat_file = open(categorization_file, 'rb') 3314 3315 self.master_category_dict = pickle.load(cat_file) 3316 self._regenerate_model_dict() 3317 3318 except IOError: 3319 print 'Problem reading in category file.' 3320 print 'We even looked for it, made sure it was there.' 3321 print 'An existential crisis if there ever was one.' 3322 3323 def _regenerate_model_dict(self): 3324 """ 3325 regenerates self.by_model_dict which has each model name as the 3326 key and the list of categories belonging to that model 3327 along with the enabled mapping 3328 """ 3329 3330 self.by_model_dict = defaultdict(list) 3331 for category in self.master_category_dict: 3332 for (model,enabled) in self.master_category_dict[category]: 3333 self.by_model_dict[model].append(category) 3334 self.model_enabled_dict[model] = enabled 3335 3336 def _populate_listbox(self): 3337 """ 3338 fills out the category list box 3339 """ 3340 self._read_category_info() 3341 3342 self.category_box.Clear() 3343 cat_list = sorted(self.master_category_dict.keys()) 3344 cat_list.append('Customized') 3345 3346 for category in cat_list: 3347 if category != '': 3348 self.category_box.Append(category) 3349 3350 if self.category_box.GetSelection() == wx.NOT_FOUND: 3351 self.category_box.SetSelection(0) 3352 else: 3353 self.category_box.SetSelection( \ 3354 self.category_box.GetSelection()) 3355 3356 self._on_change_cat(None) 3357 3358 3359 def _on_change_cat(self, event): 3360 """ 3361 Callback for category change action 3362 """ 3363 self.model_name = None 3364 category = self.category_box.GetStringSelection() 3365 if category == None: 3366 return 3367 self.model_box.Clear() 3368 3369 if category == 'Customized': 3370 for model in self.model_list_box["Customized Models"]: 3371 str_m = str(model).split(".")[0] 3372 self.model_box.Append(str_m) 3373 print 'but not here' 3374 3375 else: 3376 for (model,enabled) in sorted(self.master_category_dict[category], 3377 key = lambda name: name[0]): 3378 if(enabled): 3379 self.model_box.Append(model) 3380 3292 3381 def _fill_model_sizer(self, sizer): 3293 3382 """ 3294 3383 fill sizer containing model info 3295 3384 """ 3385 3296 3386 ##Add model function Details button in fitpanel. 3297 3387 ##The following 3 lines are for Mac. Let JHC know before modifying... … … 3311 3401 hint = "toggle view of model from 1D to 2D or 2D to 1D" 3312 3402 self.model_view.SetToolTipString(hint) 3313 3314 self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes', 3315 style=wx.RB_GROUP) 3316 self.shape_indep_rbutton = wx.RadioButton(self, -1, 3317 "Shape-Independent") 3318 self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ") 3319 self.plugin_rbutton = wx.RadioButton(self, -1, "Customized Models") 3320 3321 self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3322 id=self.shape_rbutton.GetId()) 3323 self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3324 id=self.shape_indep_rbutton.GetId()) 3325 self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3326 id=self.struct_rbutton.GetId()) 3327 self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3328 id=self.plugin_rbutton.GetId()) 3329 #MAC needs SetValue 3330 self.shape_rbutton.SetValue(True) 3331 3403 3404 3405 # ILL mod starts here - Aug 2012 3406 3407 3408 cat_text = wx.StaticText(self, -1, 'Category') 3409 mod_text = wx.StaticText(self, -1, 'Model') 3410 3411 id = wx.NewId() 3412 self.category_box = wx.ListBox(self, size=(150, 100)) 3413 self.category_box.Bind(wx.EVT_LISTBOX, self._on_change_cat) 3414 self.model_box = wx.ListBox(self, -1, size=(150, 100)) 3415 self.model_box.Bind(wx.EVT_LISTBOX, self._on_select_model) 3416 3332 3417 sizer_radiobutton = wx.GridSizer(2, 3, 5, 5) 3333 sizer_radiobutton.Add(self.shape_rbutton) 3334 sizer_radiobutton.Add(self.shape_indep_rbutton) 3335 sizer_radiobutton.Add(self.model_view, 1, wx.LEFT, 20) 3336 sizer_radiobutton.Add(self.plugin_rbutton) 3337 sizer_radiobutton.Add(self.struct_rbutton) 3338 sizer_radiobutton.Add(self.model_help, 1, wx.LEFT, 20) 3339 3418 hbox1 = wx.BoxSizer(wx.HORIZONTAL) 3419 hbox2 = wx.BoxSizer(wx.HORIZONTAL) 3420 vbox1 = wx.BoxSizer(wx.VERTICAL) 3421 vbox2 = wx.BoxSizer(wx.VERTICAL) 3422 vbox3 = wx.BoxSizer(wx.VERTICAL) 3423 3424 vbox1.Add(cat_text, border = 5, flag = wx.EXPAND | wx.ALL) 3425 vbox2.Add(mod_text, border=5, flag = wx.EXPAND | wx.ALL) 3426 vbox3.Add(self.model_view, flag= wx.ALL | wx.ALIGN_LEFT 3427 , border =5) 3428 vbox1.Add(self.category_box, border = 5, flag = wx.EXPAND | wx.ALL) 3429 vbox2.Add(self.model_box, flag = wx.EXPAND | wx.ALL, border = 5) 3430 vbox3.Add(self.model_help, border = 5, 3431 flag = wx.LEFT | wx.ALIGN_LEFT ) 3432 3433 hbox1.Add(vbox1, border = 5, flag = wx.EXPAND | wx.ALL) 3434 hbox1.Add(vbox2, border = 5, flag = wx.EXPAND | wx.ALL) 3435 hbox1.Add(vbox3, border = 5, flag = wx.EXPAND | wx.ALL) 3436 3340 3437 sizer_selection = wx.BoxSizer(wx.HORIZONTAL) 3341 3438 mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL) 3342 3439 3343 3440 self.text1 = wx.StaticText(self, -1, "") 3344 self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q) ")3441 self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q) ") 3345 3442 self.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ") 3346 3443 self.mutifactor_text1 = wx.StaticText(self, -1, "") … … 3348 3445 self.show_sld_button.Bind(wx.EVT_BUTTON, self._on_show_sld) 3349 3446 3350 self.formfactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)3351 if self.model != None:3352 self.formfactorbox.SetValue(self.model.name)3353 3447 self.structurebox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3354 3448 self.multifactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3355 3449 self.initialize_combox() 3356 wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model)3357 3450 3358 3451 wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model) 3359 3452 wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model) 3360 3453 ## check model type to show sizer 3454 3455 hbox2.Add(self.text2, border = 5, flag = wx.EXPAND | wx.ALL ) 3456 hbox2.Add(self.structurebox, border = 5, flag = wx.EXPAND | \ 3457 wx.ALL ) 3458 3361 3459 if self.model != None: 3362 3460 self._set_model_sizer_selection(self.model) 3363 3461 3364 sizer_selection.Add(self.text1) 3365 sizer_selection.Add((5, 5)) 3366 sizer_selection.Add(self.formfactorbox) 3367 sizer_selection.Add((5, 5)) 3368 sizer_selection.Add(self.text2) 3369 sizer_selection.Add((5, 5)) 3370 sizer_selection.Add(self.structurebox) 3462 self._populate_listbox() 3463 3371 3464 3372 3465 mutifactor_selection.Add((10, 5)) … … 3378 3471 mutifactor_selection.Add(self.show_sld_button) 3379 3472 3380 boxsizer1.Add(sizer_radiobutton) 3473 boxsizer1.Add(hbox1, flag = wx.EXPAND) 3474 boxsizer1.Add(hbox2, flag = wx.EXPAND) 3381 3475 boxsizer1.Add((10, 10)) 3382 boxsizer1.Add(sizer_selection) 3383 boxsizer1.Add((10, 10)) 3476 3384 3477 boxsizer1.Add(mutifactor_selection) 3385 3478 -
fittingview/src/sans/perspectives/fitting/fitpage.py
re4cd34c rdf7a7e3 36 36 """ 37 37 38 def __init__(self, parent, color='rand'):38 def __init__(self, parent, m_dict, color='rand'): 39 39 """ 40 40 Initialization of the Panel 41 41 """ 42 42 BasicPage.__init__(self, parent, color=color) 43 43 self.populate_box(m_dict) 44 44 45 ## draw sizer 45 46 self._fill_data_sizer() … … 67 68 #create a default data for an empty panel 68 69 self.create_default_data() 69 70 70 71 def enable_fit_button(self): 71 72 """ … … 1087 1088 call back for model selection 1088 1089 """ 1090 # if we're just clearing the box then do nothing 1091 if self.model_box.GetCount() == 0 or \ 1092 self.model_box.GetStringSelection() == '': 1093 return 1094 1095 1089 1096 self.Show(False) 1090 1097 copy_flag = False 1091 1098 is_poly_enabled = None 1092 1099 if event != None: 1093 if (event.GetEventObject() == self.formfactorbox\ 1094 and self.structurebox.GetLabel() != 'None')\ 1095 or event.GetEventObject() == self.structurebox\ 1096 or event.GetEventObject() == self.multifactorbox: 1097 copy_flag = self.get_copy_params() 1098 is_poly_enabled = self.enable_disp.GetValue() 1099 1100 # if (event.GetEventObject() == self.formfactorbox\ 1101 # and self.structurebox.GetLabel() != 'None')\ 1102 # or event.GetEventObject() == self.structurebox\ 1103 # or event.GetEventObject() == self.multifactorbox: 1104 copy_flag = self.get_copy_params() 1105 is_poly_enabled = self.enable_disp.GetValue() 1106 1107 self.model_name = self.model_box.GetStringSelection() 1100 1108 self._on_select_model_helper() 1101 1109 self.set_model_param_sizer(self.model) … … 1116 1124 1117 1125 self.state.structurecombobox = self.structurebox.GetLabel() 1118 self.state.formfactorcombobox = self. formfactorbox.GetLabel()1126 self.state.formfactorcombobox = self.model_box.GetStringSelection() 1119 1127 self.enable_fit_button() 1120 1128 if self.model != None: … … 1175 1183 wx.PostEvent(self.parent, new_event) 1176 1184 #update list of plugins if new plugin is available 1177 if self.plugin_rbutton.GetValue():1178 temp = self.parent.update_model_list()1179 if temp:1180 self.model_list_box = temp1181 current_val = self.formfactorbox.GetLabel()1182 pos = self.formfactorbox.GetSelection()1183 self._show_combox_helper()1184 self.formfactorbox.SetSelection(pos)1185 self.formfactorbox.SetValue(current_val)1185 # if self.plugin_rbutton.GetValue(): 1186 # temp = self.parent.update_model_list() 1187 # if temp: 1188 # self.model_list_box = temp 1189 # current_val = self.formfactorbox.GetLabel() 1190 # pos = self.formfactorbox.GetSelection() 1191 # self._show_combox_helper() 1192 # self.formfactorbox.SetSelection(pos) 1193 # self.formfactorbox.SetValue(current_val) 1186 1194 # when select a model only from guictr/button 1187 1195 if is_poly_enabled != None: … … 1814 1822 self.dI_idata.Enable(True) 1815 1823 1816 self.formfactorbox.Enable()1824 # self.formfactorbox.Enable() 1817 1825 self.structurebox.Enable() 1818 1826 data_name = self.data.name -
fittingview/src/sans/perspectives/fitting/fitpanel.py
rf32d144 rdf7a7e3 48 48 self.menu_mng = models.ModelManager() 49 49 self.model_list_box = self.menu_mng.get_model_list() 50 self.model_dictionary = self.menu_mng.get_model_dictionary() 50 51 #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 51 52 self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE … … 304 305 page.set_manager(self._manager) 305 306 306 def set_model_list(self, dict):307 def set_model_list(self, m_dict): 307 308 """ 308 309 copy a dictionary of model into its own dictionary 309 310 310 :param dict: dictionnary made of model name as key and model class311 :param m_dict: dictionnary made of model name as key and model class 311 312 as value 312 313 """ 313 self.model_list_box = dict 314 314 self.model_list_box = m_dict 315 316 def set_model_dict(self, m_dict): 317 """ 318 copy a dictionary of model name -> model object 319 320 :param m_dict: dictionary linking model name -> model object 321 """ 322 315 323 def get_current_page(self): 316 324 """ … … 360 368 else: 361 369 """ 370 362 371 from fitpage import FitPage 363 panel = FitPage(parent=self) 372 panel = FitPage(parent=self, m_dict = self.model_list_box) 373 364 374 if self.batch_on: 365 375 self.batch_page_index += 1 … … 373 383 panel.batch_on = self.batch_on 374 384 panel._set_save_flag(not panel.batch_on) 375 panel. populate_box(dict=self.model_list_box)385 panel.set_model_dictionary(self.model_dictionary) 376 386 panel.set_manager(self._manager) 377 387 panel.window_caption = caption -
fittingview/src/sans/perspectives/fitting/fitting.py
r162c778 rdf7a7e3 52 52 else: 53 53 ON_MAC = True 54 54 55 55 56 -
fittingview/src/sans/perspectives/fitting/models.py
rf40f743 rdf7a7e3 18 18 # as the base class of plug-in models. 19 19 from sans.models.pluginmodel import Model1DPlugin 20 from sans.models.BaseComponent import BaseComponent 20 21 21 22 PLUGIN_DIR = 'plugin_models' 23 24 def get_model_python_path(): 25 return os.path.dirname(__file__) 22 26 23 27 … … 261 265 """ 262 266 """ 267 self.model_dictionary = {} 263 268 self.stored_plugins = {} 264 269 self._getModelList() … … 283 288 284 289 """ 290 291 285 292 # regular model names only 286 293 self.model_name_list = [] 287 294 from sans.models.SphereModel import SphereModel 295 self.model_dictionary[SphereModel.__name__] = SphereModel 288 296 self.shape_list.append(SphereModel) 289 297 self.multiplication_factor.append(SphereModel) … … 291 299 292 300 from sans.models.BinaryHSModel import BinaryHSModel 301 self.model_dictionary[BinaryHSModel.__name__] = BinaryHSModel 293 302 self.shape_list.append(BinaryHSModel) 294 303 self.model_name_list.append(BinaryHSModel.__name__) 295 304 296 305 from sans.models.FuzzySphereModel import FuzzySphereModel 306 self.model_dictionary[FuzzySphereModel.__name__] = FuzzySphereModel 297 307 self.shape_list.append(FuzzySphereModel) 298 308 self.multiplication_factor.append(FuzzySphereModel) … … 300 310 301 311 from sans.models.RaspBerryModel import RaspBerryModel 312 self.model_dictionary[RaspBerryModel.__name__] = RaspBerryModel 302 313 self.shape_list.append(RaspBerryModel) 303 314 self.model_name_list.append(RaspBerryModel.__name__) 304 315 305 316 from sans.models.CoreShellModel import CoreShellModel 317 self.model_dictionary[CoreShellModel.__name__] = CoreShellModel 306 318 self.shape_list.append(CoreShellModel) 307 319 self.multiplication_factor.append(CoreShellModel) … … 309 321 310 322 from sans.models.Core2ndMomentModel import Core2ndMomentModel 323 self.model_dictionary[Core2ndMomentModel.__name__] = Core2ndMomentModel 311 324 self.shape_list.append(Core2ndMomentModel) 312 325 self.model_name_list.append(Core2ndMomentModel.__name__) 313 326 314 327 from sans.models.CoreMultiShellModel import CoreMultiShellModel 328 self.model_dictionary[CoreMultiShellModel.__name__] = CoreMultiShellModel 315 329 self.shape_list.append(CoreMultiShellModel) 316 330 self.multiplication_factor.append(CoreMultiShellModel) … … 318 332 319 333 from sans.models.VesicleModel import VesicleModel 334 self.model_dictionary[VesicleModel.__name__] = VesicleModel 320 335 self.shape_list.append(VesicleModel) 321 336 self.multiplication_factor.append(VesicleModel) … … 323 338 324 339 from sans.models.MultiShellModel import MultiShellModel 340 self.model_dictionary[MultiShellModel.__name__] = MultiShellModel 325 341 self.shape_list.append(MultiShellModel) 326 342 self.multiplication_factor.append(MultiShellModel) … … 328 344 329 345 from sans.models.OnionExpShellModel import OnionExpShellModel 346 self.model_dictionary[OnionExpShellModel.__name__] = OnionExpShellModel 330 347 self.shape_list.append(OnionExpShellModel) 331 348 self.multiplication_factor.append(OnionExpShellModel) … … 333 350 334 351 from sans.models.SphericalSLDModel import SphericalSLDModel 352 self.model_dictionary[SphericalSLDModel.__name__] = SphericalSLDModel 335 353 self.shape_list.append(SphericalSLDModel) 336 354 self.multiplication_factor.append(SphericalSLDModel) … … 339 357 340 358 from sans.models.LinearPearlsModel import LinearPearlsModel 359 self.model_dictionary[LinearPearlsModel.__name__] = LinearPearlsModel 341 360 self.shape_list.append(LinearPearlsModel) 342 361 self.model_name_list.append(LinearPearlsModel.__name__) 343 362 344 363 from sans.models.PearlNecklaceModel import PearlNecklaceModel 364 self.model_dictionary[PearlNecklaceModel.__name__] = PearlNecklaceModel 345 365 self.shape_list.append(PearlNecklaceModel) 346 366 self.model_name_list.append(PearlNecklaceModel.__name__) … … 348 368 349 369 from sans.models.CylinderModel import CylinderModel 370 self.model_dictionary[CylinderModel.__name__] = CylinderModel 350 371 self.shape_list.append(CylinderModel) 351 372 self.multiplication_factor.append(CylinderModel) … … 353 374 354 375 from sans.models.CoreShellCylinderModel import CoreShellCylinderModel 376 self.model_dictionary[CoreShellCylinderModel.__name__] = CoreShellCylinderModel 355 377 self.shape_list.append(CoreShellCylinderModel) 356 378 self.multiplication_factor.append(CoreShellCylinderModel) … … 358 380 359 381 from sans.models.CoreShellBicelleModel import CoreShellBicelleModel 382 self.model_dictionary[CoreShellBicelleModel.__name__] = CoreShellBicelleModel 360 383 self.shape_list.append(CoreShellBicelleModel) 361 384 self.multiplication_factor.append(CoreShellBicelleModel) … … 363 386 364 387 from sans.models.HollowCylinderModel import HollowCylinderModel 388 self.model_dictionary[HollowCylinderModel.__name__] = HollowCylinderModel 365 389 self.shape_list.append(HollowCylinderModel) 366 390 self.multiplication_factor.append(HollowCylinderModel) … … 368 392 369 393 from sans.models.FlexibleCylinderModel import FlexibleCylinderModel 394 self.model_dictionary[FlexibleCylinderModel.__name__] = FlexibleCylinderModel 370 395 self.shape_list.append(FlexibleCylinderModel) 371 396 self.model_name_list.append(FlexibleCylinderModel.__name__) 372 397 373 398 from sans.models.FlexCylEllipXModel import FlexCylEllipXModel 399 self.model_dictionary[FlexCylEllipXModel.__name__] = FlexCylEllipXModel 374 400 self.shape_list.append(FlexCylEllipXModel) 375 401 self.model_name_list.append(FlexCylEllipXModel.__name__) 376 402 377 403 from sans.models.StackedDisksModel import StackedDisksModel 404 self.model_dictionary[StackedDisksModel.__name__] = StackedDisksModel 378 405 self.shape_list.append(StackedDisksModel) 379 406 self.multiplication_factor.append(StackedDisksModel) … … 381 408 382 409 from sans.models.ParallelepipedModel import ParallelepipedModel 410 self.model_dictionary[ParallelepipedModel.__name__] = ParallelepipedModel 383 411 self.shape_list.append(ParallelepipedModel) 384 412 self.multiplication_factor.append(ParallelepipedModel) … … 386 414 387 415 from sans.models.CSParallelepipedModel import CSParallelepipedModel 416 self.model_dictionary[CSParallelepipedModel.__name__] = CSParallelepipedModel 388 417 self.shape_list.append(CSParallelepipedModel) 389 418 self.multiplication_factor.append(CSParallelepipedModel) … … 391 420 392 421 from sans.models.EllipticalCylinderModel import EllipticalCylinderModel 422 self.model_dictionary[EllipticalCylinderModel.__name__] = EllipticalCylinderModel 393 423 self.shape_list.append(EllipticalCylinderModel) 394 424 self.multiplication_factor.append(EllipticalCylinderModel) … … 396 426 397 427 from sans.models.BarBellModel import BarBellModel 428 self.model_dictionary[BarBellModel.__name__] = BarBellModel 398 429 self.shape_list.append(BarBellModel) 399 430 self.model_name_list.append(BarBellModel.__name__) … … 402 433 403 434 from sans.models.CappedCylinderModel import CappedCylinderModel 435 self.model_dictionary[CappedCylinderModel.__name__] = CappedCylinderModel 404 436 self.shape_list.append(CappedCylinderModel) 405 437 self.model_name_list.append(CappedCylinderModel.__name__) … … 408 440 409 441 from sans.models.EllipsoidModel import EllipsoidModel 442 self.model_dictionary[EllipsoidModel.__name__] = EllipsoidModel 410 443 self.shape_list.append(EllipsoidModel) 411 444 self.multiplication_factor.append(EllipsoidModel) … … 413 446 414 447 from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel 448 self.model_dictionary[CoreShellEllipsoidModel.__name__] = CoreShellEllipsoidModel 415 449 self.shape_list.append(CoreShellEllipsoidModel) 416 450 self.multiplication_factor.append(CoreShellEllipsoidModel) … … 418 452 419 453 from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel 454 self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel 420 455 self.shape_list.append(TriaxialEllipsoidModel) 421 456 self.multiplication_factor.append(TriaxialEllipsoidModel) … … 423 458 424 459 from sans.models.LamellarModel import LamellarModel 460 self.model_dictionary[LamellarModel.__name__] = LamellarModel 425 461 self.shape_list.append(LamellarModel) 426 462 self.model_name_list.append(LamellarModel.__name__) 427 463 428 464 from sans.models.LamellarFFHGModel import LamellarFFHGModel 465 self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel 429 466 self.shape_list.append(LamellarFFHGModel) 430 467 self.model_name_list.append(LamellarFFHGModel.__name__) 431 468 432 469 from sans.models.LamellarPSModel import LamellarPSModel 470 self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel 433 471 self.shape_list.append(LamellarPSModel) 434 472 self.model_name_list.append(LamellarPSModel.__name__) 435 473 436 474 from sans.models.LamellarPSHGModel import LamellarPSHGModel 475 self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel 437 476 self.shape_list.append(LamellarPSHGModel) 438 477 self.model_name_list.append(LamellarPSHGModel.__name__) 439 478 440 479 from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 480 self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel 441 481 self.shape_list.append(LamellarPCrystalModel) 442 482 self.model_name_list.append(LamellarPCrystalModel.__name__) 443 483 444 484 from sans.models.SCCrystalModel import SCCrystalModel 485 self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel 445 486 self.shape_list.append(SCCrystalModel) 446 487 self.model_name_list.append(SCCrystalModel.__name__) 447 488 448 489 from sans.models.FCCrystalModel import FCCrystalModel 490 self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel 449 491 self.shape_list.append(FCCrystalModel) 450 492 self.model_name_list.append(FCCrystalModel.__name__) 451 493 452 494 from sans.models.BCCrystalModel import BCCrystalModel 495 self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel 453 496 self.shape_list.append(BCCrystalModel) 454 497 self.model_name_list.append(BCCrystalModel.__name__) … … 456 499 ## Structure factor 457 500 from sans.models.SquareWellStructure import SquareWellStructure 501 self.model_dictionary[SquareWellStructure.__name__] = SquareWellStructure 458 502 self.struct_list.append(SquareWellStructure) 459 503 self.model_name_list.append(SquareWellStructure.__name__) 460 504 461 505 from sans.models.HardsphereStructure import HardsphereStructure 506 self.model_dictionary[HardsphereStructure.__name__] = HardsphereStructure 462 507 self.struct_list.append(HardsphereStructure) 463 508 self.model_name_list.append(HardsphereStructure.__name__) 464 509 465 510 from sans.models.StickyHSStructure import StickyHSStructure 511 self.model_dictionary[StickyHSStructure.__name__] = StickyHSStructure 466 512 self.struct_list.append(StickyHSStructure) 467 513 self.model_name_list.append(StickyHSStructure.__name__) 468 514 469 515 from sans.models.HayterMSAStructure import HayterMSAStructure 516 self.model_dictionary[HayterMSAStructure.__name__] = HayterMSAStructure 470 517 self.struct_list.append(HayterMSAStructure) 471 518 self.model_name_list.append(HayterMSAStructure.__name__) … … 474 521 ##shape-independent models 475 522 from sans.models.PowerLawAbsModel import PowerLawAbsModel 523 self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel 476 524 self.shape_indep_list.append(PowerLawAbsModel) 477 525 self.model_name_list.append(PowerLawAbsModel.__name__) 478 526 479 527 from sans.models.BEPolyelectrolyte import BEPolyelectrolyte 528 self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte 480 529 self.shape_indep_list.append(BEPolyelectrolyte) 481 530 self.model_name_list.append(BEPolyelectrolyte.__name__) … … 483 532 484 533 from sans.models.BroadPeakModel import BroadPeakModel 534 self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel 485 535 self.shape_indep_list.append(BroadPeakModel) 486 536 self.model_name_list.append(BroadPeakModel.__name__) 487 537 488 538 from sans.models.CorrLengthModel import CorrLengthModel 539 self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel 489 540 self.shape_indep_list.append(CorrLengthModel) 490 541 self.model_name_list.append(CorrLengthModel.__name__) 491 542 492 543 from sans.models.DABModel import DABModel 544 self.model_dictionary[DABModel.__name__] = DABModel 493 545 self.shape_indep_list.append(DABModel) 494 546 self.model_name_list.append(DABModel.__name__) 495 547 496 548 from sans.models.DebyeModel import DebyeModel 549 self.model_dictionary[DebyeModel.__name__] = DebyeModel 497 550 self.shape_indep_list.append(DebyeModel) 498 551 self.model_name_list.append(DebyeModel.__name__) 499 552 500 553 from sans.models.FractalModel import FractalModel 554 self.model_dictionary[FractalModel.__name__] = FractalModel 501 555 self.shape_indep_list.append(FractalModel) 502 556 self.model_name_list.append(FractalModel.__name__) 503 557 504 558 from sans.models.FractalCoreShellModel import FractalCoreShellModel 559 self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel 505 560 self.shape_indep_list.append(FractalCoreShellModel) 506 561 self.model_name_list.append(FractalCoreShellModel.__name__) 507 562 508 563 from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 564 self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel 509 565 self.shape_indep_list.append(GaussLorentzGelModel) 510 566 self.model_name_list.append(GaussLorentzGelModel.__name__) 511 567 512 568 from sans.models.GuinierModel import GuinierModel 569 self.model_dictionary[GuinierModel.__name__] = GuinierModel 513 570 self.shape_indep_list.append(GuinierModel) 514 571 self.model_name_list.append(GuinierModel.__name__) 515 572 516 573 from sans.models.GuinierPorodModel import GuinierPorodModel 574 self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel 517 575 self.shape_indep_list.append(GuinierPorodModel) 518 576 self.model_name_list.append(GuinierPorodModel.__name__) 519 577 520 578 from sans.models.LorentzModel import LorentzModel 579 self.model_dictionary[LorentzModel.__name__] = LorentzModel 521 580 self.shape_indep_list.append(LorentzModel) 522 581 self.model_name_list.append(LorentzModel.__name__) 523 582 524 583 from sans.models.MassFractalModel import MassFractalModel 584 self.model_dictionary[MassFractalModel.__name__] = MassFractalModel 525 585 self.shape_indep_list.append(MassFractalModel) 526 586 self.model_name_list.append(MassFractalModel.__name__) 527 587 528 588 from sans.models.MassSurfaceFractal import MassSurfaceFractal 589 self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal 529 590 self.shape_indep_list.append(MassSurfaceFractal) 530 591 self.model_name_list.append(MassSurfaceFractal.__name__) 531 592 532 593 from sans.models.PeakGaussModel import PeakGaussModel 594 self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel 533 595 self.shape_indep_list.append(PeakGaussModel) 534 596 self.model_name_list.append(PeakGaussModel.__name__) 535 597 536 598 from sans.models.PeakLorentzModel import PeakLorentzModel 599 self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel 537 600 self.shape_indep_list.append(PeakLorentzModel) 538 601 self.model_name_list.append(PeakLorentzModel.__name__) 539 602 540 603 from sans.models.Poly_GaussCoil import Poly_GaussCoil 604 self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil 541 605 self.shape_indep_list.append(Poly_GaussCoil) 542 606 self.model_name_list.append(Poly_GaussCoil.__name__) 543 607 544 608 from sans.models.PolymerExclVolume import PolymerExclVolume 609 self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume 545 610 self.shape_indep_list.append(PolymerExclVolume) 546 611 self.model_name_list.append(PolymerExclVolume.__name__) 547 612 548 613 from sans.models.PorodModel import PorodModel 614 self.model_dictionary[PorodModel.__name__] = PorodModel 549 615 self.shape_indep_list.append(PorodModel) 550 616 self.model_name_list.append(PorodModel.__name__) 551 617 552 618 from sans.models.RPA10Model import RPA10Model 619 self.model_dictionary[RPA10Model.__name__] = RPA10Model 553 620 self.shape_indep_list.append(RPA10Model) 554 621 self.multi_func_list.append(RPA10Model) 555 622 556 623 from sans.models.StarPolymer import StarPolymer 624 self.model_dictionary[StarPolymer.__name__] = StarPolymer 557 625 self.shape_indep_list.append(StarPolymer) 558 626 self.model_name_list.append(StarPolymer.__name__) 559 627 560 628 from sans.models.SurfaceFractalModel import SurfaceFractalModel 629 self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel 561 630 self.shape_indep_list.append(SurfaceFractalModel) 562 631 self.model_name_list.append(SurfaceFractalModel.__name__) 563 632 564 633 from sans.models.TeubnerStreyModel import TeubnerStreyModel 634 self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel 565 635 self.shape_indep_list.append(TeubnerStreyModel) 566 636 self.model_name_list.append(TeubnerStreyModel.__name__) 567 637 568 638 from sans.models.TwoLorentzianModel import TwoLorentzianModel 639 self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel 569 640 self.shape_indep_list.append(TwoLorentzianModel) 570 641 self.model_name_list.append(TwoLorentzianModel.__name__) 571 642 572 643 from sans.models.TwoPowerLawModel import TwoPowerLawModel 644 self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel 573 645 self.shape_indep_list.append(TwoPowerLawModel) 574 646 self.model_name_list.append(TwoPowerLawModel.__name__) 575 647 576 648 from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel 649 self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel 577 650 self.shape_indep_list.append(UnifiedPowerRgModel) 578 651 self.multi_func_list.append(UnifiedPowerRgModel) 579 652 580 653 from sans.models.LineModel import LineModel 654 self.model_dictionary[LineModel.__name__] = LineModel 581 655 self.shape_indep_list.append(LineModel) 582 656 self.model_name_list.append(LineModel.__name__) 583 657 584 658 from sans.models.ReflectivityModel import ReflectivityModel 659 self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel 585 660 self.shape_indep_list.append(ReflectivityModel) 586 661 self.multi_func_list.append(ReflectivityModel) 587 662 588 663 from sans.models.ReflectivityIIModel import ReflectivityIIModel 664 self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel 589 665 self.shape_indep_list.append(ReflectivityIIModel) 590 666 self.multi_func_list.append(ReflectivityIIModel) 591 667 592 668 from sans.models.GelFitModel import GelFitModel 669 self.model_dictionary[GelFitModel.__name__] = GelFitModel 593 670 self.shape_indep_list.append(GelFitModel) 594 671 self.model_name_list.append(GelFitModel.__name__) 595 672 673 #from sans.models.FractalO_Z import FractalO_Z 674 #self.model_dictionary[FractalO_Z.__name__] = FractalO_Z 675 #self.shape_indep_list.append(FractalO_Z) 676 #self.model_name_list.append(FractalO_Z.__name__) 677 596 678 #Looking for plugins 597 679 self.stored_plugins = self.findModels() … … 792 874 if int(evt.GetId()) in self.form_factor_dict.keys(): 793 875 from sans.models.MultiplicationModel import MultiplicationModel 876 self.model_dictionary[MultiplicationModel.__name__] = MultiplicationModel 794 877 model1, model2 = self.form_factor_dict[int(evt.GetId())] 795 878 model = MultiplicationModel(model1, model2) … … 836 919 """ 837 920 return self.model_name_list 921 922 def get_model_dictionary(self): 923 """ 924 return dictionary linking model names to objects 925 """ 926 return self.model_dictionary 838 927 839 928 … … 873 962 def get_model_name_list(self): 874 963 return self.__modelmanager.get_model_name_list() 964 965 def get_model_dictionary(self): 966 return self.__modelmanager.get_model_dictionary()
Note: See TracChangeset
for help on using the changeset viewer.