- Timestamp:
- Sep 9, 2018 3:32:42 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:
- fa3da01
- Parents:
- 5a96a72 (diff), 0dcb71d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/qtgui
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/MainWindow/DataExplorer.py
r0cd98a1 r5d28d6b 98 98 self.communicator.maskEditorSignal.connect(self.showEditDataMask) 99 99 self.communicator.extMaskEditorSignal.connect(self.extShowEditDataMask) 100 self.communicator.changeDataExplorerTabSignal.connect(self.changeTabs) 100 101 101 102 self.cbgraph.editTextChanged.connect(self.enableGraphCombo) … … 139 140 else: 140 141 self.current_view = self.freezeView 142 143 def changeTabs(self, tab=0): 144 """ 145 Switch tabs of the data explorer 146 0: data tab 147 1: theory tab 148 """ 149 assert(tab in [0,1]) 150 self.setCurrentIndex(tab) 141 151 142 152 def displayHelp(self): … … 553 563 return item 554 564 555 def displayFile(self, filename=None, is_data=True ):565 def displayFile(self, filename=None, is_data=True, id=None): 556 566 """ 557 567 Forces display of charts for the given filename … … 560 570 # Now query the model item for available plots 561 571 plots = GuiUtils.plotsFromFilename(filename, model) 562 572 # Each fitpage contains the name based on fit widget number 573 fitpage_name = "" if id is None else "M"+str(id) 563 574 new_plots = [] 564 575 for item, plot in plots.items(): 565 if not self.updatePlot(plot): 566 # Don't plot intermediate results, e.g. P(Q), S(Q) 567 match = GuiUtils.theory_plot_ID_pattern.match(plot.id) 568 # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 569 if match and match.groups()[1] != None: 570 continue 576 if self.updatePlot(plot) and filename != plot.name: 577 continue 578 # Don't plot intermediate results, e.g. P(Q), S(Q) 579 match = GuiUtils.theory_plot_ID_pattern.match(plot.id) 580 # 2nd match group contains the identifier for the intermediate result, if present (e.g. "[P(Q)]") 581 if match and match.groups()[1] != None: 582 continue 583 # Don't include plots from different fitpages, but always include the original data 584 if fitpage_name in plot.name or filename == plot.name: 571 585 # 'sophisticated' test to generate standalone plot for residuals 572 586 if 'esiduals' in plot.title: … … 579 593 self.plotData(new_plots) 580 594 581 def displayData(self, data_list ):595 def displayData(self, data_list, id): 582 596 """ 583 597 Forces display of charts for the given data set … … 588 602 # the data explorer indices. 589 603 filename = plot_to_show.filename 590 self.displayFile(filename=filename, is_data=plot_to_show.is_data )604 self.displayFile(filename=filename, is_data=plot_to_show.is_data, id=id) 591 605 592 606 def addDataPlot2D(self, plot_set, item): -
src/sas/qtgui/MainWindow/GuiManager.py
r339e22b r5b144c6 921 921 self.filesWidget.displayFile(filename=filename, is_data=True) 922 922 923 def showPlot(self, plot ):923 def showPlot(self, plot, id): 924 924 """ 925 925 Pass the show plot request to the data explorer 926 926 """ 927 927 if hasattr(self, "filesWidget"): 928 self.filesWidget.displayData(plot )928 self.filesWidget.displayData(plot, id) 929 929 930 930 def uncheckAllMenuItems(self, menuObject): -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r5a96a72 re4041a2 1841 1841 data_to_show = self.data if self.data_is_loaded else self.model_data 1842 1842 if data_to_show is not None: 1843 self.communicate.plotRequestedSignal.emit([data_to_show] )1843 self.communicate.plotRequestedSignal.emit([data_to_show], self.tab_id) 1844 1844 1845 1845 def onOptionsUpdate(self): … … 2351 2351 fitted_data.symbol = "Line" 2352 2352 self.createTheoryIndex(fitted_data) 2353 # Switch to the theory tab for user's glee 2354 self.communicate.changeDataExplorerTabSignal.emit(1) 2353 2355 2354 2356 def updateModelIndex(self, fitted_data): … … 2486 2488 2487 2489 if self.data_is_loaded: 2490 # delete any plots associated with the data that were not updated (e.g. to remove beta(Q), S_eff(Q)) 2488 2491 GuiUtils.deleteRedundantPlots(self.all_data[self.data_index], new_plots) 2492 pass 2489 2493 else: 2490 2494 # delete theory items for the model, in order to get rid of any redundant items, e.g. beta(Q), S_eff(Q) … … 3220 3224 param_value = str(self._model_model.item(row, 1).text()) 3221 3225 param_error = None 3226 param_min = None 3227 param_max = None 3222 3228 column_offset = 0 3223 3229 if self.has_error_column: 3224 3230 param_error = str(self._model_model.item(row, 2).text()) 3225 3231 column_offset = 1 3226 param_min = str(self._model_model.item(row, 2+column_offset).text()) 3227 param_max = str(self._model_model.item(row, 3+column_offset).text()) 3232 3233 try: 3234 param_min = str(self._model_model.item(row, 2+column_offset).text()) 3235 param_max = str(self._model_model.item(row, 3+column_offset).text()) 3236 except: 3237 pass 3238 3228 3239 param_list.append([param_name, param_checked, param_value, param_error, param_min, param_max]) 3229 3240 … … 3315 3326 3316 3327 # limits 3317 limit_lo = item[3] 3318 context[name].append(limit_lo) 3319 limit_hi = item[4] 3320 context[name].append(limit_hi) 3328 try: 3329 limit_lo = item[3] 3330 context[name].append(limit_lo) 3331 limit_hi = item[4] 3332 context[name].append(limit_hi) 3333 except: 3334 pass 3321 3335 3322 3336 # Polydisp … … 3377 3391 ioffset = 1 3378 3392 # min/max 3379 param_repr = GuiUtils.formatNumber(param_dict[param_name][2+ioffset], high=True) 3380 self._model_model.item(row, 2+ioffset).setText(param_repr) 3381 param_repr = GuiUtils.formatNumber(param_dict[param_name][3+ioffset], high=True) 3382 self._model_model.item(row, 3+ioffset).setText(param_repr) 3393 try: 3394 param_repr = GuiUtils.formatNumber(param_dict[param_name][2+ioffset], high=True) 3395 self._model_model.item(row, 2+ioffset).setText(param_repr) 3396 param_repr = GuiUtils.formatNumber(param_dict[param_name][3+ioffset], high=True) 3397 self._model_model.item(row, 3+ioffset).setText(param_repr) 3398 except: 3399 pass 3400 3383 3401 self.setFocus() 3402 3384 3403 3385 3404 -
src/sas/qtgui/Plotting/Plotter.py
r0cd98a1 r5b144c6 561 561 562 562 #Remove another Fit, if exists 563 self.removePlot(" fit")563 self.removePlot("Fit") 564 564 565 565 self.fit_result.reset_view() -
src/sas/qtgui/Plotting/UnitTesting/PlotterTest.py
rb8080e1 r5b144c6 57 57 self.plotter.data = self.data 58 58 self.plotter.show() 59 FigureCanvas.draw _idle= MagicMock()59 FigureCanvas.draw = MagicMock() 60 60 61 61 self.plotter.plot(hide_error=False) 62 62 63 63 self.assertEqual(self.plotter.ax.get_xscale(), 'log') 64 self.assertTrue(FigureCanvas.draw _idle.called)64 self.assertTrue(FigureCanvas.draw.called) 65 65 66 66 self.plotter.figure.clf() … … 70 70 self.plotter.data = self.data 71 71 self.plotter.show() 72 FigureCanvas.draw _idle= MagicMock()72 FigureCanvas.draw = MagicMock() 73 73 74 74 self.plotter.plot(hide_error=True) 75 75 76 76 self.assertEqual(self.plotter.ax.get_yscale(), 'log') 77 self.assertTrue(FigureCanvas.draw _idle.called)77 self.assertTrue(FigureCanvas.draw.called) 78 78 self.plotter.figure.clf() 79 79 … … 91 91 self.plotter.data = data 92 92 self.plotter.show() 93 FigureCanvas.draw _idle= MagicMock()93 FigureCanvas.draw = MagicMock() 94 94 95 95 self.plotter.plot(hide_error=True) … … 97 97 self.assertEqual(self.plotter.ax.get_xscale(), 'linear') 98 98 self.assertEqual(self.plotter.ax.get_yscale(), 'linear') 99 self.assertTrue(FigureCanvas.draw _idle.called)99 self.assertTrue(FigureCanvas.draw.called) 100 100 101 101 def testCreateContextMenuQuick(self): … … 262 262 # Just this one plot 263 263 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) 264 self.plotter.onLinearFit( 1)264 self.plotter.onLinearFit('Test name') 265 265 266 266 # Check that exec_ got called … … 289 289 290 290 # Delete one set 291 self.plotter.onRemovePlot( 2)291 self.plotter.onRemovePlot('Test name 2') 292 292 # Assure we have two sets 293 293 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 1) … … 296 296 297 297 # Delete the remaining set 298 self.plotter.onRemovePlot( 1)298 self.plotter.onRemovePlot('Test name') 299 299 # Assure we have no plots 300 300 self.assertEqual(len(list(self.plotter.plot_dict.keys())), 0) … … 331 331 self.assertEqual(yl, "$YAXIS(cake)$") 332 332 # The hide_error flag should also remain 333 self.assertTrue(self.plotter.plot_dict[ 2].hide_error)333 self.assertTrue(self.plotter.plot_dict['Test name 2'].hide_error) 334 334 self.plotter.figure.clf() 335 335 … … 355 355 356 356 # Reverse the toggle 357 self.plotter.onToggleHideError( 2)357 self.plotter.onToggleHideError('Test name 2') 358 358 # See that the labels didn't change 359 359 xl = self.plotter.ax.xaxis.label.get_text() … … 362 362 self.assertEqual(yl, "$YAXIS(cake)$") 363 363 # The hide_error flag should toggle 364 self.assertEqual(self.plotter.plot_dict[ 2].hide_error, not error_status)364 self.assertEqual(self.plotter.plot_dict['Test name 2'].hide_error, not error_status) 365 365 self.plotter.figure.clf() 366 366 … … 417 417 self.assertEqual(yl, "$YAXIS(cake)$") 418 418 # The hide_error flag should be as set 419 self.assertEqual(self.plotter.plot_dict[ 2].hide_error, error_status)419 self.assertEqual(self.plotter.plot_dict['Test name 2'].hide_error, error_status) 420 420 self.plotter.figure.clf() 421 421 -
src/sas/qtgui/Utilities/GuiUtils.py
r339e22b r5d28d6b 225 225 # New plot requested from the GUI manager 226 226 # Old "NewPlotEvent" 227 plotRequestedSignal = QtCore.pyqtSignal(list )227 plotRequestedSignal = QtCore.pyqtSignal(list, int) 228 228 229 229 # Plot from file names … … 277 277 # Notify about new categories/models from category manager 278 278 updateModelCategoriesSignal = QtCore.pyqtSignal() 279 280 # Tell the data explorer to switch tabs 281 changeDataExplorerTabSignal = QtCore.pyqtSignal(int) 279 282 280 283 def updateModelItemWithPlot(item, update_data, name=""): … … 288 291 for index in range(item.rowCount()): 289 292 plot_item = item.child(index) 290 if plot_item.isCheckable(): 291 plot_data = plot_item.child(0).data() 292 if plot_data.id is not None and \ 293 (plot_data.name == update_data.name or plot_data.id == update_data.id): 293 if not plot_item.isCheckable(): 294 continue 295 plot_data = plot_item.child(0).data() 296 if plot_data.id is not None and \ 297 plot_data.name == update_data.name: 298 #(plot_data.name == update_data.name or plot_data.id == update_data.id): 294 299 # if plot_data.id is not None and plot_data.id == update_data.id: 295 296 297 298 299 300 301 302 300 # replace data section in item 301 plot_item.child(0).setData(update_data) 302 plot_item.setText(name) 303 # Plot title if any 304 if plot_item.child(1).hasChildren(): 305 plot_item.child(1).child(0).setText("Title: %s"%name) 306 # Force redisplay 307 return 303 308 304 309 # Create the new item -
src/sas/qtgui/Perspectives/Fitting/FittingLogic.py
r61f0c75 r5a96a72 220 220 return plots 221 221 222 def getScalarIntermediateResults(self, return_data): 223 """ 224 Returns a dict of scalar-only intermediate results from the return data. 225 """ 226 res = {} 227 for name, int_res in return_data["intermediate_results"].items(): 228 if isinstance(int_res, np.ndarray): 229 continue 230 res[name] = int_res 231 return res 232 222 233 def computeDataRange(self): 223 234 """
Note: See TracChangeset
for help on using the changeset viewer.