- Timestamp:
- Nov 13, 2018 7:25:48 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- baeac95
- Parents:
- 133812c7
- Location:
- src/sas/qtgui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r133812c7 re5ae812 457 457 self.chkBatch.setChecked(True if value=='True' else False) 458 458 continue 459 if 'cs_tab' in key: 460 continue 459 461 # send newly created items to the perspective 460 462 self.updatePerspectiveWithProperties(key, value) … … 462 464 # See if there are any batch pages defined and create them, if so 463 465 self.updateWithBatchPages(all_data) 466 467 # Only now can we create/assign C&S pages. 468 for key, value in all_data.items(): 469 if 'cs_tab' in key: 470 self.updatePerspectiveWithProperties(key, value) 464 471 465 472 def updateWithBatchPages(self, all_data): … … 488 495 self._perspective().setData(data_item=items, is_batch=True) 489 496 self._perspective().updateFromParameters(page) 490 491 497 pass 492 498 … … 494 500 """ 495 501 """ 496 data_dict = {key:value['fit_data']} 497 # Create new model items in the data explorer 498 items = self.updateModelFromData(data_dict) 502 if 'fit_data' in value: 503 data_dict = {key:value['fit_data']} 504 # Create new model items in the data explorer 505 items = self.updateModelFromData(data_dict) 499 506 500 507 if 'fit_params' in value: … … 512 519 # Assign parameters to the most recent (current) page. 513 520 self._perspective().updateFromParameters(page) 521 if 'cs_tab' in key and 'is_constraint' in value: 522 # Create a C&S page 523 self._perspective().addConstraintTab() 524 # Modify the tab 525 self._perspective().updateFromParameters(value) 526 514 527 pass # debugger 515 528 -
src/sas/qtgui/MainWindow/GuiManager.py
r133812c7 re5ae812 594 594 analysis[id] = data_content 595 595 596 # standalone constraint pages 597 for keys, values in params.items(): 598 if not 'is_constraint' in values[0]: 599 continue 600 analysis[keys] = values[0] 601 596 602 with open(filename, 'w') as outfile: 597 603 GuiUtils.saveData(outfile, analysis) … … 1177 1183 out_f.write("#Application appearance custom configuration\n") 1178 1184 for key, item in config.__dict__.items(): 1179 if key[:2] != "__": 1180 if isinstance(item, str): 1181 item = '"' + item + '"' 1182 out_f.write("%s = %s\n" % (key, str(item))) 1185 if key[:2] == "__": 1186 continue 1187 if isinstance(item, str): 1188 item = '"' + item + '"' 1189 out_f.write("%s = %s\n" % (key, str(item))) 1183 1190 pass # debugger anchor -
src/sas/qtgui/Perspectives/Fitting/ConstraintWidget.py
raed0532 re5ae812 31 31 # To keep with previous SasView values, use 300 as the start offset 32 32 self.page_id = 301 33 self.tab_id = self.page_id 33 34 34 35 # Are we chain fitting? … … 693 694 # Update the tab 694 695 constrained_tab.addConstraintToRow(constraint, constrained_row) 696 697 def getFitPage(self): 698 """ 699 Retrieves the state of this page 700 """ 701 param_list = [] 702 703 param_list.append(['is_constraint', 'True']) 704 param_list.append(['data_id', "cs_tab"+str(self.page_id)]) 705 param_list.append(['current_type', self.currentType]) 706 param_list.append(['is_chain_fitting', str(self.is_chain_fitting)]) 707 param_list.append(['special_case', self.cbCases.currentText()]) 708 709 return param_list 710 711 def getFitModel(self): 712 """ 713 Retrieves current model 714 """ 715 model_list = [] 716 717 checked_models = {} 718 for row in range(self.tblTabList.rowCount()): 719 model_name = self.tblTabList.item(row,1).data(0) 720 active = self.tblTabList.item(row,0).checkState()# == QtCore.Qt.Checked 721 checked_models[model_name] = str(active) 722 723 checked_constraints = {} 724 for row in range(self.tblConstraints.rowCount()): 725 model_name = self.tblConstraints.item(row,0).data(0) 726 active = self.tblConstraints.item(row,0).checkState()# == QtCore.Qt.Checked 727 checked_constraints[model_name] = str(active) 728 729 model_list.append(['checked_models', checked_models]) 730 model_list.append(['checked_constraints', checked_constraints]) 731 return model_list 732 733 def createPageForParameters(self, parameters=None): 734 """ 735 Update the page with passed parameter values 736 """ 737 # checked models 738 if not 'checked_models' in parameters: 739 return 740 models = parameters['checked_models'][0] 741 for model, check_state in models.items(): 742 for row in range(self.tblTabList.rowCount()): 743 model_name = self.tblTabList.item(row,1).data(0) 744 if model_name != model: 745 continue 746 # check/uncheck item 747 self.tblTabList.item(row,0).setCheckState(int(check_state)) 748 749 if not 'checked_constraints' in parameters: 750 return 751 # checked constraints 752 models = parameters['checked_constraints'][0] 753 for model, check_state in models.items(): 754 for row in range(self.tblConstraints.rowCount()): 755 model_name = self.tblConstraints.item(row,0).data(0) 756 if model_name != model: 757 continue 758 # check/uncheck item 759 self.tblConstraints.item(row,0).setCheckState(int(check_state)) 760 761 # fit/batch radio 762 isBatch = parameters['current_type'][0] == 'BatchPage' 763 if isBatch: 764 self.btnBatch.toggle() 765 766 # chain 767 is_chain = parameters['is_chain_fitting'][0] == 'True' 768 if isBatch: 769 self.chkChain.setChecked(is_chain) 770 771 -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
rebcdb02 re5ae812 39 39 self.maxIndex = 1 40 40 41 ## Index of the current tab42 #self.currentTab = 043 44 41 # The default optimizer 45 42 self.optimizer = 'Levenberg-Marquardt' … … 121 118 for i, tab in enumerate(self.tabs): 122 119 tab_data = self.getSerializedFitpage(tab) 123 if tab.tab_id is None: continue124 120 if 'data_id' not in tab_data: continue 125 121 id = tab_data['data_id'][0] -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r133812c7 re5ae812 1952 1952 Emits plotRequestedSignal for all plots found in the given model under the provided item name. 1953 1953 """ 1954 fitpage_name = "" if self.tab_id is None else "M"+str(self.tab_id)1954 fitpage_name = self.kernel_module.name 1955 1955 plots = GuiUtils.plotsFromFilename(item_name, item_model) 1956 1956 # Has the fitted data been shown? … … 3524 3524 param_list.append(['data_name', filenames]) 3525 3525 param_list.append(['data_id', data_ids]) 3526 param_list.append(['tab_name', self.modelName()]) 3526 3527 # option tab 3527 3528 param_list.append(['q_range_min', str(self.q_range_min)]) … … 3596 3597 except: 3597 3598 pass 3598 3599 param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max]) 3599 # Do we have any constraints on this parameter? 3600 constraint = self.getConstraintForRow(row) 3601 cons = () 3602 if constraint is not None: 3603 value = constraint.value 3604 func = constraint.func 3605 cons = (value, func) 3606 3607 param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max, cons]) 3600 3608 3601 3609 def gatherPolyParams(row): … … 3705 3713 self.updateMultiplicityCombo(multip) 3706 3714 3715 if 'tab_name' in line_dict.keys(): 3716 self.kernel_module.name = line_dict['tab_name'][0] 3707 3717 if 'polydisperse_params' in line_dict.keys(): 3708 3718 self.chkPolydispersity.setChecked(line_dict['polydisperse_params'][0]=='True') … … 3827 3837 ioffset = 0 3828 3838 joffset = 0 3829 if len(param_dict[param_name])> 4:3839 if len(param_dict[param_name])>5: 3830 3840 # error values are not editable - no need to update 3831 3841 ioffset = 1 … … 3840 3850 except: 3841 3851 pass 3852 3853 # constraints 3854 cons = param_dict[param_name][4+ioffset] 3855 if cons is not None and cons: 3856 value = cons[0] 3857 function = cons[1] 3858 constraint = Constraint() 3859 constraint.value = value 3860 constraint.func = function 3861 self.addConstraintToRow(constraint=constraint, row=row) 3842 3862 3843 3863 self.setFocus()
Note: See TracChangeset
for help on using the changeset viewer.