Changes in / [b1b71ad:186d678] in sasview
- Location:
- src/sas/qtgui
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
rb1b71ad r722b7d6 545 545 pass 546 546 547 def sendData(self, event ):547 def sendData(self, event=None): 548 548 """ 549 549 Send selected item data to the current perspective and set the relevant notifiers … … 1371 1371 Mask Editor for 2D plots 1372 1372 """ 1373 msg = QtWidgets.QMessageBox() 1374 msg.setIcon(QtWidgets.QMessageBox.Information) 1375 msg.setText("Error: cannot apply mask.\n"+ 1376 "Please select a 2D dataset.") 1377 msg.setStandardButtons(QtWidgets.QMessageBox.Ok) 1378 1373 1379 try: 1374 1380 if data is None or not isinstance(data, Data2D): 1381 # if data wasn't passed - try to get it from 1382 # the currently selected item 1375 1383 index = self.current_view.selectedIndexes()[0] 1376 1384 proxy = self.current_view.model() … … 1381 1389 1382 1390 if data is None or not isinstance(data, Data2D): 1383 msg = QtWidgets.QMessageBox() 1384 msg.setIcon(QtWidgets.QMessageBox.Information) 1385 msg.setText("Error: cannot apply mask. \ 1386 Please select a 2D dataset.") 1387 msg.setStandardButtons(QtWidgets.QMessageBox.Cancel) 1391 # If data is still not right, complain 1388 1392 msg.exec_() 1389 1393 return 1390 1394 except: 1391 msg = QtWidgets.QMessageBox()1392 msg.setIcon(QtWidgets.QMessageBox.Information)1393 msg.setText("Error: No dataset selected. \1394 Please select a 2D dataset.")1395 msg.setStandardButtons(QtWidgets.QMessageBox.Cancel)1396 1395 msg.exec_() 1397 1396 return -
src/sas/qtgui/MainWindow/GuiManager.py
rb1b71ad r0c83303 10 10 from PyQt5.QtGui import * 11 11 from PyQt5.QtCore import Qt, QLocale, QUrl 12 13 import matplotlib as mpl 14 mpl.use("Qt5Agg") 12 15 13 16 from twisted.internet import reactor … … 868 871 self.results_frame.setVisible(True) 869 872 if output_data: 870 self.results_panel.onPlotResults(output_data )873 self.results_panel.onPlotResults(output_data, optimizer=self.perspective().optimizer) 871 874 872 875 def actionAdd_Custom_Model(self): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r75906a1 r0c83303 294 294 self.has_magnet_error_column = False 295 295 296 # Enablement of comboboxes 297 self.enabled_cbmodel = False 298 self.enabled_sfmodel = False 299 296 300 # If the widget generated theory item, save it 297 301 self.theory_item = None … … 460 464 self.cbModel.setEnabled(False) 461 465 self.lblModel.setEnabled(False) 466 self.enabled_cbmodel = False 462 467 463 468 def enableModelCombo(self): … … 465 470 self.cbModel.setEnabled(True) 466 471 self.lblModel.setEnabled(True) 472 self.enabled_cbmodel = True 467 473 468 474 def disableStructureCombo(self): … … 470 476 self.cbStructureFactor.setEnabled(False) 471 477 self.lblStructure.setEnabled(False) 478 self.enabled_sfmodel = False 472 479 473 480 def enableStructureCombo(self): … … 475 482 self.cbStructureFactor.setEnabled(True) 476 483 self.lblStructure.setEnabled(True) 484 self.enabled_sfmodel = True 477 485 478 486 def togglePoly(self, isChecked): … … 1009 1017 Checks if the current model has magnetic scattering implemented 1010 1018 """ 1011 current_model = self.cbModel.currentText() 1012 return self.is2D and current_model in self.MAGNETIC_MODELS 1019 has_params = False 1020 if self.kernel_module: 1021 has_mag_params = len(self.kernel_module.magnetic_params) > 0 1022 return self.is2D and has_mag_params 1013 1023 1014 1024 def onSelectModel(self): … … 1034 1044 if not model: 1035 1045 return 1046 1036 1047 self.chkMagnetism.setEnabled(self.canHaveMagnetism()) 1037 1048 self.chkMagnetism.setEnabled(self.canHaveMagnetism()) … … 1175 1186 self.SASModelToQModel(model, structure_factor) 1176 1187 1188 # Enable magnetism checkbox for selected models 1189 self.chkMagnetism.setEnabled(self.canHaveMagnetism()) 1190 self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.chkMagnetism.isChecked() and self.canHaveMagnetism()) 1191 1192 # Update column widths 1177 1193 for column, width in self.lstParamHeaderSizes.items(): 1178 1194 self.lstParams.setColumnWidth(column, width) … … 1573 1589 if param_dict is None: 1574 1590 return 1575 if hasattr(res, 'convergence') and len(res.convergence)>0: 1576 self.communicate.resultPlotUpdateSignal.emit(result[0]) 1591 self.communicate.resultPlotUpdateSignal.emit(result[0]) 1577 1592 1578 1593 elapsed = result[1] … … 3110 3125 shell_par = None 3111 3126 for par in kernel_pars: 3112 if par.name == param_name: 3127 parname = par.name 3128 if '[' in parname: 3129 parname = parname[:parname.index('[')] 3130 if parname == param_name: 3113 3131 shell_par = par 3114 3132 break 3115 if not shell_par:3133 if shell_par is None: 3116 3134 logger.error("Could not find %s in kernel parameters.", param_name) 3135 return 3117 3136 default_shell_count = shell_par.default 3118 3137 shell_min = 0 … … 3124 3143 # no info about limits 3125 3144 pass 3145 except Exception as ex: 3146 logging.error("Badly defined multiplicity: "+ str(ex)) 3147 return 3126 3148 # don't update the kernel here - this data is display only 3127 3149 self._model_model.blockSignals(True) … … 3130 3152 self._model_model.blockSignals(False) 3131 3153 3154 ## Respond to index change 3155 #func.currentTextChanged.connect(self.modifyShellsInList) 3156 3157 # Respond to button press 3158 button.clicked.connect(self.onShowSLDProfile) 3159 3160 # Available range of shells displayed in the combobox 3161 func.addItems([str(i) for i in range(shell_min, shell_max+1)]) 3162 3132 3163 # Respond to index change 3133 3164 func.currentTextChanged.connect(self.modifyShellsInList) 3134 3165 3135 # Respond to button press3136 button.clicked.connect(self.onShowSLDProfile)3137 3138 # Available range of shells displayed in the combobox3139 func.addItems([str(i) for i in range(shell_min, shell_max+1)])3140 3141 3166 # Add default number of shells to the model 3142 3167 func.setCurrentText(str(default_shell_count)) 3168 self.modifyShellsInList(str(default_shell_count)) 3143 3169 3144 3170 def modifyShellsInList(self, text): … … 3188 3214 """ 3189 3215 # get profile data 3190 x, y = self.kernel_module.getProfile() 3216 try: 3217 x, y = self.kernel_module.getProfile() 3218 except TypeError: 3219 msg = "SLD profile calculation failed." 3220 logging.error(msg) 3221 return 3222 3191 3223 y *= 1.0e6 3192 3224 profile_data = Data1D(x=x, y=y) … … 3221 3253 3222 3254 self.cbCategory.setEnabled(enabled) 3223 self.cbModel.setEnabled(enabled) 3255 3256 if enabled: 3257 # worry about original enablement of model and SF 3258 self.cbModel.setEnabled(self.enabled_cbmodel) 3259 self.cbStructureFactor.setEnabled(self.enabled_sfmodel) 3260 else: 3261 self.cbModel.setEnabled(enabled) 3262 self.cbStructureFactor.setEnabled(enabled) 3263 3224 3264 self.cmdPlot.setEnabled(enabled) 3225 3265 -
src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py
rf20ea3f r04e1c80 220 220 self.txtSmearDown.setEnabled(True) 221 221 self.txtSmearUp.setEnabled(True) 222 self.txtSmearDown.setText(str(0.0))223 self.txtSmearUp.setText(str(0.0))222 #self.txtSmearDown.setText(str(0.0)) 223 #self.txtSmearUp.setText(str(0.0)) 224 224 225 225 def setSlitLabels(self): … … 235 235 self.txtSmearDown.setEnabled(True) 236 236 self.txtSmearUp.setEnabled(True) 237 self.txtSmearDown.setText(str(0.0))238 self.txtSmearUp.setText(str(0.0))237 #self.txtSmearDown.setText(str(0.0)) 238 #self.txtSmearUp.setText(str(0.0)) 239 239 240 240 def setDQLabels(self): … … 330 330 """ 331 331 _, accuracy, d_height, d_width = self.state() 332 332 333 # Check changes in slit width 333 334 if d_width is None: … … 337 338 338 339 if isinstance(self.data, Data2D): 340 self.current_smearer = smear_selection(self.data, self.kernel_model) 339 341 return 340 342 # make sure once more if it is smearer -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r2eeda93 rec4a143 185 185 186 186 # Observe no such luck 187 self.assertEqual(self.widget.cbCategory.currentIndex(), 7)187 self.assertEqual(self.widget.cbCategory.currentIndex(), 6) 188 188 self.assertEqual(self.widget.cbModel.count(), 29) 189 189 … … 219 219 # 220 220 # Now change the model 221 <<<<<<< HEAD 221 222 self.widget.cbModel.setCurrentIndex(4) 223 ======= 224 self.widget.cbModel.setCurrentIndex(2) 225 >>>>>>> ESS_GUI 222 226 self.assertEqual(self.widget.cbModel.currentText(),'dab') 223 227 -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
r906e0c7 r722b7d6 13 13 Overwrite generic constructor to allow for some globals 14 14 """ 15 super( QtWidgets.QStyledItemDelegate, self).__init__()15 super(ModelViewDelegate, self).__init__() 16 16 17 17 # Main parameter table view columns … … 125 125 Overwrite generic constructor to allow for some globals 126 126 """ 127 super( QtWidgets.QStyledItemDelegate, self).__init__()127 super(PolyViewDelegate, self).__init__() 128 128 129 129 self.poly_parameter = 0 … … 226 226 Overwrite generic constructor to allow for some globals 227 227 """ 228 super( QtWidgets.QStyledItemDelegate, self).__init__()228 super(MagnetismViewDelegate, self).__init__() 229 229 230 230 self.mag_parameter = 0 -
src/sas/qtgui/Plotting/Plotter2D.py
r8fad50b rf5cec7c 9 9 10 10 11 #import sys12 #print("SYS.PATH = ", sys.path)13 11 import matplotlib as mpl 14 mpl.use("Qt5Agg")15 12 DEFAULT_CMAP = mpl.cm.jet 16 13 … … 116 113 """ 117 114 # Toggle the scale 118 zmin_temp = self.zmin if self.zmin else MIN_Z115 zmin_temp = self.zmin 119 116 zmax_temp = self.zmax 120 117 # self.scale predefined in the baseclass … … 425 422 if self.scale == 'log_{10}': 426 423 try: 427 if self.zmin <= 0and len(output[output > 0]) > 0:424 if self.zmin is None and len(output[output > 0]) > 0: 428 425 zmin_temp = self.zmin 429 426 output[output > 0] = numpy.log10(output[output > 0]) … … 437 434 except: 438 435 #Too many problems in 2D plot with scale 439 output[output > 0] = numpy.log10(output[output > 0])440 436 pass 441 437 … … 453 449 else: 454 450 self.im = self.ax.imshow(output, interpolation='nearest', 451 origin='lower', 455 452 vmin=zmin_temp, vmax=zmax_temp, 456 453 cmap=self.cmap, -
src/sas/qtgui/Utilities/ResultPanel.py
r8748751 r0c83303 55 55 sys.modules['bumps.gui.plot_view'] = PlotView 56 56 57 def onPlotResults(self, results ):57 def onPlotResults(self, results, optimizer="Unknown"): 58 58 # Clear up previous results 59 59 for view in (self.convergenceView, self.correlationView, 60 60 self.uncertaintyView, self.traceView): 61 61 view.close() 62 # close all tabs. REMEMBER TO USE REVERSED RANGE!!! 63 for index in reversed(range(self.count())): 64 self.removeTab(index) 62 65 63 66 result = results[0][0] 64 67 filename = result.data.sas_data.filename 65 current_ time = datetime.datetime.now().strftime("%I:%M%p, %B %d, %Y")66 self.setWindowTitle(self.window_name + " - " + filename + " - " + current_ time)67 if hasattr(result, 'convergence') :68 current_optimizer = optimizer 69 self.setWindowTitle(self.window_name + " - " + filename + " - " + current_optimizer) 70 if hasattr(result, 'convergence') and len(result.convergence) > 0: 68 71 best, pop = result.convergence[:, 0], result.convergence[:, 1:] 69 72 self.convergenceView.update(best, pop) … … 89 92 for view in (self.correlationView, self.uncertaintyView, self.traceView): 90 93 view.close() 94 # no tabs in the widget - possibly LM optimizer. Mark "closed" 95 if self.count()==0: 96 self.close() 91 97 92 98 def closeEvent(self, event):
Note: See TracChangeset
for help on using the changeset viewer.