Changeset b0ba43e in sasview


Ignore:
Timestamp:
May 4, 2018 10:10:43 AM (2 years ago)
Author:
krzywon
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:
3c6ecd9
Parents:
72ecbdf2
Message:

Fix for P(r) thread error handling and Dmax explorer exception issues.

Location:
src/sas/qtgui/Perspectives/Inversion
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Inversion/DMaxExplorerWidget.py

    r72ecbdf2 rb0ba43e  
    8181 
    8282    def setupModel(self): 
     83        self.model.blockSignals(True) 
    8384        self.model.setItem(W.NPTS, QtGui.QStandardItem(str(self.nfunc))) 
     85        self.model.blockSignals(False) 
     86        self.model.blockSignals(True) 
    8487        self.model.setItem(W.DMIN, QtGui.QStandardItem("{:.1f}".format(0.9*self.pr_state.d_max))) 
     88        self.model.blockSignals(False) 
     89        self.model.blockSignals(True) 
    8590        self.model.setItem(W.DMAX, QtGui.QStandardItem("{:.1f}".format(1.1*self.pr_state.d_max))) 
     91        self.model.blockSignals(False) 
     92        self.model.blockSignals(True) 
    8693        self.model.setItem(W.VARIABLE, QtGui.QStandardItem( "χ²/dof")) 
     94        self.model.blockSignals(False) 
    8795 
    8896    def setupMapper(self): 
  • src/sas/qtgui/Perspectives/Inversion/InversionPerspective.py

    r72ecbdf2 rb0ba43e  
    309309                                            and not self.isCalculating) 
    310310        self.removeButton.setEnabled(self.logic.data_is_loaded) 
    311         self.explorerButton.setEnabled(self.logic.data_is_loaded) 
     311        self.explorerButton.setEnabled(self.logic.data_is_loaded 
     312                                       and np.all(self.logic.data.dy != 0)) 
    312313        self.stopButton.setVisible(self.isCalculating) 
    313314        self.regConstantSuggestionButton.setEnabled( 
     
    421422    def stopCalculation(self): 
    422423        """ Stop all threads, return to the base state and update GUI """ 
    423         if self.calcThread: 
    424             self.calcThread.stop() 
    425         if self.estimationThread: 
    426             self.estimationThread.stop() 
    427         if self.estimationThreadNT: 
    428             self.estimationThreadNT.stop() 
     424        self.stopCalcThread() 
     425        self.stopEstimationThread() 
     426        self.stopEstimateNTThread() 
    429427        # Show any batch calculations that successfully completed 
    430428        if self.isBatch and self.batchResultsWindow is not None: 
     
    631629        # Disable calculation buttons to prevent thread interference 
    632630 
    633         # If a thread is already started, stop it 
    634         if self.calcThread is not None and self.calcThread.isrunning(): 
    635             self.calcThread.stop() 
     631        # If the thread is already started, stop it 
     632        self.stopCalcThread() 
     633 
    636634        pr = self._calculator.clone() 
    637635        nfunc = self.getNFunc() 
     
    643641        self.calcThread.ready(2.5) 
    644642 
     643    def stopCalcThread(self): 
     644        """ Stops a thread if it exists and is running """ 
     645        if self.calcThread is not None and self.calcThread.isrunning(): 
     646            self.calcThread.stop() 
     647 
    645648    def performEstimateNT(self): 
    646649        """ 
     
    652655 
    653656        # If a thread is already started, stop it 
    654         if (self.estimationThreadNT is not None and 
    655                 self.estimationThreadNT.isrunning()): 
    656             self.estimationThreadNT.stop() 
     657        self.stopEstimateNTThread() 
     658 
    657659        pr = self._calculator.clone() 
    658660        # Skip the slit settings for the estimation 
     
    669671        self.estimationThreadNT.ready(2.5) 
    670672 
     673    def stopEstimateNTThread(self): 
     674        if (self.estimationThreadNT is not None and 
     675                self.estimationThreadNT.isrunning()): 
     676            self.estimationThreadNT.stop() 
     677 
    671678    def performEstimate(self): 
    672679        """ 
     
    676683 
    677684        # If a thread is already started, stop it 
    678         if (self.estimationThread is not None and 
    679                 self.estimationThread.isrunning()): 
    680             self.estimationThread.stop() 
     685        self.stopEstimationThread() 
     686 
    681687        self.estimationThread = EstimatePr(self._calculator.clone(), 
    682688                                           self.getNFunc(), 
     
    686692        self.estimationThread.queue() 
    687693        self.estimationThread.ready(2.5) 
     694 
     695    def stopEstimationThread(self): 
     696        """ Stop the estimation thread if it exists and is running """ 
     697        if (self.estimationThread is not None and 
     698                self.estimationThread.isrunning()): 
     699            self.estimationThread.stop() 
    688700 
    689701    ###################################################################### 
     
    778790        """ 
    779791        logger.error(error) 
     792        if self.isBatch: 
     793            self.startNextBatchItem() 
     794        else: 
     795            self.stopCalculation() 
Note: See TracChangeset for help on using the changeset viewer.