Changeset 30e0be0 in sasview for src/sas


Ignore:
Timestamp:
Sep 25, 2018 4:35:13 AM (6 years ago)
Author:
Piotr Rozyczko <piotr.rozyczko@…>
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:
4e85147
Parents:
6923863
Message:

Updates to the scattering calculator SASVIEW-1147

Location:
src/sas
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Calculators/GenericScatteringCalculator.py

    raed0532 r30e0be0  
    3232 
    3333    trigger_plot_3d = QtCore.pyqtSignal() 
     34    calculationFinishedSignal = QtCore.pyqtSignal() 
    3435 
    3536    def __init__(self, parent=None): 
     
    100101        # plots - 3D in real space 
    101102        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) 
    102106 
    103107        # TODO the option Ellipsoid has not been implemented 
     
    545549            d = threads.deferToThread(self.complete, inputs, self._update) 
    546550            # 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) 
    548553            d.addErrback(self.calculateFailed) 
    549554        except: 
     
    563568        print("Calculate Failed with:\n", reason) 
    564569        pass 
     570 
     571    def calculateComplete(self, d): 
     572        """ 
     573        Notify the main thread 
     574        """ 
     575        self.calculationFinishedSignal.emit() 
    565576 
    566577    def complete(self, input, update=None): 
     
    629640        self.graph_num += 1 
    630641 
    631     def plot_1_2d(self, d): 
     642    def plot_1_2d(self): 
    632643        """ Generate 1D or 2D plot, called in Compute""" 
    633644        if self.is_avg or self.is_avg is None: 
     
    637648            data.xaxis('\\rm{Q_{x}}', '\AA^{-1}') 
    638649            data.yaxis('\\rm{Intensity}', 'cm^{-1}') 
    639             plot1D = Plotter(self) 
     650            plot1D = Plotter(self, quickplot=True) 
    640651            plot1D.plot(data) 
    641652            plot1D.show() 
     
    655666            data.title = "GenSAS {}  #{} 2D".format(self.file_name, 
    656667                                                    int(self.graph_num)) 
    657             plot2D = Plotter2D(self) 
     668            plot2D = Plotter2D(self, quickplot=True) 
    658669            plot2D.plot(data) 
    659670            plot2D.show() 
     
    825836        self.figure.canvas.draw() 
    826837 
     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 
    827850 
    828851class Plotter3D(QtWidgets.QDialog, Plotter3DWidget): 
  • src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py

    r144fe21 r30e0be0  
    517517            cal_res.addErrback(self.calculateFailed) 
    518518 
    519             # logging.info("Computation is in progress...") 
    520519            self.cmdCompute.setText('Wait...') 
    521520            self.cmdCompute.setEnabled(False) 
     
    524523 
    525524    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)) 
    528528 
    529529    def complete(self, image): 
  • src/sas/qtgui/Calculators/UI/GenericScatteringCalculator.ui

    r457d961 r30e0be0  
    164164           </property> 
    165165          </item> 
    166           <item> 
    167            <property name="text"> 
    168             <string>Ellipsoid</string> 
    169            </property> 
    170           </item> 
    171166         </widget> 
    172167        </item> 
  • src/sas/qtgui/Calculators/UnitTesting/GenericScatteringCalculatorTest.py

    re90988c r30e0be0  
    9191                             ['Fixed orientation', 'Debye full avg.']) 
    9292 
    93         self.assertEqual(self.widget.cbShape.count(), 2) 
     93        self.assertEqual(self.widget.cbShape.count(), 1) 
    9494        self.assertEqual(self.widget.cbShape.currentIndex(), 0) 
    9595        self.assertListEqual([self.widget.cbShape.itemText(i) for i in 
    9696                              range(self.widget.cbShape.count())], 
    97                              ['Rectangular', 'Ellipsoid']) 
     97                             ['Rectangular']) 
     98                             #['Rectangular', 'Ellipsoid']) 
    9899        self.assertFalse(self.widget.cbShape.isEditable()) 
    99100        # disable buttons 
  • src/sas/sascalc/calculator/resolution_calculator.py

    rb8080e1 r30e0be0  
    10081008            detector_offset = self.sample2detector_distance[1] 
    10091009        except: 
    1010             logger.error(sys.exc_value) 
     1010            logger.error(str(sys.exc_info()[1])) 
    10111011 
    10121012        # detector size in [no of pix_x,no of pix_y] 
Note: See TracChangeset for help on using the changeset viewer.