Ignore:
Timestamp:
Dec 4, 2017 8:43:06 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
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:
9387fe3
Parents:
200bd7e
Message:

Initial unit tests for inversion - SASVIEW-609

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

Legend:

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

    r19fce84 r50bfab0  
    2525        return 0.0 
    2626 
     27NUMBER_OF_TERMS = 10 
     28REGULARIZATION = 0.0001 
     29BACKGROUND_INPUT = 0.0 
     30MAX_DIST = 140.0 
    2731 
    2832# TODO: Modify plot references, don't just send new 
     
    227231        item = QtGui.QStandardItem("") 
    228232        self.model.setItem(WIDGETS.W_FILENAME, item) 
    229         item = QtGui.QStandardItem('0.0') 
     233        item = QtGui.QStandardItem(str(BACKGROUND_INPUT)) 
    230234        self.model.setItem(WIDGETS.W_BACKGROUND_INPUT, item) 
    231235        item = QtGui.QStandardItem("") 
     
    237241        item = QtGui.QStandardItem("") 
    238242        self.model.setItem(WIDGETS.W_SLIT_HEIGHT, item) 
    239         item = QtGui.QStandardItem("10") 
     243        item = QtGui.QStandardItem(str(NUMBER_OF_TERMS)) 
    240244        self.model.setItem(WIDGETS.W_NO_TERMS, item) 
    241         item = QtGui.QStandardItem("0.0001") 
     245        item = QtGui.QStandardItem(str(REGULARIZATION)) 
    242246        self.model.setItem(WIDGETS.W_REGULARIZATION, item) 
    243         item = QtGui.QStandardItem("140.0") 
     247        item = QtGui.QStandardItem(str(MAX_DIST)) 
    244248        self.model.setItem(WIDGETS.W_MAX_DIST, item) 
    245249        item = QtGui.QStandardItem("") 
     
    439443    def getNFunc(self): 
    440444        """Get the n_func value from the GUI object""" 
    441         return int(self.noOfTermsInput.text()) 
     445        try: 
     446            nfunc = int(self.noOfTermsInput.text()) 
     447        except ValueError: 
     448            logging.error("Incorrect number of terms specified: %s" %self.noOfTermsInput.text()) 
     449            self.noOfTermsInput.setText(str(NUMBER_OF_TERMS)) 
     450            nfunc = NUMBER_OF_TERMS 
     451        return nfunc 
    442452 
    443453    def setCurrentData(self, data_ref): 
Note: See TracChangeset for help on using the changeset viewer.