Changeset 1bc27f1 in sasview for src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
- Timestamp:
- May 11, 2017 4:53:22 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:
- d60da0c
- Parents:
- 672b8ab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r672b8ab r1bc27f1 1 import sys2 1 import json 3 2 import os 4 import numpy as np5 3 from collections import defaultdict 6 4 from itertools import izip … … 9 7 import traceback 10 8 from twisted.internet import threads 9 import numpy as np 11 10 12 11 from PyQt4 import QtGui … … 28 27 from sas.sasgui.perspectives.fitting.utils import get_weight 29 28 30 from UI.FittingWidgetUI import Ui_FittingWidgetUI29 from sas.qtgui.Perspectives.Fitting.UI.FittingWidgetUI import Ui_FittingWidgetUI 31 30 from sas.qtgui.Perspectives.Fitting.FittingLogic import FittingLogic 32 31 from sas.qtgui.Perspectives.Fitting import FittingUtilities 33 from SmearingWidget import SmearingWidget34 from OptionsWidget import OptionsWidget35 from FitPage import FitPage32 from sas.qtgui.Perspectives.Fitting.SmearingWidget import SmearingWidget 33 from sas.qtgui.Perspectives.Fitting.OptionsWidget import OptionsWidget 34 from sas.qtgui.Perspectives.Fitting.FitPage import FitPage 36 35 37 36 TAB_MAGNETISM = 4 … … 45 44 Main widget for selecting form and structure factor models 46 45 """ 47 def __init__(self, parent=None, data=None, id=1):46 def __init__(self, parent=None, data=None, tab_id=1): 48 47 49 48 super(FittingWidget, self).__init__() … … 81 80 82 81 # Which tab is this widget displayed in? 83 self.tab_id = id82 self.tab_id = tab_id 84 83 85 84 # Which shell is being currently displayed? … … 98 97 layout = QtGui.QGridLayout() 99 98 self.options_widget = OptionsWidget(self, self.logic) 100 layout.addWidget(self.options_widget) 99 layout.addWidget(self.options_widget) 101 100 self.tabOptions.setLayout(layout) 102 101 … … 104 103 layout = QtGui.QGridLayout() 105 104 self.smearing_widget = SmearingWidget(self) 106 layout.addWidget(self.smearing_widget) 105 layout.addWidget(self.smearing_widget) 107 106 self.tabResolution.setLayout(layout) 108 107 109 108 # Define bold font for use in various controls 110 self.boldFont =QtGui.QFont()109 self.boldFont = QtGui.QFont() 111 110 self.boldFont.setBold(True) 112 111 … … 315 314 """ 316 315 msg = 'Model description:\n' 317 info = "Info"318 316 if self.kernel_module is not None: 319 317 if str(self.kernel_module.description).rstrip().lstrip() == '': … … 358 356 self.createDefaultDataset() 359 357 360 state = self.currentState() 358 # TODO: update state stack 359 #state = self.currentState() 361 360 362 361 def onSelectStructureFactor(self): … … 403 402 # Retrieve the list of models 404 403 model_list = self.master_category_dict[category] 405 models = []406 404 # Populate the models combobox 407 405 self.cbModel.addItems(sorted([model for (model, _) in model_list])) … … 538 536 if res.fitness is None or \ 539 537 not np.isfinite(res.fitness) or \ 540 np.any(res.pvec ==None) or \538 np.any(res.pvec is None) or \ 541 539 not np.all(np.isfinite(res.pvec)): 542 540 msg = "Fitting did not converge!!!" … … 638 636 # Regardless of previous state, this should now be `plot show` functionality only 639 637 self.cmdPlot.setText("Show Plot") 638 if not self.data_is_loaded: 639 self.recalculatePlotData() 640 640 self.showPlot() 641 641 … … 690 690 elif self.log_points: 691 691 qmin = -10.0 if self.q_range_min < 1.e-10 else np.log10(self.q_range_min) 692 qmax = 692 qmax = 10.0 if self.q_range_max > 1.e10 else np.log10(self.q_range_max) 693 693 interval = np.logspace(start=qmin, stop=qmax, num=self.npts, endpoint=True, base=10.0) 694 694 else: 695 695 interval = np.linspace(start=self.q_range_min, stop=self.q_range_max, 696 num=self.npts, endpoint=True)696 num=self.npts, endpoint=True) 697 697 self.logic.createDefault1dData(interval, self.tab_id) 698 698 … … 754 754 """ 755 755 Adds weighting contribution to fitting data 756 #"""756 """ 757 757 # Send original data for weighting 758 758 weight = get_weight(data=data, is2d=self.is2D, flag=self.weighting) … … 856 856 self.kernel_module.params[parameter_name] = value 857 857 858 # TODO: update min/max based on property_name 858 859 # min/max to be changed in self.kernel_module.details[parameter_name] = ['Ang', 0.0, inf] 859 860 # magnetic params in self.kernel_module.details['M0:parameter_name'] = value … … 882 883 self._model_model.blockSignals(True) 883 884 # Convert to proper indices and set requested enablement 884 items= [self._model_model.item(row, 0).setCheckState(status) for row in rows]885 _ = [self._model_model.item(row, 0).setCheckState(status) for row in rows] 885 886 self._model_model.blockSignals(False) 886 887 … … 966 967 # Awful API to a backend method. 967 968 method = self.methodCalculateForData()(data=self.data, 968 model=self.kernel_module,969 page_id=0,970 qmin=self.q_range_min,971 qmax=self.q_range_max,972 smearer=None,973 state=None,974 weight=None,975 fid=None,976 toggle_mode_on=False,977 completefn=None,978 update_chisqr=True,979 exception_handler=self.calcException,980 source=None)969 model=self.kernel_module, 970 page_id=0, 971 qmin=self.q_range_min, 972 qmax=self.q_range_max, 973 smearer=None, 974 state=None, 975 weight=None, 976 fid=None, 977 toggle_mode_on=False, 978 completefn=None, 979 update_chisqr=True, 980 exception_handler=self.calcException, 981 source=None) 981 982 982 983 calc_thread = threads.deferToThread(method.compute)
Note: See TracChangeset
for help on using the changeset viewer.