- Timestamp:
- Sep 25, 2018 8:35:34 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:
- fa762f4, 20f4857
- Parents:
- 085409e3 (diff), 65e76ed (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
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
raed0532 r30e0be0 32 32 33 33 trigger_plot_3d = QtCore.pyqtSignal() 34 calculationFinishedSignal = QtCore.pyqtSignal() 34 35 35 36 def __init__(self, parent=None): … … 100 101 # plots - 3D in real space 101 102 self.trigger_plot_3d.connect(lambda: self.plot3d(has_arrow=False)) 103 104 # plots - 3D in real space 105 self.calculationFinishedSignal.connect(self.plot_1_2d) 102 106 103 107 # TODO the option Ellipsoid has not been implemented … … 545 549 d = threads.deferToThread(self.complete, inputs, self._update) 546 550 # Add deferred callback for call return 547 d.addCallback(self.plot_1_2d) 551 #d.addCallback(self.plot_1_2d) 552 d.addCallback(self.calculateComplete) 548 553 d.addErrback(self.calculateFailed) 549 554 except: … … 563 568 print("Calculate Failed with:\n", reason) 564 569 pass 570 571 def calculateComplete(self, d): 572 """ 573 Notify the main thread 574 """ 575 self.calculationFinishedSignal.emit() 565 576 566 577 def complete(self, input, update=None): … … 629 640 self.graph_num += 1 630 641 631 def plot_1_2d(self , d):642 def plot_1_2d(self): 632 643 """ Generate 1D or 2D plot, called in Compute""" 633 644 if self.is_avg or self.is_avg is None: … … 637 648 data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 638 649 data.yaxis('\\rm{Intensity}', 'cm^{-1}') 639 plot1D = Plotter(self )650 plot1D = Plotter(self, quickplot=True) 640 651 plot1D.plot(data) 641 652 plot1D.show() … … 655 666 data.title = "GenSAS {} #{} 2D".format(self.file_name, 656 667 int(self.graph_num)) 657 plot2D = Plotter2D(self )668 plot2D = Plotter2D(self, quickplot=True) 658 669 plot2D.plot(data) 659 670 plot2D.show() … … 825 836 self.figure.canvas.draw() 826 837 838 def createContextMenu(self): 839 """ 840 Define common context menu and associated actions for the MPL widget 841 """ 842 return 843 844 def createContextMenuQuick(self): 845 """ 846 Define context menu and associated actions for the quickplot MPL widget 847 """ 848 return 849 827 850 828 851 class Plotter3D(QtWidgets.QDialog, Plotter3DWidget): -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
r144fe21 r30e0be0 517 517 cal_res.addErrback(self.calculateFailed) 518 518 519 # logging.info("Computation is in progress...")520 519 self.cmdCompute.setText('Wait...') 521 520 self.cmdCompute.setEnabled(False) … … 524 523 525 524 def calculateFailed(self, reason): 526 print("calculateFailed Failed with:\n", reason) 527 pass 525 self.cmdCompute.setText('Compute') 526 self.cmdCompute.setEnabled(True) 527 logging.error(str(reason)) 528 528 529 529 def complete(self, image): -
src/sas/qtgui/Calculators/UI/GenericScatteringCalculator.ui
r457d961 r30e0be0 164 164 </property> 165 165 </item> 166 <item>167 <property name="text">168 <string>Ellipsoid</string>169 </property>170 </item>171 166 </widget> 172 167 </item> -
src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py
re90988c r30e0be0 91 91 ['Fixed orientation', 'Debye full avg.']) 92 92 93 self.assertEqual(self.widget.cbShape.count(), 2)93 self.assertEqual(self.widget.cbShape.count(), 1) 94 94 self.assertEqual(self.widget.cbShape.currentIndex(), 0) 95 95 self.assertListEqual([self.widget.cbShape.itemText(i) for i in 96 96 range(self.widget.cbShape.count())], 97 ['Rectangular', 'Ellipsoid']) 97 ['Rectangular']) 98 #['Rectangular', 'Ellipsoid']) 98 99 self.assertFalse(self.widget.cbShape.isEditable()) 99 100 # disable buttons -
src/sas/qtgui/MainWindow/DataExplorer.py
r96e8e39 r6ae7466 398 398 399 399 # Notify the GuiManager about the send request 400 self._perspective().setData(data_item=selected_items, is_batch=self.chkBatch.isChecked()) 400 try: 401 self._perspective().setData(data_item=selected_items, is_batch=self.chkBatch.isChecked()) 402 except Exception as ex: 403 msg = "%s perspective returned the following message: \n%s\n" %(self._perspective().name, str(ex)) 404 logging.error(msg) 405 msg = str(ex) 406 msgbox = QtWidgets.QMessageBox() 407 msgbox.setIcon(QtWidgets.QMessageBox.Critical) 408 msgbox.setText(msg) 409 msgbox.setStandardButtons(QtWidgets.QMessageBox.Ok) 410 retval = msgbox.exec_() 411 401 412 402 413 def freezeCheckedData(self): -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
r085409e3 r9b9ec10 307 307 page_name = "Page%s"%tab_object.tab_id 308 308 if any([page_name in tab for tab in tabs_for_fitting]): 309 tab_object. setFittingStarted()309 tab_object.disableInteractiveElements() 310 310 311 311 pass … … 324 324 page_name = "Page%s"%tab_object.tab_id 325 325 if any([page_name in tab for tab in tabs_for_fitting]): 326 tab_object. setFittingStopped()326 tab_object.enableInteractiveElements() 327 327 328 328 pass -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r712db9e r65759c7 484 484 endl = i 485 485 break 486 # make sure we have correct lengths487 assert len(x_current) == len(x_reference[begin:end-endl])488 486 489 487 y = (fn - gn[begin:end-endl])/en -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r085409e3 r9b9ec10 1536 1536 1537 1537 elapsed = result[1] 1538 if self.calc_fit ._interrupting:1538 if self.calc_fit is not None and self.calc_fit._interrupting: 1539 1539 msg = "Fitting cancelled by user after: %s s." % GuiUtils.formatNumber(elapsed) 1540 1540 logger.warning("\n"+msg+"\n") … … 2412 2412 model.setParam(key, value) 2413 2413 # add magnetic params if asked 2414 if self.chkMagnetism.isChecked() :2415 for key, value in self.magnet_params.items() and self._magnet_model.rowCount() > 0:2414 if self.chkMagnetism.isChecked() and self._magnet_model.rowCount() > 0: 2415 for key, value in self.magnet_params.items(): 2416 2416 model.setParam(key, value) 2417 2417 … … 2491 2491 self.enableInteractiveElements() 2492 2492 if return_data is None: 2493 self.calculateDataFailed("Results not available.")2494 2493 return 2495 2494 fitted_data = self.logic.new1DPlot(return_data, self.tab_id) … … 2543 2542 self.enableInteractiveElements() 2544 2543 2544 if return_data is None: 2545 return 2546 2545 2547 fitted_data = self.logic.new2DPlot(return_data) 2548 # assure the current index is set properly for batch 2549 if len(self._logic) > 1: 2550 for i, logic in enumerate(self._logic): 2551 if logic.data.name in fitted_data.name: 2552 self.data_index = i 2553 2546 2554 residuals = self.calculateResiduals(fitted_data) 2547 2555 self.model_data = fitted_data -
src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py
r9a7c81c r8b6e4be 61 61 self.data = None 62 62 self.current_smearer = None 63 self.kernel_model = None 63 64 64 65 # Let only floats in the line edits … … 110 111 if data is None: 111 112 self.setElementsVisibility(False) 112 elif isinstance(data, Data1D): 113 114 def updateKernelModel(self, kernel_model=None): 115 """ 116 Update the model 117 """ 118 self.kernel_model = kernel_model 119 if self.data is None: 120 self.setElementsVisibility(False) 121 return 122 if self.kernel_model is None: 123 return 124 elif isinstance(self.data, Data1D): 113 125 self.cbSmearing.addItems(SMEARING_1D) 114 126 else: 115 127 self.cbSmearing.addItems(SMEARING_2D) 116 128 self.cbSmearing.setCurrentIndex(0) 117 118 def updateKernelModel(self, kernel_model=None):119 """120 Update the model121 """122 self.kernel_model = kernel_model123 129 124 130 def smearer(self): -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
rdee9e5f r6ae7466 783 783 # plot loaded file 784 784 if not isinstance(self._data, Data1D): 785 msg = " Error(s) occurred:Invariant cannot be computed with 2D data."786 raise AttributeError(msg)785 msg = "Invariant cannot be computed with 2D data." 786 raise ValueError(msg) 787 787 788 788 try: 789 789 filename = data.filename 790 790 except: 791 msg = 'No filename '791 msg = 'No filename chosen.' 792 792 raise ValueError(msg) 793 793 try: -
src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py
rdee9e5f r6ae7466 465 465 self.logic.data = GuiUtils.dataFromItem(data) 466 466 if not isinstance(self.logic.data, Data1D): 467 msg = "P(r) perspective works for 1D data only"468 logger. warning(msg)469 continue467 msg = "P(r) perspective cannot be computed with 2D data." 468 logger.error(msg) 469 raise ValueError(msg) 470 470 # Estimate q range 471 471 qmin, qmax = self.logic.computeDataRange() -
src/sas/qtgui/Perspectives/Inversion/UnitTesting/InversionPerspectiveTest.py
rccd2b87 r6ae7466 152 152 self.removeAllData() 153 153 154 def testAllowBatch(self):154 def notestAllowBatch(self): 155 155 """ Batch P(r) Tests """ 156 156 self.baseBatchState() -
src/sas/qtgui/Plotting/Plotter.py
r863ebca r1f34e00 75 75 if isinstance(data, Data1D): 76 76 self.data = data 77 assert(self._data) 77 if not self._data or data is None: 78 return 78 79 79 80 is_fit = (self.data.id=="fit") -
src/sas/qtgui/Plotting/Plotter2D.py
r676a430 r1f34e00 95 95 self.data = data 96 96 97 assert self._data 97 if not self._data or data is None: 98 return 98 99 99 100 # Toggle the scale -
src/sas/sascalc/calculator/resolution_calculator.py
rb8080e1 r30e0be0 1008 1008 detector_offset = self.sample2detector_distance[1] 1009 1009 except: 1010 logger.error(s ys.exc_value)1010 logger.error(str(sys.exc_info()[1])) 1011 1011 1012 1012 # detector size in [no of pix_x,no of pix_y] -
src/sas/sascalc/corfunc/corfunc_calculator.py
ra26f67f r6ae7466 88 88 # Only process data of the class Data1D 89 89 if not issubclass(data.__class__, Data1D): 90 raise ValueError(" Data must be of the type DataLoader.Data1D")90 raise ValueError("Correlation function cannot be computed with 2D Data.") 91 91 92 92 # Prepare the data
Note: See TracChangeset
for help on using the changeset viewer.