Changeset 6a9559d in sasview
- Timestamp:
- Feb 16, 2017 9:41:02 AM (8 years ago)
- Branches:
- 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
- Children:
- 1228007
- Parents:
- d84bc69 (diff), 2bb20a5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/qtgui/Perspectives/Fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/UI/FittingUI.ui
rd84bc69 r6a9559d 15 15 </property> 16 16 <property name="windowIcon"> 17 <iconset resource="../../../UI/main_resources.qrc">17 <iconset> 18 18 <normaloff>:/res/ball.ico</normaloff>:/res/ball.ico</iconset> 19 19 </property> … … 646 646 </layout> 647 647 </widget> 648 <resources> 649 <include location="../../../UI/main_resources.qrc"/> 650 </resources> 648 <resources/> 651 649 <connections/> 652 650 </ui> -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r83d6249 rd84bc69 1 1 import sys 2 import json 3 import os 2 4 from PyQt4 import QtGui 3 5 from PyQt4 import QtCore 4 6 5 7 from UI.FittingUI import Ui_FittingUI 8 9 from sasmodels import generate 10 from sasmodels import modelinfo 11 12 from collections import defaultdict 13 from sas.sasgui.guiframe.CategoryInstaller import CategoryInstaller 6 14 7 15 class FittingWindow(QtGui.QDialog, Ui_FittingUI): … … 13 21 self.setupUi(self) 14 22 23 self._readCategoryInfo() 24 cat_list = sorted(self.master_category_dict.keys()) 25 self.comboBox.addItems(cat_list) 15 26 self.tableView.setModel(self._model_model) 16 self.setModelModel() 27 28 model_list = self.master_category_dict['Cylinder'] 29 for (model, enabled) in model_list: 30 self.comboBox_2.addItem(model) 31 self.setModelModel('barbell') 17 32 18 33 self.pushButton.setEnabled(False) … … 35 50 self.tableView_2.setIndexWidget(i,c) 36 51 52 def _readCategoryInfo(self): 53 """ 54 Reads the categories in from file 55 """ 56 self.master_category_dict = defaultdict(list) 57 self.by_model_dict = defaultdict(list) 58 self.model_enabled_dict = defaultdict(bool) 59 60 try: 61 categorization_file = CategoryInstaller.get_user_file() 62 if not os.path.isfile(categorization_file): 63 categorization_file = CategoryInstaller.get_default_file() 64 cat_file = open(categorization_file, 'rb') 65 self.master_category_dict = json.load(cat_file) 66 self._regenerate_model_dict() 67 cat_file.close() 68 except IOError: 69 raise 70 print 'Problem reading in category file.' 71 print 'We even looked for it, made sure it was there.' 72 print 'An existential crisis if there ever was one.' 73 74 def _regenerate_model_dict(self): 75 """ 76 regenerates self.by_model_dict which has each model name as the 77 key and the list of categories belonging to that model 78 along with the enabled mapping 79 """ 80 self.by_model_dict = defaultdict(list) 81 for category in self.master_category_dict: 82 for (model, enabled) in self.master_category_dict[category]: 83 self.by_model_dict[model].append(category) 84 self.model_enabled_dict[model] = enabled 85 37 86 38 def setModelModel(self ):87 def setModelModel(self, model_name): 39 88 # Crete/overwrite model items 40 89 41 parameters=[] 42 p=["scale", "1", "0", "inf", ""] 43 for i in xrange(1): 44 #for parameter in parameters.keys(): 45 item1 = QtGui.QStandardItem("background") 90 model_name = str(model_name) 91 kernel_module = generate.load_kernel_module(model_name) 92 parameters = modelinfo.make_parameter_table(getattr(kernel_module, 'parameters', [])) 93 94 #TODO: scaale and background are implicit in sasmodels and needs to be added 95 item1 = QtGui.QStandardItem('scale') 96 item1.setCheckable(True) 97 item2 = QtGui.QStandardItem('1.0') 98 item3 = QtGui.QStandardItem('0.0') 99 item4 = QtGui.QStandardItem('inf') 100 item5 = QtGui.QStandardItem('') 101 self._model_model.appendRow([item1, item2, item3, item4, item5]) 102 103 item1 = QtGui.QStandardItem('background') 104 item1.setCheckable(True) 105 item2 = QtGui.QStandardItem('0.001') 106 item3 = QtGui.QStandardItem('-inf') 107 item4 = QtGui.QStandardItem('inf') 108 item5 = QtGui.QStandardItem('1/cm') 109 self._model_model.appendRow([item1, item2, item3, item4, item5]) 110 111 #TODO: iq_parameters are used here. If orientation paramateres or magnetic are needed kernel_paramters should be used instead 112 #For orientation and magentic parameters param.type needs to be checked 113 for param in parameters.iq_parameters: 114 item1 = QtGui.QStandardItem(param.name) 46 115 item1.setCheckable(True) 47 item2 = QtGui.QStandardItem("0.001") 48 item3 = QtGui.QStandardItem("-inf") 49 item4 = QtGui.QStandardItem("inf") 50 item5 = QtGui.QStandardItem("1/cm") 51 self._model_model.appendRow([item1, item2, item3, item4, item5]) 52 53 item1 = QtGui.QStandardItem("l_radius") 54 item1.setCheckable(True) 55 item2 = QtGui.QStandardItem("100") 56 item3 = QtGui.QStandardItem("0") 57 item4 = QtGui.QStandardItem("inf") 58 item5 = QtGui.QStandardItem("A") 59 self._model_model.appendRow([item1, item2, item3, item4, item5]) 60 61 item1 = QtGui.QStandardItem("ls_sld") 62 item1.setCheckable(True) 63 item2 = QtGui.QStandardItem("3.5e-06") 64 item3 = QtGui.QStandardItem("0") 65 item4 = QtGui.QStandardItem("inf") 66 item5 = QtGui.QStandardItem("1/A^2") 67 self._model_model.appendRow([item1, item2, item3, item4, item5]) 68 69 item1 = QtGui.QStandardItem("s_radius") 70 item1.setCheckable(True) 71 item2 = QtGui.QStandardItem("25") 72 item3 = QtGui.QStandardItem("0") 73 item4 = QtGui.QStandardItem("inf") 74 item5 = QtGui.QStandardItem("A") 75 self._model_model.appendRow([item1, item2, item3, item4, item5]) 76 77 item1 = QtGui.QStandardItem("solvent_sld") 78 item1.setCheckable(True) 79 item2 = QtGui.QStandardItem("6.36e-06") 80 item3 = QtGui.QStandardItem("0") 81 item4 = QtGui.QStandardItem("inf") 82 item5 = QtGui.QStandardItem("1/A^2") 83 self._model_model.appendRow([item1, item2, item3, item4, item5]) 84 85 item1 = QtGui.QStandardItem("vol_frac_ls") 86 item1.setCheckable(True) 87 item2 = QtGui.QStandardItem("0.1") 88 item3 = QtGui.QStandardItem("0") 89 item4 = QtGui.QStandardItem("inf") 90 item5 = QtGui.QStandardItem("") 116 item2 = QtGui.QStandardItem(str(param.default)) 117 item3 = QtGui.QStandardItem(str(param.limits[0])) 118 item4 = QtGui.QStandardItem(str(param.limits[1])) 119 item5 = QtGui.QStandardItem(param.units) 91 120 self._model_model.appendRow([item1, item2, item3, item4, item5]) 92 121
Note: See TracChangeset
for help on using the changeset viewer.