Changeset f1f3e6a in sasview for src/sas/qtgui/Perspectives/Invariant
- Timestamp:
- Nov 13, 2017 9:34:45 AM (7 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:
- 7c487846
- Parents:
- 1543f0c
- Location:
- src/sas/qtgui/Perspectives/Invariant
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Invariant/InvariantDetails.py
- Property mode changed from 100644 to 100755
r4992ff2 rf1f3e6a 2 2 import os 3 3 from PyQt5 import QtCore 4 from PyQt5 import QtGui 5 from PyQt5 import QtWidgets 4 from PyQt5 import QtGui, QtWidgets 6 5 7 6 # local … … 9 8 from .InvariantUtils import WIDGETS 10 9 10 # ERROR_COLOR = wx.Colour(255, 0, 0, 128) 11 # EXTRAPOLATION_COLOR = wx.Colour(169, 169, 168, 128) 12 # INVARIANT_COLOR = wx.Colour(67, 208, 128, 128) 13 11 14 class DetailsDialog(QtWidgets.QDialog, Ui_Dialog): 12 15 """ 16 This class stores some values resulting from invariant calculations. 17 Given the value of total invariant, this class can also 18 determine the percentage of invariants resulting from extrapolation. 13 19 """ 14 20 def __init__(self, parent): … … 17 23 self.setupUi(self) 18 24 19 self.progressBar.setMinimum(0) 20 self.progressBar.setMaximum(100) 25 DEFAULT_STYLE = """ 26 QProgressBar{ 27 border: 2px solid grey; 28 border-radius: 5px; 29 text-align: center 30 } 21 31 22 self.progressBar_2.setMinimum(0) 23 self.progressBar_2.setMaximum(100) 32 QProgressBar::chunk { 33 background-color: #b1daf9; 34 width: 10px; 35 margin: 1px; 36 } 37 """ 38 self.progressBarLowQ.setStyleSheet(DEFAULT_STYLE) 39 self.progressBarData.setStyleSheet(DEFAULT_STYLE) 40 self.progressBarHighQ.setStyleSheet(DEFAULT_STYLE) 24 41 25 self.progressBar_3.setMinimum(0) 26 self.progressBar_3.setMaximum(100) 42 self.progressBarLowQ.setMinimum(0) 43 self.progressBarLowQ.setMaximum(100) 44 45 self.progressBarData.setMinimum(0) 46 self.progressBarData.setMaximum(100) 47 48 self.progressBarHighQ.setMinimum(0) 49 self.progressBarHighQ.setMaximum(100) 50 51 # Modify font in order to display Angstrom symbol correctly 52 new_font = 'font-family: -apple-system, "Helvetica Neue", "Ubuntu";' 53 self.lblQLowQUnits.setStyleSheet(new_font) 54 self.lblQDataUnits.setStyleSheet(new_font) 55 self.lblQHighQUnits.setStyleSheet(new_font) 56 57 self.cmdOK.clicked.connect(self.accept) 58 59 self.warning_msg = "No Details on calculations available...\n" 60 61 # invariant total 62 self.qstar_total = None 63 self.qhigh = None 64 self.qlow = None 65 self._model = None 66 67 self.progress_low_qstar = 0.0 68 self.progress_high_qstar = 0.0 69 self.progress_qstar = 100.0 27 70 28 71 def setModel(self, model): 29 """ 30 """ 72 """ """ 31 73 self._model = model 32 74 33 75 def showDialog(self): 34 """ 35 """ 76 """ Fill the dialog with values of calculated Q, progress bars""" 36 77 # Pull out data from the model 37 qstar_total = float(self._model.item(WIDGETS.W_INVARIANT).text()) 38 self.lineEdit_3.setText(str(qstar_total)) 39 self.lineEdit_4.setText(self._model.item(WIDGETS.W_INVARIANT_ERR).text()) 78 self.qstar_total = float(self._model.item(WIDGETS.W_INVARIANT).text()) 40 79 41 progress_low_qstar = 0.0 42 progress_high_qstar = 0.0 43 progress_qstar = 100.0 80 self.txtQData.setText(str(self.qstar_total)) 81 self.txtQDataErr.setText(self._model.item(WIDGETS.W_INVARIANT_ERR).text()) 44 82 83 # Low-Q 45 84 if self._model.item(WIDGETS.W_ENABLE_LOWQ).text() == "true": 46 qlow = float(self._model.item(WIDGETS.D_LOW_QSTAR).text()) 47 self.lineEdit.setText(str(qlow)) 48 self.lineEdit_2.setText(self._model.item(WIDGETS.D_LOW_QSTAR_ERR).text()) 49 progress_low_qstar = (qlow/qstar_total)*100.0 85 self.qlow = float(self._model.item(WIDGETS.D_LOW_QSTAR).text()) 50 86 87 self.txtQLowQ.setText(str(self.qlow)) 88 self.txtQLowQErr.setText(self._model.item(WIDGETS.D_LOW_QSTAR_ERR).text()) 89 try: 90 self.progress_low_qstar = (self.qlow/self.qstar_total)*100.0 91 except: 92 self.progress_low_qstar = 'error' 93 94 # High-Q 51 95 if self._model.item(WIDGETS.W_ENABLE_HIGHQ).text() == "true": 52 qhigh = float(self._model.item(WIDGETS.D_LOW_QSTAR).text()) 53 self.lineEdit.setText(str(qhigh)) 54 self.lineEdit_2.setText(self._model.item(WIDGETS.D_HIGH_QSTAR_ERR).text()) 55 progress_high_qstar = (qhigh/qstar_total)*100.0 96 self.qhigh = float(self._model.item(WIDGETS.D_HIGH_QSTAR).text()) 56 97 98 self.txtQHighQ.setText(str(self.qhigh)) 99 self.txtQHighQErr.setText(self._model.item(WIDGETS.D_HIGH_QSTAR_ERR).text()) 100 try: 101 self.progress_high_qstar = (self.qhigh/self.qstar_total)*100.0 102 except: 103 self.progress_high_qstar = 'error' 57 104 58 progress_qstar -= progress_low_qstar + progress_high_qstar 105 try: 106 self.progress_qstar -= self.progress_low_qstar + self.progress_high_qstar 107 except: 108 self.progress_qstar = 'error' 59 109 60 self.progressBar.setValue(progress_low_qstar)61 self.progressBar_2.setValue(progress_qstar)62 self.progressBar_3.setValue(progress_high_qstar)110 # check values and display warning 111 if self.checkValues(): 112 self.lblWarning.setText(self.checkValues()) 63 113 64 new_font = 'font-family: -apple-system, "Helvetica Neue", "Ubuntu";' 65 self.label_3.setStyleSheet(new_font) 66 self.label_4.setStyleSheet(new_font) 67 self.label_7.setStyleSheet(new_font) 114 # update progress bars 115 if self.progress_low_qstar == 'error': 116 self.progressBarLowQ.setValue(0) 117 else: 118 self.progressBarLowQ.setValue(self.progress_low_qstar) 119 120 if self.progress_high_qstar == 'error': 121 self.progressBarHighQ.setValue(0) 122 else: 123 self.progressBarHighQ.setValue(self.progress_high_qstar) 124 125 if self.progress_qstar == 'error': 126 self.progressBarData.setValue(0) 127 else: 128 self.progressBarData.setValue(self.progress_qstar) 68 129 69 130 self.show() 131 132 def checkValues(self): 133 """ 134 Create a warning message to be displayed in panel 135 if problems with values 136 """ 137 138 if self.qstar_total is None: 139 warning_msg = "Invariant not calculated.\n" 140 return warning_msg 141 elif self.qstar_total == 0: 142 warning_msg = "Invariant is zero. \n " \ 143 "The calculations are likely to be unreliable!\n" 144 return warning_msg 145 146 msg = '' 147 if self.progress_qstar == 'error': 148 msg += 'Error occurred when computing invariant from data.\n ' 149 if self.progress_qstar > 100: 150 msg += "Invariant Q contribution is greater than 100% .\n" 151 152 if self.progress_low_qstar == 'error': 153 try: 154 float(self.qlow) 155 except: 156 msg += "Error occurred when computing extrapolated invariant" 157 msg += " at low-Q region.\n" 158 159 elif self.progress_low_qstar is not None: 160 if self.progress_low_qstar >= 5: 161 msg += "Extrapolated contribution at Low Q is higher " 162 msg += "than 5% of the invariant.\n" 163 elif self.progress_low_qstar < 0: 164 msg += "Extrapolated contribution at Low Q < 0.\n" 165 elif self.progress_low_qstar > 100: 166 msg += "Extrapolated contribution at Low Q is greater " 167 msg += "than 100% .\n" 168 169 # High-Q 170 if self.progress_high_qstar == 'error': 171 try: 172 float(self.qhigh) 173 except: 174 msg += 'Error occurred when computing extrapolated' 175 msg += ' invariant at high-Q region.\n' 176 177 elif self.progress_high_qstar is not None: 178 if self.progress_high_qstar >= 5: 179 msg += "Extrapolated contribution at High Q is higher " \ 180 "than 5% of the invariant.\n" 181 elif self.progress_high_qstar < 0: 182 183 msg += "Extrapolated contribution at High Q < 0.\n" 184 elif self.progress_high_qstar > 100: 185 186 msg += "Extrapolated contribution at High Q is greater " \ 187 "than 100% .\n" 188 189 if (self.progress_low_qstar not in [None, "error"]) and \ 190 (self.progress_high_qstar not in [None, "error"])\ 191 and self.progress_low_qstar + self.progress_high_qstar >= 5: 192 193 msg += "The sum of all extrapolated contributions is higher " \ 194 "than 5% of the invariant.\n" 195 196 return msg -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
- Property mode changed from 100644 to 100755
r4992ff2 rf1f3e6a 2 2 import sys 3 3 import os 4 import logging 5 import copy 6 import webbrowser 7 4 8 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 7 from PyQt5 import QtWebKitWidgets 9 from PyQt5 import QtGui, QtWidgets 10 from PyQt5 import QtWebKit 8 11 9 12 from twisted.internet import threads … … 14 17 from sas.qtgui.Plotting.PlotterData import Data1D 15 18 import sas.qtgui.Utilities.GuiUtils as GuiUtils 19 20 # import sas.qtgui.Plotting.PlotHelper as PlotHelper 16 21 17 22 # local … … 26 31 # the ratio of maximum q value/(qmax of data) to plot the theory data 27 32 Q_MAXIMUM_PLOT = 3 28 29 30 class MyModel(object): 31 def __init__(self): 32 self._model = QtGui.QStandardItemModel(self) 33 34 def addItem(self, item): 35 item = QtGui.QStandardItem(str(item)) 36 self._model.appendRow(item) 33 # Default number of points of interpolation: high and low range 34 NPOINTS_Q_INTERP = 10 35 # Default power law for interpolation 36 DEFAULT_POWER_LOW = 4 37 38 # Background of line edits if settings OK or wrong 39 BG_WHITE = "background-color: rgb(255, 255, 255);" 40 BG_RED = "background-color: rgb(244, 170, 164);" 37 41 38 42 class InvariantWindow(QtWidgets.QDialog, Ui_tabbedInvariantUI): 39 43 # The controller which is responsible for managing signal slots connections 40 44 # for the gui and providing an interface to the data model. 41 name = "Invariant" # For displaying in the combo box42 #def __init__(self, manager=None, parent=None): 45 name = "Invariant" # For displaying in the combo box in DataExplorer 46 43 47 def __init__(self, parent=None): 44 #super(InvariantWindow, self).__init__(parent)45 48 super(InvariantWindow, self).__init__() 46 49 self.setupUi(self) … … 52 55 self._scale = 1.0 53 56 self._contrast = 1.0 54 self._porod = 1.0 55 self._npoints_low = 10 56 self._npoints_high = 10 57 self._power_low = 4 57 self._porod = None 58 59 self.parent = parent 58 60 59 61 self._manager = parent 60 #self._manager = manager61 62 self._reactor = reactor 62 63 self._model_item = QtGui.QStandardItem() 63 64 64 self._helpView = QtWebKitWidgets.QWebView()65 #self._helpView = QtWebKit.QWebView() 65 66 self.detailsDialog = DetailsDialog(self) 67 self.detailsDialog.cmdOK.clicked.connect(self.enabling) 66 68 67 69 self._low_extrapolate = False 68 self._low_guinier = True 69 self._low_fit = True 70 self._low_guinier = True 71 self._low_fit = False 72 self._low_power_value = False 73 self._low_points = NPOINTS_Q_INTERP 74 self._low_power_value = DEFAULT_POWER_LOW 75 70 76 self._high_extrapolate = False 71 self._high_power_value = False 77 self._high_power_value = False 78 self._high_fit = False 79 self._high_points = NPOINTS_Q_INTERP 80 self._high_power_value = DEFAULT_POWER_LOW 72 81 73 82 # no reason to have this widget resizable 74 83 self.setFixedSize(self.minimumSizeHint()) 75 84 76 self.communicate = GuiUtils.Communicate()85 self.communicate = self._manager.communicator() 77 86 78 87 self._data = None … … 81 90 self._allow_close = False 82 91 83 # Mask file selector 84 ################################################### 85 #self._path = "cyl_400_20.txt" 86 #from sas.sascalc.dataloader.loader import Loader 87 #loader = Loader() 88 #try: 89 # self._data = loader.load(self._path) 90 #except: 91 # raise 92 ################################################### 93 94 self.lineEdit_8.setText(str(Q_MINIMUM)) 95 self.lineEdit_9.setText(str(Q_MAXIMUM)) 92 # Modify font in order to display Angstrom symbol correctly 93 new_font = 'font-family: -apple-system, "Helvetica Neue", "Ubuntu";' 94 self.lblTotalQUnits.setStyleSheet(new_font) 95 self.lblSpecificSurfaceUnits.setStyleSheet(new_font) 96 self.lblInvariantTotalQUnits.setStyleSheet(new_font) 97 self.lblContrastUnits.setStyleSheet(new_font) 98 self.lblPorodCstUnits.setStyleSheet(new_font) 99 self.lblExtrapolQUnits.setStyleSheet(new_font) 100 101 # To remove blue square around line edits 102 self.txtBackgd.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 103 self.txtContrast.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 104 self.txtScale.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 105 self.txtPorodCst.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 106 self.txtNptsHighQ.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 107 self.txtNptsLowQ.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 108 self.txtPowerLowQ.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 109 self.txtPowerHighQ.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 110 111 self.txtExtrapolQMin.setText(str(Q_MINIMUM)) 112 self.txtExtrapolQMax.setText(str(Q_MAXIMUM)) 96 113 97 114 # Let's choose the Standard Item Model. … … 108 125 self.setupMapper() 109 126 110 new_font = 'font-family: -apple-system, "Helvetica Neue", "Ubuntu";' 111 self.label_2.setStyleSheet(new_font) 112 self.label_24.setStyleSheet(new_font) 113 self.label_27.setStyleSheet(new_font) 127 # validator: double 128 self.txtBackgd.setValidator(QtGui.QDoubleValidator()) 129 self.txtContrast.setValidator(QtGui.QDoubleValidator()) 130 self.txtScale.setValidator(QtGui.QDoubleValidator()) 131 self.txtPorodCst.setValidator(QtGui.QDoubleValidator()) 132 133 # validator: integer number 134 valid_regex_int = QtCore.QRegExp('^[+]?(\d+[.][0]*)$') 135 self.txtNptsLowQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 136 self.txtNptsLowQ)) 137 self.txtNptsHighQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 138 self.txtNptsHighQ)) 139 self.txtPowerLowQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 140 self.txtPowerLowQ)) 141 self.txtPowerHighQ.setValidator(QtGui.QRegExpValidator(valid_regex_int, 142 self.txtPowerHighQ)) 143 144 def enabling(self): 145 """ """ 146 self.cmdStatus.setEnabled(True) 114 147 115 148 def setClosable(self, value=True): 116 """ 117 Allow outsiders close this widget 118 """ 149 """ Allow outsiders close this widget """ 119 150 assert isinstance(value, bool) 120 151 … … 134 165 self.setWindowState(QtCore.Qt.WindowMinimized) 135 166 136 def communicator(self):137 """ Getter for the communicator """138 return self.communicate139 140 167 def updateFromModel(self): 141 """ 142 update the globals based on the data in the model 143 """ 168 """ Update the globals based on the data in the model """ 144 169 self._background = float(self.model.item(WIDGETS.W_BACKGROUND).text()) 145 self._contrast = float(self.model.item(WIDGETS.W_CONTRAST).text()) 146 self._scale = float(self.model.item(WIDGETS.W_SCALE).text()) 147 148 # High extrapolate 149 self._low_extrapolate = ( str(self.model.item(WIDGETS.W_ENABLE_LOWQ).text()) == 'true') 170 self._contrast = float(self.model.item(WIDGETS.W_CONTRAST).text()) 171 self._scale = float(self.model.item(WIDGETS.W_SCALE).text()) 172 if self.model.item(WIDGETS.W_POROD_CST).text() != 'None' \ 173 and self.model.item(WIDGETS.W_POROD_CST).text() != '': 174 self._porod = float(self.model.item(WIDGETS.W_POROD_CST).text()) 175 176 # Low extrapolating 177 self._low_extrapolate = str(self.model.item(WIDGETS.W_ENABLE_LOWQ).text()) == 'true' 150 178 self._low_points = float(self.model.item(WIDGETS.W_NPTS_LOWQ).text()) 151 self._low_guinier = ( str(self.model.item(WIDGETS.W_LOWQ_GUINIER).text()) == 'true')152 self._low_fit = ( str(self.model.item(WIDGETS.W_LOWQ_FIT).text()) == 'true')153 self._low_power_value 179 self._low_guinier = str(self.model.item(WIDGETS.W_LOWQ_GUINIER).text()) == 'true' 180 self._low_fit = str(self.model.item(WIDGETS.W_LOWQ_FIT).text()) == 'true' 181 self._low_power_value = float(self.model.item(WIDGETS.W_LOWQ_POWER_VALUE).text()) 154 182 155 183 # High extrapolating 156 self._high_extrapolate = ( str(self.model.item(WIDGETS.W_ENABLE_HIGHQ).text()) == 'true')157 self._high_points 158 self._high_fit = ( str(self.model.item(WIDGETS.W_HIGHQ_FIT).text()) == 'true')159 self._high_power_value 184 self._high_extrapolate = str(self.model.item(WIDGETS.W_ENABLE_HIGHQ).text()) == 'true' 185 self._high_points = float(self.model.item(WIDGETS.W_NPTS_HIGHQ).text()) 186 self._high_fit = str(self.model.item(WIDGETS.W_HIGHQ_FIT).text()) == 'true' 187 self._high_power_value = float(self.model.item(WIDGETS.W_HIGHQ_POWER_VALUE).text()) 160 188 161 189 def calculateInvariant(self): 162 """ 163 Use twisted to thread the calculations away. 164 """ 190 """ Use twisted to thread the calculations away """ 165 191 # Find out if extrapolation needs to be used. 166 192 extrapolation = None 167 if self._low_extrapolate 193 if self._low_extrapolate and not self._high_extrapolate: 168 194 extrapolation = "low" 169 elif not self._low_extrapolate 195 elif not self._low_extrapolate and self._high_extrapolate: 170 196 extrapolation = "high" 171 197 elif self._low_extrapolate and self._high_extrapolate: 172 198 extrapolation = "both" 173 try: 174 # modify the Calculate button to indicate background process 175 self.pushButton.setText("Calculating...") 176 self.pushButton.setEnabled(False) 177 self.style = self.pushButton.styleSheet() 178 self.pushButton.setStyleSheet("background-color: rgb(255, 255, 0); color: rgb(0, 0, 0)") 179 # Send the calculations to separate thread. 180 d = threads.deferToThread(self.calculateThread, extrapolation) 181 # Add deferred callback for call return 182 d.addCallback(self.plotResult) 183 d.addErrback(self.plotFailed) 184 except Exception as ex: 185 # Set the button back to available 186 self.pushButton.setEnabled(True) 187 self.pushButton.setText("Calculate") 188 self.pushButton.setStyleSheet(self.style) 189 190 def plotFailed(self, reason): 191 """ 192 """ 193 print("plotFailed FAILED: ", reason) 199 200 # modify the Calculate button to indicate background process 201 self.cmdCalculate.setText("Calculating...") 202 self.cmdCalculate.setEnabled(False) 203 204 # Send the calculations to separate thread. 205 d = threads.deferToThread(self.calculateThread, extrapolation) 206 207 # Add deferred callback for call return 208 d.addCallback(self.deferredPlot) 209 d.addErrback(self.calculationFailed) 210 211 def calculationFailed(self, reason): 212 print("calculation failed: ", reason) 194 213 pass 195 214 215 def deferredPlot(self, model): 216 """ 217 Run the GUI/model update in the main thread 218 """ 219 reactor.callFromThread(lambda: self.plotResult(model)) 220 196 221 def plotResult(self, model): 197 """ 198 """ 222 """ Plot result of calculation """ 223 # Set the button back to available 224 self.cmdCalculate.setEnabled(True) 225 self.cmdCalculate.setText("Calculate") 226 self.cmdStatus.setEnabled(True) 227 199 228 self.model = model 200 229 self.mapper.toFirst() 201 202 # Set the button back to available 203 self.pushButton.setEnabled(True) 204 self.pushButton.setText("Calculate") 205 self.pushButton.setStyleSheet(self.style) 230 self._data = GuiUtils.dataFromItem(self._model_item) 206 231 207 232 # Send the modified model item to DE for keeping in the model 208 self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 209 233 # Currently -unused 234 #self.communicate.updateModelFromPerspectiveSignal.emit(self._model_item) 235 236 plot_data = GuiUtils.plotsFromCheckedItems(self._manager.filesWidget.model) 237 238 self._manager.filesWidget.plotData(plot_data) 239 240 # Update the details dialog in case it is open 241 self.updateDetailsWidget(model) 242 243 def updateDetailsWidget(self, model): 244 """ 245 On demand update of the details widget 246 """ 247 if self.detailsDialog.isVisible(): 248 self.onStatus() 210 249 211 250 def calculateThread(self, extrapolation): 212 251 """ 213 252 Perform Invariant calculations. 214 215 253 TODO: Create a dictionary of results to be sent to DE on completion. 216 254 """ 217 255 self.updateFromModel() 256 msg = '' 218 257 219 258 qstar_low = 0.0 … … 222 261 qstar_high_err = 0.0 223 262 qstar_total = 0.0 224 qstar_total_low_err = 0.0 263 qstar_total_error = 0.0 264 265 temp_data = copy.deepcopy(self._data) 225 266 226 267 # Prepare the invariant object 227 inv = invariant.InvariantCalculator(data=self._data, 228 background = self._background, 229 scale = self._scale) 230 268 inv = invariant.InvariantCalculator(data=temp_data, 269 background=self._background, 270 scale=self._scale) 231 271 if self._low_extrapolate: 272 232 273 function_low = "power_law" 233 274 if self._low_guinier: … … 235 276 if self._low_fit: 236 277 self._low_power_value = None 278 237 279 inv.set_extrapolation(range="low", 238 npts= self._low_points,280 npts=int(self._low_points), 239 281 function=function_low, 240 282 power=self._low_power_value) … … 243 285 function_low = "power_law" 244 286 inv.set_extrapolation(range="high", 245 npts= self._high_points,287 npts=int(self._high_points), 246 288 function=function_low, 247 power=self._low_power_value) 248 249 #Compute invariant 250 # TODO: proper exception handling and logic - 251 # display info, update lineedits, don't run extrapolations etc. 289 power=self._high_power_value) 290 # Compute invariant 252 291 calculation_failed = False 292 253 293 try: 254 qstar_total, qstar_total_error 294 qstar_total, qstar_total_error = inv.get_qstar_with_error() 255 295 except Exception as ex: 296 msg += str(ex) 256 297 calculation_failed = True 257 298 # Display relevant information … … 260 301 item = QtGui.QStandardItem("ERROR") 261 302 self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 303 262 304 try: 263 305 volume_fraction, volume_fraction_error = \ 264 306 inv.get_volume_fraction_with_error(self._contrast) 307 265 308 except Exception as ex: 266 309 calculation_failed = True 310 msg += str(ex) 267 311 # Display relevant information 268 312 item = QtGui.QStandardItem("ERROR") … … 270 314 item = QtGui.QStandardItem("ERROR") 271 315 self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 272 try: 273 surface, surface_error = \ 274 inv.get_surface_with_error(self._contrast, self._porod) 275 except Exception as ex: 276 calculation_failed = True 277 # Display relevant information 278 item = QtGui.QStandardItem("ERROR") 279 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 280 item = QtGui.QStandardItem("ERROR") 281 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 282 283 if(calculation_failed): 284 # TODO: NOTIFY THE GUI MANAGER!! 316 317 if self._porod: 318 try: 319 surface, surface_error = \ 320 inv.get_surface_with_error(self._contrast, self._porod) 321 except Exception as ex: 322 calculation_failed = True 323 msg += str(ex) 324 # Display relevant information 325 item = QtGui.QStandardItem("ERROR") 326 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 327 item = QtGui.QStandardItem("ERROR") 328 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 329 else: 330 surface = None 331 332 if (calculation_failed): 285 333 self.mapper.toFirst() 334 logging.warning('Calculation failed: {}'.format(msg)) 286 335 return self.model 287 288 if self._low_extrapolate: 289 # for presentation in InvariantDetails 290 qstar_low, qstar_low_err = inv.get_qstar_low() 291 extrapolated_data = inv.get_extra_data_low(self._low_points) 292 power_low = inv.get_extrapolation_power(range='low') 293 294 #inv.data = extrapolated_data 295 #qstar_total, qstar_total_error = inv.get_qstar_with_error() 296 297 # Plot the chart 298 title = "Low-Q extrapolation" 299 300 # Convert the data into plottable 301 extrapolated_data = self._manager.createGuiData(extrapolated_data) 302 extrapolated_data.name = title 303 extrapolated_data.title = title 304 305 # Add the plot to the model item 306 # This needs to run in the main thread 307 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 308 self._model_item, extrapolated_data, title) 309 310 if self._high_extrapolate: 311 # for presentation in InvariantDetails 312 qmax_plot = Q_MAXIMUM_PLOT * max(self._data.x) 313 if qmax_plot > Q_MAXIMUM: 314 qmax_plot = Q_MAXIMUM 315 qstar_high, qstar_high_err = inv.get_qstar_high() 316 power_high = inv.get_extrapolation_power(range='high') 317 high_out_data = inv.get_extra_data_high(q_end=qmax_plot, npts=500) 318 319 # Plot the chart 320 title = "High-Q extrapolation" 321 322 # Convert the data into plottable 323 high_out_data = self._manager.createGuiData(high_out_data) 324 high_out_data.name = title 325 high_out_data.title = title 326 327 # Add the plot to the model item 328 # This needs to run in the main thread 329 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 330 self._model_item, high_out_data, title) 331 332 item = QtGui.QStandardItem(str(float('%.5g'% volume_fraction))) 333 self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 334 item = QtGui.QStandardItem(str(float('%.5g'% volume_fraction_error))) 335 self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 336 item = QtGui.QStandardItem(str(float('%.5g'% surface))) 337 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 338 item = QtGui.QStandardItem(str(float('%.5g'% surface_error))) 339 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 340 item = QtGui.QStandardItem(str(float('%.5g'% qstar_total))) 341 self.model.setItem(WIDGETS.W_INVARIANT, item) 342 item = QtGui.QStandardItem(str(float('%.5g'% qstar_total_error))) 343 self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 344 345 #item = QtGui.QStandardItem(str(float('%.5g'% qstar_total))) 346 #self.model.setItem(WIDGETS.D_TOTAL_QSTAR, item) 347 #item = QtGui.QStandardItem(str(float('%.5g'% qstar_total_err))) 348 #self.model.setItem(WIDGETS.D_TOTAL_QSTAR_ERR, item) 349 item = QtGui.QStandardItem(str(float('%.5g'% qstar_low))) 350 self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 351 item = QtGui.QStandardItem(str(float('%.5g'% qstar_low_err))) 352 self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 353 item = QtGui.QStandardItem(str(float('%.5g'% qstar_high))) 354 self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 355 item = QtGui.QStandardItem(str(float('%.5g'% qstar_high_err))) 356 self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 357 358 self.mapper.toFirst() 359 360 return self.model 361 336 else: 337 338 if self._low_extrapolate: 339 # for presentation in InvariantDetails 340 qstar_low, qstar_low_err = inv.get_qstar_low() 341 extrapolated_data = inv.get_extra_data_low(self._low_points) 342 power_low = inv.get_extrapolation_power(range='low') 343 344 # Plot the chart 345 title = "Low-Q extrapolation" 346 347 # Convert the data into plottable 348 extrapolated_data = self._manager.createGuiData(extrapolated_data) 349 350 extrapolated_data.name = title 351 extrapolated_data.title = title 352 353 # copy labels and units of axes for plotting 354 extrapolated_data._xaxis = temp_data._xaxis 355 extrapolated_data._xunit = temp_data._xunit 356 extrapolated_data._yaxis = temp_data._yaxis 357 extrapolated_data._yunit = temp_data._yunit 358 359 # Add the plot to the model item 360 # This needs to run in the main thread 361 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 362 self._model_item, 363 extrapolated_data, 364 title) 365 366 if self._high_extrapolate: 367 # for presentation in InvariantDetails 368 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) # self._data.x) 369 370 if qmax_plot > Q_MAXIMUM: 371 qmax_plot = Q_MAXIMUM 372 qstar_high, qstar_high_err = inv.get_qstar_high() 373 power_high = inv.get_extrapolation_power(range='high') 374 high_out_data = inv.get_extra_data_high(q_end=qmax_plot, npts=500) 375 376 # Plot the chart 377 title = "High-Q extrapolation" 378 379 # Convert the data into plottable 380 high_out_data = self._manager.createGuiData(high_out_data) 381 high_out_data.name = title 382 high_out_data.title = title 383 384 # copy labels and units of axes for plotting 385 high_out_data._xaxis = temp_data._xaxis 386 high_out_data._xunit = temp_data._xunit 387 high_out_data._yaxis = temp_data._yaxis 388 high_out_data._yunit = temp_data._yunit 389 390 # Add the plot to the model item 391 # This needs to run in the main thread 392 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 393 self._model_item, high_out_data, title) 394 395 item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction))) 396 self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 397 item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction_error))) 398 self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 399 if surface: 400 item = QtGui.QStandardItem(str(float('%.3g'% surface))) 401 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 402 item = QtGui.QStandardItem(str(float('%.3g'% surface_error))) 403 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 404 item = QtGui.QStandardItem(str(float('%.3g'% qstar_total))) 405 self.model.setItem(WIDGETS.W_INVARIANT, item) 406 item = QtGui.QStandardItem(str(float('%.3g'% qstar_total_error))) 407 self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 408 409 item = QtGui.QStandardItem(str(float('%.3g'% qstar_low))) 410 self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 411 item = QtGui.QStandardItem(str(float('%.3g'% qstar_low_err))) 412 self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 413 item = QtGui.QStandardItem(str(float('%.3g'% qstar_high))) 414 self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 415 item = QtGui.QStandardItem(str(float('%.3g'% qstar_high_err))) 416 self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 417 418 self.mapper.toFirst() 419 420 return self.model 421 362 422 def title(self): 363 """ 364 Perspective name 365 """ 423 """ Perspective name """ 366 424 return "Invariant panel" 367 425 368 def status(self): 369 """ 426 def onStatus(self): 427 """ 428 Display Invariant Details panel when clicking on Status button 370 429 """ 371 430 self.detailsDialog.setModel(self.model) 372 431 self.detailsDialog.showDialog() 373 374 def help(self): 375 """376 """ 377 _TreeLocation = GuiUtils.HELP_DIRECTORY_LOCATION + \432 self.cmdStatus.setEnabled(False) 433 434 def onHelp(self): 435 """ Display help when clicking on Help button """ 436 treeLocation = GuiUtils.HELP_DIRECTORY_LOCATION + \ 378 437 "/user/sasgui/perspectives/invariant/invariant_help.html" 379 self._helpView.load(QtCore.QUrl(_TreeLocation)) 380 self._helpView.show() 438 webbrowser.open('file://' + treeLocation) 381 439 382 440 def setupSlots(self): 383 self.pushButton.clicked.connect(self.calculateInvariant) 384 self.pushButton_2.clicked.connect(self.status) 385 self.pushButton_3.clicked.connect(self.help) 386 387 self.radioButton.toggled.connect(self.lowGuinierAndPowerToggle) 388 self.radioButton_8.toggled.connect(self.hiFitAndFixToggle) 389 390 self.radioButton_3.toggled.connect(self.lowFitAndFixToggle) 391 392 # Bug workaround for QDataWidgetMapper() not reacting to checkbox clicks. 393 # https://bugreports.qt.io/browse/QTBUG-1818 394 self.checkBox.clicked.connect(self.setFocus) 395 self.checkBox_2.clicked.connect(self.setFocus) 441 """ """ 442 self.cmdCalculate.clicked.connect(self.calculateInvariant) 443 self.cmdStatus.clicked.connect(self.onStatus) 444 self.cmdHelp.clicked.connect(self.onHelp) 445 446 self.chkLowQ.stateChanged.connect(self.stateChanged) 447 self.chkLowQ.stateChanged.connect(self.checkQExtrapolatedData) 448 449 self.chkHighQ.stateChanged.connect(self.stateChanged) 450 self.chkHighQ.stateChanged.connect(self.checkQExtrapolatedData) 451 452 # slots for the Guinier and PowerLaw radio buttons at low Q 453 # since they are not auto-exclusive 454 self.rbGuinier.toggled.connect(self.lowGuinierAndPowerToggle) 455 456 self.rbPowerLawLowQ.toggled.connect(self.lowGuinierAndPowerToggle) 457 458 self.rbFitHighQ.toggled.connect(self.hiFitAndFixToggle) 459 460 self.rbFitLowQ.toggled.connect(self.lowFitAndFixToggle) 396 461 397 462 self.model.itemChanged.connect(self.modelChanged) 398 463 464 # update model from gui editing by users 465 self.txtBackgd.textChanged.connect(self.updateFromGui) 466 467 self.txtScale.textChanged.connect(self.updateFromGui) 468 469 self.txtContrast.textChanged.connect(self.updateFromGui) 470 471 self.txtPorodCst.textChanged.connect(self.updateFromGui) 472 473 self.txtPowerLowQ.textChanged.connect(self.updateFromGui) 474 475 self.txtPowerHighQ.textChanged.connect(self.updateFromGui) 476 477 self.txtNptsLowQ.textChanged.connect(self.updateFromGui) 478 479 self.txtNptsHighQ.textChanged.connect(self.updateFromGui) 480 481 # check values of n_points compared to distribution length 482 if self.txtNptsLowQ.isEnabled(): 483 self.txtNptsLowQ.textChanged.connect(self.checkLength) 484 485 if self.txtNptsHighQ.isEnabled(): 486 self.txtNptsHighQ.textChanged.connect(self.checkLength) 487 488 def stateChanged(self): 489 """ 490 Catch modifications from low- and high-Q extrapolation check boxes 491 """ 492 sender = self.sender() 493 494 itemf = QtGui.QStandardItem(str(sender.isChecked()).lower()) 495 if sender.text() == 'Enable Low-Q extrapolation': 496 self.model.setItem(WIDGETS.W_ENABLE_LOWQ, itemf) 497 498 if sender.text() == 'Enable High-Q extrapolation': 499 self.model.setItem(WIDGETS.W_ENABLE_HIGHQ, itemf) 500 501 def checkLength(self): 502 """ 503 Validators of number of points for extrapolation. 504 Error if it is larger than the distribution length 505 """ 506 if self._data: 507 if len(self._data.x) < int(self.sender().text()): 508 self.sender().setStyleSheet(QtCore.QString(BG_RED)) 509 logging.warning('The number of points must be smaller than {}'.format(len(self._data.x))) 510 self.cmdCalculate.setEnabled(False) 511 else: 512 self.sender().setStyleSheet(QtCore.QString(BG_WHITE)) 513 self.cmdCalculate.setEnabled(True) 514 else: 515 # logging.info('no data is loaded') 516 self.cmdCalculate.setEnabled(False) 517 399 518 def modelChanged(self, item): 400 """ 401 """ 519 """ Update when model changed """ 402 520 if item.row() == WIDGETS.W_ENABLE_LOWQ: 403 521 toggle = (str(item.text()) == 'true') … … 408 526 self._high_extrapolate = toggle 409 527 self.highQToggle(toggle) 410 528 529 def checkQExtrapolatedData(self): 530 """ 531 Match status of low or high-Q extrapolated data checkbox in 532 DataExplorer with low or high-Q extrapolation checkbox in invariant 533 panel 534 """ 535 # name to search in DataExplorer 536 if 'Low' in str(self.sender().text()): 537 name = "Low-Q extrapolation" 538 if 'High' in str(self.sender().text()): 539 name = "High-Q extrapolation" 540 541 GuiUtils.updateModelItemStatus(self._manager.filesWidget.model, 542 self._path, name, 543 self.sender().checkState()) 544 545 def updateFromGui(self): 546 """ Update model when new user inputs """ 547 possible_senders = ['txtBackgd', 'txtContrast', 'txtPorodCst', 548 'txtScale', 'txtPowerLowQ', 'txtPowerHighQ', 549 'txtNptsLowQ', 'txtNptsHighQ'] 550 551 related_widgets = [WIDGETS.W_BACKGROUND, WIDGETS.W_CONTRAST, 552 WIDGETS.W_POROD_CST, WIDGETS.W_SCALE, 553 WIDGETS.W_LOWQ_POWER_VALUE, WIDGETS.W_HIGHQ_POWER_VALUE, 554 WIDGETS.W_NPTS_LOWQ, WIDGETS.W_NPTS_HIGHQ] 555 556 related_internal_values = [self._background, self._contrast, 557 self._porod, self._scale, 558 self._low_power_value, 559 self._high_power_value, 560 self._low_points, self._high_points] 561 562 item = QtGui.QStandardItem(self.sender().text()) 563 564 index_elt = possible_senders.index(self.sender().objectName()) 565 566 self.model.setItem(related_widgets[index_elt], item) 567 568 related_internal_values[index_elt] = float(self.sender().text()) 569 570 # print possible_senders[index_elt], related_internal_values[index_elt] 571 572 self.mapper.toFirst() 573 411 574 def lowGuinierAndPowerToggle(self, toggle): 412 575 """ 413 """ 414 self._low_guinier = toggle 576 Guinier and Power radio buttons cannot be selected at the same time 577 If Power is selected, Fit and Fix radio buttons are visible and 578 Power line edit can be edited if Fix is selected 579 """ 580 if self.sender().text() == 'Guinier': 581 self._low_guinier = toggle 582 583 toggle = not toggle 584 self.rbPowerLawLowQ.setChecked(toggle) 585 586 self.rbFitLowQ.toggled.connect(self.lowFitAndFixToggle) 587 self.rbFitLowQ.setVisible(toggle) 588 self.rbFixLowQ.setVisible(toggle) 589 590 self.txtPowerLowQ.setEnabled(toggle and (not self._low_fit)) 591 592 else: 593 self._low_guinier = not toggle 594 595 self.rbGuinier.setChecked(not toggle) 596 597 self.rbFitLowQ.toggled.connect(self.lowFitAndFixToggle) 598 self.rbFitLowQ.setVisible(toggle) 599 self.rbFixLowQ.setVisible(toggle) 600 601 self.txtPowerLowQ.setEnabled(toggle and (not self._low_fit)) 602 603 def lowFitAndFixToggle(self, toggle): 604 """ Fit and Fix radiobuttons cannot be selected at the same time """ 605 self._low_fit = toggle 606 415 607 toggle = not toggle 416 self.lineEdit_11.setEnabled(toggle) 417 self.radioButton_3.setEnabled(toggle) 418 self.radioButton_4.setEnabled(toggle) 419 self.lineEdit_11.setEnabled(toggle and (not self._low_fit)) 420 421 def lowFitAndFixToggle(self, toggle): 422 """ 423 """ 424 self._low_fit = toggle 425 toggle = not toggle 426 self.lineEdit_11.setEnabled(toggle) 608 self.txtPowerLowQ.setEnabled(toggle) 427 609 428 610 def hiFitAndFixToggle(self, toggle): 429 611 """ 430 """ 431 self.lineEdit_13.setEnabled(toggle) 612 Enable editing of power exponent if Fix for high Q is checked 613 Disable otherwise 614 """ 615 self.txtPowerHighQ.setEnabled(not toggle) 432 616 433 617 def highQToggle(self, clicked): 434 """ 435 Disable/enable High Q extrapolation 436 """ 437 self.radioButton_7.setEnabled(clicked) 438 self.radioButton_8.setEnabled(clicked) 439 self.lineEdit_12.setEnabled(clicked) 440 self.lineEdit_13.setEnabled(clicked) 618 """ Disable/enable High Q extrapolation """ 619 self.rbFitHighQ.setEnabled(clicked) 620 self.rbFixHighQ.setEnabled(clicked) 621 self.txtNptsHighQ.setEnabled(clicked) 622 self.txtPowerHighQ.setEnabled(clicked) 441 623 442 624 def lowQToggle(self, clicked): 443 """ 444 Disable/enable Low Q extrapolation 445 """ 446 self.radioButton.setEnabled(clicked) 447 self.radioButton_2.setEnabled(clicked) 448 self.lineEdit_11.setEnabled(clicked and not self._low_fit) 449 625 """ Disable / enable Low Q extrapolation """ 626 self.rbGuinier.setEnabled(clicked) 627 self.rbPowerLawLowQ.setEnabled(clicked) 628 self.txtNptsLowQ.setEnabled(clicked) 450 629 # Enable subelements 451 self.radioButton_3.setEnabled(clicked and not self._low_guinier) 452 self.radioButton_4.setEnabled(clicked and not self._low_guinier) 453 self.lineEdit_10.setEnabled(clicked and not self._low_guinier) 630 self.rbFitLowQ.setVisible(self.rbPowerLawLowQ.isChecked()) 631 self.rbFixLowQ.setVisible(self.rbPowerLawLowQ.isChecked()) 632 self.rbFitLowQ.setEnabled(clicked) # and not self._low_guinier) 633 self.rbFixLowQ.setEnabled(clicked) # and not self._low_guinier) 634 635 self.txtPowerLowQ.setEnabled(clicked 636 and not self._low_guinier 637 and not self._low_fit) 454 638 455 639 def setupModel(self): 456 640 """ """ 457 641 # filename 458 642 item = QtGui.QStandardItem(self._path) … … 460 644 461 645 # add Q parameters to the model 462 #qmin = min(self._data.x)463 646 qmin = 0.0 464 647 item = QtGui.QStandardItem(str(qmin)) … … 475 658 item = QtGui.QStandardItem(str(self._scale)) 476 659 self.model.setItem(WIDGETS.W_SCALE, item) 477 660 # leave line edit empty if Porod constant not defined 661 if self._porod != None: 662 item = QtGui.QStandardItem(str(self._porod)) 663 else: 664 item = QtGui.QStandardItem(str('')) 665 self.model.setItem(WIDGETS.W_POROD_CST, item) 666 478 667 # Dialog elements 479 668 itemf = QtGui.QStandardItem("false") … … 482 671 self.model.setItem(WIDGETS.W_ENABLE_LOWQ, itemf) 483 672 484 item = QtGui.QStandardItem(str( self._npoints_low))673 item = QtGui.QStandardItem(str(NPOINTS_Q_INTERP)) 485 674 self.model.setItem(WIDGETS.W_NPTS_LOWQ, item) 486 item = QtGui.QStandardItem(str( self._npoints_high))675 item = QtGui.QStandardItem(str(NPOINTS_Q_INTERP)) 487 676 self.model.setItem(WIDGETS.W_NPTS_HIGHQ, item) 488 677 … … 492 681 itemt = QtGui.QStandardItem("true") 493 682 self.model.setItem(WIDGETS.W_LOWQ_FIT, itemt) 494 item = QtGui.QStandardItem(str( self._power_low))683 item = QtGui.QStandardItem(str(DEFAULT_POWER_LOW)) 495 684 self.model.setItem(WIDGETS.W_LOWQ_POWER_VALUE, item) 496 685 497 686 itemt = QtGui.QStandardItem("true") 498 687 self.model.setItem(WIDGETS.W_HIGHQ_FIT, itemt) 499 item = QtGui.QStandardItem(str( self._power_low))688 item = QtGui.QStandardItem(str(DEFAULT_POWER_LOW)) 500 689 self.model.setItem(WIDGETS.W_HIGHQ_POWER_VALUE, item) 501 502 690 503 691 def setupMapper(self): … … 507 695 self.mapper.setModel(self.model) 508 696 509 # Set up the view on the model for testing510 # self.tableView.setModel(self.model)511 512 697 # Filename 513 self.mapper.addMapping(self.lineEdit, WIDGETS.W_FILENAME) 698 self.mapper.addMapping(self.txtName, WIDGETS.W_FILENAME) 699 514 700 # Qmin/Qmax 515 self.mapper.addMapping(self. lineEdit_2, WIDGETS.W_QMIN)516 self.mapper.addMapping(self. lineEdit_3, WIDGETS.W_QMAX)701 self.mapper.addMapping(self.txtTotalQMin, WIDGETS.W_QMIN) 702 self.mapper.addMapping(self.txtTotalQMax, WIDGETS.W_QMAX) 517 703 518 704 # Background 519 self.mapper.addMapping(self.lineEdit_4, WIDGETS.W_BACKGROUND) 705 self.mapper.addMapping(self.txtBackgd, WIDGETS.W_BACKGROUND) 706 520 707 # Scale 521 self.mapper.addMapping(self.lineEdit_5, WIDGETS.W_SCALE) 708 self.mapper.addMapping(self.txtScale, WIDGETS.W_SCALE) 709 522 710 # Contrast 523 self.mapper.addMapping(self.lineEdit_6, WIDGETS.W_CONTRAST) 711 self.mapper.addMapping(self.txtContrast, WIDGETS.W_CONTRAST) 712 713 # Porod constant 714 self.mapper.addMapping(self.txtPorodCst, WIDGETS.W_POROD_CST) 524 715 525 716 # Lowq/Highq items 526 self.mapper.addMapping(self.ch eckBox, WIDGETS.W_ENABLE_LOWQ)527 self.mapper.addMapping(self.ch eckBox_2, WIDGETS.W_ENABLE_HIGHQ)528 529 self.mapper.addMapping(self. lineEdit_10, WIDGETS.W_NPTS_LOWQ)530 self.mapper.addMapping(self.r adioButton, WIDGETS.W_LOWQ_GUINIER)531 532 self.mapper.addMapping(self. radioButton_3, WIDGETS.W_LOWQ_FIT)533 self.mapper.addMapping(self.lineEdit_11, WIDGETS.W_LOWQ_POWER_VALUE) 534 535 self.mapper.addMapping(self.r adioButton_7, WIDGETS.W_HIGHQ_FIT)536 self.mapper.addMapping(self. lineEdit_13, WIDGETS.W_HIGHQ_POWER_VALUE)717 self.mapper.addMapping(self.chkLowQ, WIDGETS.W_ENABLE_LOWQ) 718 self.mapper.addMapping(self.chkHighQ, WIDGETS.W_ENABLE_HIGHQ) 719 720 self.mapper.addMapping(self.txtNptsLowQ, WIDGETS.W_NPTS_LOWQ) 721 self.mapper.addMapping(self.rbGuinier, WIDGETS.W_LOWQ_GUINIER) 722 self.mapper.addMapping(self.rbFitLowQ, WIDGETS.W_LOWQ_FIT) 723 self.mapper.addMapping(self.txtPowerLowQ, WIDGETS.W_LOWQ_POWER_VALUE) 724 725 self.mapper.addMapping(self.txtNptsHighQ, WIDGETS.W_NPTS_HIGHQ) 726 self.mapper.addMapping(self.rbFitHighQ, WIDGETS.W_HIGHQ_FIT) 727 self.mapper.addMapping(self.txtPowerHighQ, WIDGETS.W_HIGHQ_POWER_VALUE) 537 728 538 729 # Output 539 self.mapper.addMapping(self.lineEdit_14, WIDGETS.W_VOLUME_FRACTION) 540 self.mapper.addMapping(self.lineEdit_15, WIDGETS.W_VOLUME_FRACTION_ERR) 541 self.mapper.addMapping(self.lineEdit_16, WIDGETS.W_SPECIFIC_SURFACE) 542 self.mapper.addMapping(self.lineEdit_17, WIDGETS.W_SPECIFIC_SURFACE_ERR) 543 self.mapper.addMapping(self.lineEdit_19, WIDGETS.W_INVARIANT) 544 self.mapper.addMapping(self.lineEdit_18, WIDGETS.W_INVARIANT_ERR) 545 546 # FIXME DOESNT WORK WITH QT5 547 #self.mapper.toFirst() 548 549 def setData(self, data_item, is_batch=False): 730 self.mapper.addMapping(self.txtVolFract, WIDGETS.W_VOLUME_FRACTION) 731 self.mapper.addMapping(self.txtVolFractErr, WIDGETS.W_VOLUME_FRACTION_ERR) 732 self.mapper.addMapping(self.txtSpecSurf, WIDGETS.W_SPECIFIC_SURFACE) 733 self.mapper.addMapping(self.txtSpecSurfErr, WIDGETS.W_SPECIFIC_SURFACE_ERR) 734 self.mapper.addMapping(self.txtInvariantTot, WIDGETS.W_INVARIANT) 735 self.mapper.addMapping(self.txtInvariantTotErr, WIDGETS.W_INVARIANT_ERR) 736 737 self.mapper.toFirst() 738 739 def setData(self, data_item=None, is_batch=False): 550 740 """ 551 741 Obtain a QStandardItem object and dissect it to get Data1D/2D 552 742 Pass it over to the calculator 553 743 """ 744 assert data_item is not None 745 746 if self.txtName.text() == data_item[0].text(): 747 logging.info('This file is already loaded in Invariant panel.') 748 return 749 554 750 if not isinstance(data_item, list): 555 751 msg = "Incorrect type passed to the Invariant Perspective" … … 560 756 raise AttributeError(msg) 561 757 758 # only 1 file can be loaded 562 759 self._model_item = data_item[0] 563 760 564 761 # Extract data on 1st child - this is the Data1D/2D component 565 762 data = GuiUtils.dataFromItem(self._model_item) 566 self.model.item(WIDGETS.W_FILENAME).setData(self._model_item.text()) 567 568 ##### DEBUG #### 569 # set data in the debug tree view window 570 self.treeView.setModel(self.model) 571 572 self.calculate(data_list=[data]) 573 574 def calculate(self, data_list=None): 575 """ 576 receive a list of data and compute invariant 577 578 TODO: pass warnings/messages to log 579 """ 580 msg = "" 581 data = None 582 if data_list is None: 583 data_list = [] 584 if len(data_list) >= 1: 585 if len(data_list) == 1: 586 data = data_list[0] 587 else: 588 data_1d_list = [] 589 data_2d_list = [] 590 error_msg = "" 591 # separate data into data1d and data2d list 592 for data in data_list: 593 if data is not None: 594 if issubclass(data.__class__, Data1D): 595 data_1d_list.append(data) 596 else: 597 error_msg += " %s type %s \n" % (str(data.name), 598 str(data.__class__.__name__)) 599 data_2d_list.append(data) 600 if len(data_2d_list) > 0: 601 msg = "Invariant does not support the following data types:\n" 602 msg += error_msg 603 if len(data_1d_list) == 0: 604 # remake this as a qt event 605 #wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 606 return 607 608 # TODO: add msgbox for data choice 609 #msg += "Invariant panel does not allow multiple data!\n" 610 #msg += "Please select one.\n" 611 #if len(data_list) > 1: 612 #from invariant_widgets import DataDialog 613 #dlg = DataDialog(data_list=data_1d_list, text=msg) 614 #if dlg.ShowModal() == wx.ID_OK: 615 # data = dlg.get_data() 616 #else: 617 # data = None 618 #dlg.Destroy() 619 620 if data is None: 621 msg += "invariant receives no data. \n" 622 #wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 623 return 624 if not issubclass(data.__class__, Data1D): 625 msg += "invariant cannot be computed for data of " 626 msg += "type %s\n" % (data.__class__.__name__) 627 #wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 628 return 629 else: 630 #wx.PostEvent(self.parent, NewPlotEvent(plot=data, title=data.title)) 631 try: 632 self._data = data 633 self._path = "unique path" 634 self.calculateInvariant() 635 except: 636 msg = "Invariant Set_data: " + str(sys.exc_info()[1]) 637 #wx.PostEvent(self.parent, StatusEvent(status=msg, info="error")) 638 else: 639 msg = "invariant cannot be computed for data of " 640 msg += "type %s" % (data.__class__.__name__) 641 #wx.PostEvent(self.parent, StatusEvent(status=msg, info='error')) 763 self.model.item(WIDGETS.W_FILENAME).setData(QtCore.QVariant(self._model_item.text())) 764 # update GUI and model with info from loaded data 765 self.updateGuiFromFile(data=data) 766 767 def updateGuiFromFile(self, data=None): 768 """ 769 update display in GUI and plot 770 """ 771 self._data = data 772 773 # plot loaded file 774 if not isinstance(self._data, Data1D): 775 msg = "Error(s) occurred: Invariant cannot be computed with 2D data." 776 raise AttributeError(msg) 777 778 try: 779 filename = data.filename 780 except: 781 msg = 'No filename' 782 raise ValueError(msg) 783 try: 784 qmin = min(self._data.x) 785 qmax = max(self._data.x) 786 except: 787 msg = "Unable to find q min/max of \n data named %s" % \ 788 data.filename 789 raise ValueError(msg) 790 791 # update model with input form files: filename, qmin, qmax 792 self.model.item(WIDGETS.W_FILENAME).setText(filename) 793 self.model.item(WIDGETS.W_QMIN).setText(str(qmin)) 794 self.model.item(WIDGETS.W_QMAX).setText(str(qmax)) 795 self._path = filename 796 797 # Calculate and add to GUI: volume fraction, invariant total, 798 # and specific surface if porod checked 799 self.calculateInvariant() 642 800 643 801 def allowBatch(self): -
src/sas/qtgui/Perspectives/Invariant/InvariantUtils.py
rb3e8629 rf1f3e6a 3 3 return type('Enum', (), enums) 4 4 5 WIDGETS = enum( 'W_FILENAME', #0 6 'W_QMIN', #1 7 'W_QMAX', #2 8 'W_BACKGROUND', #3 9 'W_SCALE', #4 10 'W_CONTRAST', #5 11 'W_EX_QMIN', #6 12 'W_EX_QMAX', #7 13 'W_ENABLE_LOWQ', #8 14 'W_ENABLE_HIGHQ', #9 15 'W_NPTS_LOWQ', #10 16 'W_NPTS_HIGHQ', #11 17 'W_LOWQ_GUINIER', #12 18 'W_LOWQ_POWER', #13 19 'W_LOWQ_FIT', #14 20 'W_LOWQ_FIX', #15 21 'W_LOWQ_POWER_VALUE', #16 22 'W_HIGHQ_FIT', #17 23 'W_HIGHQ_FIX', #18 24 'W_HIGHQ_POWER_VALUE', #19 5 WIDGETS = enum( 'W_FILENAME', 6 'W_QMIN', 7 'W_QMAX', 8 'W_BACKGROUND', 9 'W_SCALE', 10 'W_CONTRAST', 11 'W_POROD_CST', 12 'W_EX_QMIN', 13 'W_EX_QMAX', 14 'W_ENABLE_LOWQ', 15 'W_ENABLE_HIGHQ', 16 'W_NPTS_LOWQ', 17 'W_NPTS_HIGHQ', 18 'W_LOWQ_GUINIER', 19 'W_LOWQ_POWER', 20 'W_LOWQ_FIT', 21 'W_LOWQ_FIX', 22 'W_LOWQ_POWER_VALUE', 23 'W_HIGHQ_FIT', 24 'W_HIGHQ_FIX', 25 'W_HIGHQ_POWER_VALUE', 25 26 # results 26 27 'W_VOLUME_FRACTION', -
src/sas/qtgui/Perspectives/Invariant/UI/InvariantDetailsUI.ui
r457d961 rf1f3e6a 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 449</width>9 <width>511</width> 10 10 <height>458</height> 11 11 </rect> 12 </property> 13 <property name="sizePolicy"> 14 <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> 15 <horstretch>0</horstretch> 16 <verstretch>0</verstretch> 17 </sizepolicy> 12 18 </property> 13 19 <property name="windowTitle"> … … 29 35 </item> 30 36 <item row="0" column="1"> 31 <widget class="QProgressBar" name="progressBar ">37 <widget class="QProgressBar" name="progressBarLowQ"> 32 38 <property name="value"> 33 39 <number>24</number> … … 43 49 </item> 44 50 <item row="1" column="1"> 45 <widget class="QProgressBar" name="progressBar _2">51 <widget class="QProgressBar" name="progressBarData"> 46 52 <property name="value"> 47 53 <number>24</number> … … 57 63 </item> 58 64 <item row="2" column="1"> 59 <widget class="QProgressBar" name="progressBar _3">65 <widget class="QProgressBar" name="progressBarHighQ"> 60 66 <property name="value"> 61 67 <number>24</number> … … 80 86 </item> 81 87 <item row="0" column="1"> 82 <widget class="QLineEdit" name="lineEdit"/> 88 <widget class="QLineEdit" name="txtQLowQ"> 89 <property name="toolTip"> 90 <string>Extrapolated invariant from low-Q range.</string> 91 </property> 92 </widget> 83 93 </item> 84 94 <item row="0" column="2"> … … 90 100 </item> 91 101 <item row="0" column="3"> 92 <widget class="QLineEdit" name="lineEdit_2"/> 102 <widget class="QLineEdit" name="txtQLowQErr"> 103 <property name="toolTip"> 104 <string>Uncertainty on the invariant from low-Q range.</string> 105 </property> 106 </widget> 93 107 </item> 94 108 <item row="0" column="4"> 95 <widget class="QLabel" name="l abel_3">96 <property name="text"> 97 <string><html><head/><body><p> [1/(cm*Ã98 <span style=" vertical-align:super;">3</span>) ]</p></body></html></string>109 <widget class="QLabel" name="lblQLowQUnits"> 110 <property name="text"> 111 <string><html><head/><body><p>(cm à 112 <span style=" vertical-align:super;">3</span>)<span style=" vertical-align:super;">-1</span></p></body></html></string> 99 113 </property> 100 114 </widget> … … 108 122 </item> 109 123 <item row="1" column="1"> 110 <widget class="QLineEdit" name="lineEdit_3"/> 124 <widget class="QLineEdit" name="txtQData"> 125 <property name="toolTip"> 126 <string>Invariant in the data set's Q range.</string> 127 </property> 128 </widget> 111 129 </item> 112 130 <item row="1" column="2"> … … 118 136 </item> 119 137 <item row="1" column="3"> 120 <widget class="QLineEdit" name="lineEdit_4"/> 138 <widget class="QLineEdit" name="txtQDataErr"> 139 <property name="toolTip"> 140 <string>Uncertainty on the invariant from data's range.</string> 141 </property> 142 </widget> 121 143 </item> 122 144 <item row="1" column="4"> 123 <widget class="QLabel" name="l abel_4">124 <property name="text"> 125 <string><html><head/><body><p> [1/(cm*Ã126 <span style=" vertical-align:super;">3</span>) ]</p></body></html></string>145 <widget class="QLabel" name="lblQDataUnits"> 146 <property name="text"> 147 <string><html><head/><body><p>(cm à 148 <span style=" vertical-align:super;">3</span>)<span style=" vertical-align:super;">-1</span></p></body></html></string> 127 149 </property> 128 150 </widget> … … 136 158 </item> 137 159 <item row="2" column="1"> 138 <widget class="QLineEdit" name="lineEdit_5"/> 160 <widget class="QLineEdit" name="txtQHighQ"> 161 <property name="toolTip"> 162 <string>Extrapolated invariant from high-Q range.</string> 163 </property> 164 </widget> 139 165 </item> 140 166 <item row="2" column="2"> … … 146 172 </item> 147 173 <item row="2" column="3"> 148 <widget class="QLineEdit" name="lineEdit_6"/> 174 <widget class="QLineEdit" name="txtQHighQErr"> 175 <property name="toolTip"> 176 <string>Uncertainty on the invariant from high-Q range.</string> 177 </property> 178 </widget> 149 179 </item> 150 180 <item row="2" column="4"> 151 <widget class="QLabel" name="l abel_7">152 <property name="text"> 153 <string><html><head/><body><p> [1/(cm*Ã154 <span style=" vertical-align:super;">3</span>) ]</p></body></html></string>181 <widget class="QLabel" name="lblQHighQUnits"> 182 <property name="text"> 183 <string><html><head/><body><p>(cm à 184 <span style=" vertical-align:super;">3</span>)<span style=" vertical-align:super;">-1</span></p></body></html></string> 155 185 </property> 156 186 </widget> … … 179 209 </item> 180 210 <item row="3" column="0"> 181 <widget class="QDialogButtonBox" name=" buttonBox">211 <widget class="QDialogButtonBox" name="cmdOK"> 182 212 <property name="orientation"> 183 213 <enum>Qt::Horizontal</enum> … … 193 223 <connections> 194 224 <connection> 195 <sender> buttonBox</sender>225 <sender>cmdOK</sender> 196 226 <signal>accepted()</signal> 197 227 <receiver>Dialog</receiver> … … 209 239 </connection> 210 240 <connection> 211 <sender> buttonBox</sender>241 <sender>cmdOK</sender> 212 242 <signal>rejected()</signal> 213 243 <receiver>Dialog</receiver> -
src/sas/qtgui/Perspectives/Invariant/UI/TabbedInvariantUI.ui
r469b4622 rf1f3e6a 7 7 <x>0</x> 8 8 <y>0</y> 9 <width> 466</width>10 <height>4 08</height>9 <width>601</width> 10 <height>473</height> 11 11 </rect> 12 </property> 13 <property name="sizePolicy"> 14 <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> 15 <horstretch>0</horstretch> 16 <verstretch>0</verstretch> 17 </sizepolicy> 12 18 </property> 13 19 <property name="windowTitle"> … … 15 21 </property> 16 22 <layout class="QGridLayout" name="gridLayout_11"> 23 <item row="1" column="0"> 24 <spacer name="verticalSpacer"> 25 <property name="orientation"> 26 <enum>Qt::Vertical</enum> 27 </property> 28 <property name="sizeHint" stdset="0"> 29 <size> 30 <width>20</width> 31 <height>2</height> 32 </size> 33 </property> 34 </spacer> 35 </item> 36 <item row="2" column="0"> 37 <layout class="QHBoxLayout" name="horizontalLayout_8"> 38 <item> 39 <widget class="QPushButton" name="cmdCalculate"> 40 <property name="toolTip"> 41 <string>Compute invariant</string> 42 </property> 43 <property name="text"> 44 <string>Calculate</string> 45 </property> 46 </widget> 47 </item> 48 <item> 49 <spacer name="horizontalSpacer"> 50 <property name="orientation"> 51 <enum>Qt::Horizontal</enum> 52 </property> 53 <property name="sizeHint" stdset="0"> 54 <size> 55 <width>40</width> 56 <height>20</height> 57 </size> 58 </property> 59 </spacer> 60 </item> 61 <item> 62 <widget class="QPushButton" name="cmdStatus"> 63 <property name="enabled"> 64 <bool>false</bool> 65 </property> 66 <property name="toolTip"> 67 <string>Get more details of computation such as fraction from extrapolation</string> 68 </property> 69 <property name="text"> 70 <string>Status</string> 71 </property> 72 </widget> 73 </item> 74 <item> 75 <widget class="QPushButton" name="cmdHelp"> 76 <property name="toolTip"> 77 <string/> 78 </property> 79 <property name="text"> 80 <string>Help</string> 81 </property> 82 </widget> 83 </item> 84 </layout> 85 </item> 17 86 <item row="0" column="0"> 18 87 <widget class="QTabWidget" name="tabWidget"> … … 34 103 <layout class="QHBoxLayout" name="horizontalLayout_4"> 35 104 <item> 36 <widget class="QLabel" name="l abel">105 <widget class="QLabel" name="lblName"> 37 106 <property name="text"> 38 107 <string>Name:</string> … … 41 110 </item> 42 111 <item> 43 <widget class="QLineEdit" name=" lineEdit">112 <widget class="QLineEdit" name="txtName"> 44 113 <property name="enabled"> 45 <bool> true</bool>114 <bool>false</bool> 46 115 </property> 47 116 <property name="frame"> … … 64 133 <layout class="QHBoxLayout" name="horizontalLayout"> 65 134 <item> 66 <widget class="QLabel" name="l abel_3">135 <widget class="QLabel" name="lblTotalQMin"> 67 136 <property name="text"> 68 137 <string>Min:</string> … … 71 140 </item> 72 141 <item> 73 <widget class="QLineEdit" name=" lineEdit_2">142 <widget class="QLineEdit" name="txtTotalQMin"> 74 143 <property name="enabled"> 75 144 <bool>false</bool> … … 78 147 </item> 79 148 <item> 80 <widget class="QLabel" name="l abel_4">149 <widget class="QLabel" name="lblTotalQMax"> 81 150 <property name="text"> 82 151 <string>Max:</string> … … 85 154 </item> 86 155 <item> 87 <widget class="QLineEdit" name=" lineEdit_3">156 <widget class="QLineEdit" name="txtTotalQMax"> 88 157 <property name="enabled"> 89 158 <bool>false</bool> … … 92 161 </item> 93 162 <item> 94 <widget class="QLabel" name="l abel_2">163 <widget class="QLabel" name="lblTotalQUnits"> 95 164 <property name="text"> 96 165 <string><html><head/><body><p>à … … 121 190 </item> 122 191 <item row="0" column="1"> 123 <widget class="QLineEdit" name=" lineEdit_14">192 <widget class="QLineEdit" name="txtVolFract"> 124 193 <property name="enabled"> 125 <bool> true</bool>194 <bool>false</bool> 126 195 </property> 127 196 <property name="autoFillBackground"> … … 150 219 </item> 151 220 <item row="0" column="3"> 152 <widget class="QLineEdit" name=" lineEdit_15">221 <widget class="QLineEdit" name="txtVolFractErr"> 153 222 <property name="enabled"> 154 <bool> true</bool>223 <bool>false</bool> 155 224 </property> 156 225 <property name="frame"> … … 173 242 </item> 174 243 <item row="1" column="1"> 175 <widget class="QLineEdit" name=" lineEdit_17">244 <widget class="QLineEdit" name="txtSpecSurf"> 176 245 <property name="enabled"> 177 <bool> true</bool>246 <bool>false</bool> 178 247 </property> 179 248 <property name="frame"> … … 196 265 </item> 197 266 <item row="1" column="3"> 198 <widget class="QLineEdit" name=" lineEdit_16">267 <widget class="QLineEdit" name="txtSpecSurfErr"> 199 268 <property name="enabled"> 200 <bool> true</bool>269 <bool>false</bool> 201 270 </property> 202 271 <property name="frame"> … … 212 281 </item> 213 282 <item row="1" column="4"> 214 <widget class="QLabel" name="l abel_24">283 <widget class="QLabel" name="lblSpecificSurfaceUnits"> 215 284 <property name="text"> 216 285 <string><html><head/><body><p>à … … 234 303 </item> 235 304 <item row="3" column="1"> 236 <widget class="QLineEdit" name=" lineEdit_19">305 <widget class="QLineEdit" name="txtInvariantTot"> 237 306 <property name="enabled"> 238 <bool>true</bool> 239 </property> 240 <property name="styleSheet"> 241 <string notr="true">background-color: rgb(253, 253, 126); 242 font: bold 8pt "MS Shell Dlg 2";</string> 307 <bool>false</bool> 308 </property> 309 <property name="toolTip"> 310 <string>Total invariant [Q*], including extrapolated regions.</string> 243 311 </property> 244 312 <property name="frame"> … … 261 329 </item> 262 330 <item row="3" column="3"> 263 <widget class="QLineEdit" name=" lineEdit_18">331 <widget class="QLineEdit" name="txtInvariantTotErr"> 264 332 <property name="enabled"> 265 <bool>true</bool> 266 </property> 267 <property name="styleSheet"> 268 <string notr="true">background-color: rgb(253, 253, 126); 269 font: bold 8pt "MS Shell Dlg 2";</string> 333 <bool>false</bool> 270 334 </property> 271 335 <property name="frame"> … … 281 345 </item> 282 346 <item row="3" column="4"> 283 <widget class="QLabel" name="l abel_27">347 <widget class="QLabel" name="lblInvariantTotalQUnits"> 284 348 <property name="text"> 285 349 <string><html><head/><body><p>(cm à … … 314 378 </item> 315 379 <item row="0" column="1"> 316 <widget class="QLineEdit" name=" lineEdit_4"/>380 <widget class="QLineEdit" name="txtBackgd"/> 317 381 </item> 318 382 <item row="0" column="2"> … … 331 395 </item> 332 396 <item row="0" column="4"> 333 <widget class="QLineEdit" name=" lineEdit_6"/>397 <widget class="QLineEdit" name="txtScale"/> 334 398 </item> 335 399 <item row="1" column="0"> … … 341 405 </item> 342 406 <item row="1" column="1"> 343 <widget class="QLineEdit" name=" lineEdit_5"/>407 <widget class="QLineEdit" name="txtContrast"/> 344 408 </item> 345 409 <item row="1" column="2"> 346 <widget class="QLabel" name="l abel_7">410 <widget class="QLabel" name="lblContrastUnits"> 347 411 <property name="text"> 348 412 <string><html><head/><body><p>à … … 359 423 </item> 360 424 <item row="1" column="4"> 361 <widget class="QLineEdit" name="lineEdit_7"/> 425 <widget class="QLineEdit" name="txtPorodCst"> 426 <property name="toolTip"> 427 <string>Porod constant (optional)</string> 428 </property> 429 </widget> 362 430 </item> 363 431 <item row="1" column="5"> 364 <widget class="QLabel" name="l abel_11">432 <widget class="QLabel" name="lblPorodCstUnits"> 365 433 <property name="text"> 366 434 <string><html><head/><body><p>(cm à … … 397 465 </item> 398 466 <item> 399 <widget class="QLineEdit" name=" lineEdit_8">467 <widget class="QLineEdit" name="txtExtrapolQMin"> 400 468 <property name="enabled"> 401 469 <bool>false</bool> 402 470 </property> 471 <property name="toolTip"> 472 <string>The minimum extrapolated q value.</string> 473 </property> 403 474 </widget> 404 475 </item> … … 411 482 </item> 412 483 <item> 413 <widget class="QLineEdit" name=" lineEdit_9">484 <widget class="QLineEdit" name="txtExtrapolQMax"> 414 485 <property name="enabled"> 415 486 <bool>false</bool> … … 418 489 </item> 419 490 <item> 420 <widget class="QLabel" name="l abel_15">491 <widget class="QLabel" name="lblExtrapolQUnits"> 421 492 <property name="text"> 422 493 <string><html><head/><body><p>à … … 428 499 </item> 429 500 <item row="1" column="0"> 430 <widget class="QGroupBox" name="groupBox_ 5">501 <widget class="QGroupBox" name="groupBox_lowQ"> 431 502 <property name="title"> 432 503 <string>Low Q</string> 433 504 </property> 434 505 <layout class="QGridLayout" name="gridLayout_7"> 435 <item row="0" column="0"> 436 <widget class="QCheckBox" name="checkBox"> 506 <item row="1" column="0" colspan="2"> 507 <layout class="QHBoxLayout" name="horizontalLayout_3"> 508 <item> 509 <widget class="QLabel" name="label_16"> 510 <property name="text"> 511 <string>Npts:</string> 512 </property> 513 </widget> 514 </item> 515 <item> 516 <widget class="QLineEdit" name="txtNptsLowQ"> 517 <property name="toolTip"> 518 <string>Number of Q points to consider 519 while extrapolating the low-Q region</string> 520 </property> 521 </widget> 522 </item> 523 </layout> 524 </item> 525 <item row="2" column="0"> 526 <layout class="QVBoxLayout" name="verticalLayout_2"> 527 <item> 528 <widget class="QRadioButton" name="rbGuinier"> 529 <property name="text"> 530 <string>Guinier</string> 531 </property> 532 <property name="checked"> 533 <bool>true</bool> 534 </property> 535 <property name="autoExclusive"> 536 <bool>false</bool> 537 </property> 538 </widget> 539 </item> 540 <item> 541 <widget class="QRadioButton" name="rbPowerLawLowQ"> 542 <property name="text"> 543 <string>Power law</string> 544 </property> 545 <property name="checked"> 546 <bool>false</bool> 547 </property> 548 <property name="autoExclusive"> 549 <bool>false</bool> 550 </property> 551 </widget> 552 </item> 553 </layout> 554 </item> 555 <item row="3" column="0" colspan="2"> 556 <layout class="QHBoxLayout" name="horizontalLayout_6"> 557 <item> 558 <widget class="QLabel" name="label_17"> 559 <property name="text"> 560 <string>Power:</string> 561 </property> 562 </widget> 563 </item> 564 <item> 565 <widget class="QLineEdit" name="txtPowerLowQ"> 566 <property name="toolTip"> 567 <string>Exponent to apply to the Power_law function.</string> 568 </property> 569 </widget> 570 </item> 571 </layout> 572 </item> 573 <item row="0" column="0" colspan="2"> 574 <widget class="QCheckBox" name="chkLowQ"> 575 <property name="toolTip"> 576 <string>Check to extrapolate data at low-Q</string> 577 </property> 437 578 <property name="text"> 438 579 <string>Enable Low-Q extrapolation</string> … … 440 581 </widget> 441 582 </item> 442 <item row="1" column="0"> 443 <layout class="QHBoxLayout" name="horizontalLayout_3"> 444 <item> 445 <widget class="QLabel" name="label_16"> 446 <property name="text"> 447 <string>Npts:</string> 448 </property> 449 </widget> 450 </item> 451 <item> 452 <widget class="QLineEdit" name="lineEdit_10"/> 583 <item row="2" column="1"> 584 <layout class="QVBoxLayout" name="verticalLayout"> 585 <item> 586 <widget class="QRadioButton" name="rbFitLowQ"> 587 <property name="enabled"> 588 <bool>true</bool> 589 </property> 590 <property name="text"> 591 <string>Fit</string> 592 </property> 593 <property name="checkable"> 594 <bool>true</bool> 595 </property> 596 <property name="checked"> 597 <bool>true</bool> 598 </property> 599 <property name="autoExclusive"> 600 <bool>true</bool> 601 </property> 602 </widget> 603 </item> 604 <item> 605 <widget class="QRadioButton" name="rbFixLowQ"> 606 <property name="text"> 607 <string>Fix</string> 608 </property> 609 <property name="checkable"> 610 <bool>true</bool> 611 </property> 612 <property name="checked"> 613 <bool>false</bool> 614 </property> 615 <property name="autoExclusive"> 616 <bool>true</bool> 617 </property> 618 </widget> 453 619 </item> 454 620 </layout> 455 621 </item> 456 <item row="2" column="0">457 <layout class="QFormLayout" name="formLayout">458 <item row="0" column="0">459 <widget class="QRadioButton" name="radioButton">460 <property name="text">461 <string>Guinier</string>462 </property>463 </widget>464 </item>465 <item row="0" column="1">466 <widget class="QRadioButton" name="radioButton_3">467 <property name="text">468 <string>Fit</string>469 </property>470 </widget>471 </item>472 <item row="1" column="0">473 <widget class="QRadioButton" name="radioButton_2">474 <property name="text">475 <string>Power law</string>476 </property>477 </widget>478 </item>479 <item row="1" column="1">480 <widget class="QRadioButton" name="radioButton_4">481 <property name="text">482 <string>Fix</string>483 </property>484 </widget>485 </item>486 </layout>487 </item>488 <item row="3" column="0">489 <layout class="QHBoxLayout" name="horizontalLayout_6">490 <item>491 <widget class="QLabel" name="label_17">492 <property name="text">493 <string>Power:</string>494 </property>495 </widget>496 </item>497 <item>498 <widget class="QLineEdit" name="lineEdit_11"/>499 </item>500 </layout>501 </item>502 622 </layout> 503 623 </widget> 504 624 </item> 505 625 <item row="1" column="1"> 506 <widget class="QGroupBox" name="groupBox_ 6">626 <widget class="QGroupBox" name="groupBox_highQ"> 507 627 <property name="title"> 508 628 <string>High Q</string> … … 510 630 <layout class="QGridLayout" name="gridLayout_8"> 511 631 <item row="0" column="0"> 512 <widget class="QCheckBox" name="checkBox_2"> 632 <widget class="QCheckBox" name="chkHighQ"> 633 <property name="toolTip"> 634 <string>Check to extrapolate data at high-Q</string> 635 </property> 513 636 <property name="text"> 514 637 <string>Enable High-Q extrapolation</string> … … 526 649 </item> 527 650 <item> 528 <widget class="QLineEdit" name="lineEdit_12"/> 651 <widget class="QLineEdit" name="txtNptsHighQ"> 652 <property name="toolTip"> 653 <string>Number of Q points to consider 654 while extrapolating the high-Q region</string> 655 </property> 656 </widget> 529 657 </item> 530 658 </layout> 531 659 </item> 532 660 <item row="2" column="0"> 533 <layout class="Q FormLayout" name="formLayout_2">661 <layout class="QGridLayout" name="gridLayout_13"> 534 662 <item row="0" column="0"> 535 <widget class="QRadioButton" name="r adioButton_7">663 <widget class="QRadioButton" name="rbFitHighQ"> 536 664 <property name="text"> 537 665 <string>Fit</string> 538 666 </property> 667 <property name="checkable"> 668 <bool>true</bool> 669 </property> 670 <property name="checked"> 671 <bool>false</bool> 672 </property> 539 673 </widget> 540 674 </item> 541 675 <item row="1" column="0"> 542 <widget class="QRadioButton" name="r adioButton_8">676 <widget class="QRadioButton" name="rbFixHighQ"> 543 677 <property name="text"> 544 678 <string>Fix</string> 679 </property> 680 <property name="checked"> 681 <bool>true</bool> 545 682 </property> 546 683 </widget> … … 558 695 </item> 559 696 <item> 560 <widget class="QLineEdit" name="lineEdit_13"/> 697 <widget class="QLineEdit" name="txtPowerHighQ"> 698 <property name="toolTip"> 699 <string>Exponent to apply to the Power_law function.</string> 700 </property> 701 </widget> 561 702 </item> 562 703 </layout> … … 570 711 </layout> 571 712 </widget> 572 <widget class="QWidget" name="tab">573 <attribute name="title">574 <string>View on model</string>575 </attribute>576 <widget class="QTreeView" name="treeView">577 <property name="geometry">578 <rect>579 <x>5</x>580 <y>11</y>581 <width>431</width>582 <height>311</height>583 </rect>584 </property>585 </widget>586 </widget>587 713 </widget> 588 </item>589 <item row="1" column="0">590 <spacer name="verticalSpacer">591 <property name="orientation">592 <enum>Qt::Vertical</enum>593 </property>594 <property name="sizeHint" stdset="0">595 <size>596 <width>20</width>597 <height>2</height>598 </size>599 </property>600 </spacer>601 </item>602 <item row="2" column="0">603 <layout class="QHBoxLayout" name="horizontalLayout_8">604 <item>605 <widget class="QPushButton" name="pushButton">606 <property name="text">607 <string>Calculate</string>608 </property>609 </widget>610 </item>611 <item>612 <spacer name="horizontalSpacer">613 <property name="orientation">614 <enum>Qt::Horizontal</enum>615 </property>616 <property name="sizeHint" stdset="0">617 <size>618 <width>40</width>619 <height>20</height>620 </size>621 </property>622 </spacer>623 </item>624 <item>625 <widget class="QPushButton" name="pushButton_2">626 <property name="text">627 <string>Status</string>628 </property>629 </widget>630 </item>631 <item>632 <widget class="QPushButton" name="pushButton_3">633 <property name="text">634 <string>Help</string>635 </property>636 </widget>637 </item>638 </layout>639 714 </item> 640 715 </layout>
Note: See TracChangeset
for help on using the changeset viewer.