parameters: (self)
return_statement: return mantid_ub
docstring: Purpose: Set UB matrix in use from plain text edit plainTextEdit_ubInput.
          Requirements:
            1. the string in the plain text edit must be able to be split to 9 floats by ',', ' ', '\t' and '\n'
          Guarantees: the matrix will be set up the UB matrix in use
          :return:
docstring_summary: Purpose: Set UB matrix in use from plain text edit plainTextEdit_ubInput.
          Requirements:
            1. the string in the plain text edit must be able to be split to 9 floats by ',', ' ', '\t' and '\n'
          Guarantees: the matrix will be set up the UB matrix in use
          :return:
docstring_tokens: Purpose : Set UB matrix in use from plain text edit plainTextEdit_ubInput . Requirements : 1 . the string in the plain text edit must be able to be split to 9 floats by \ t and \ n Guarantees : the matrix will be set up the UB matrix in use : return :
function: def get_ub_from_text(self):
          """ Purpose: Set UB matrix in use from plain text edit plainTextEdit_ubInput.
          Requirements:
            1. the string in the plain text edit must be able to be split to 9 floats by ',', ' ', '\t' and '\n'
          Guarantees: the matrix will be set up the UB matrix in use
          :return:
          """
          # get the string for ub matrix
          ub_str = str(self.ui.plainTextEdit_ubInput.toPlainText())
  
          # check the float list string
          status, ret_obj = gutil.parse_float_array(ub_str)
          # check whether the ub matrix in text editor is valid
          if status is False:
              # unable to parse to float arrays
              self.pop_one_button_dialog(ret_obj)
              return
          elif len(ret_obj) != 9:
              # number of floats is not 9
              self.pop_one_button_dialog('Requiring 9 floats for UB matrix.  Only %d are given.' % len(ret_obj))
              return
  
          # in good UB matrix format
          if self.ui.radioButton_ubMantidStyle.isChecked():
              # UB matrix in mantid style
              mantid_ub = gutil.convert_str_to_matrix(ub_str, (3, 3))
  
          elif self.ui.radioButton_ubSpiceStyle.isChecked():
              # UB matrix in SPICE style
              spice_ub = gutil.convert_str_to_matrix(ub_str, (3, 3))
              mantid_ub = r4c.convert_spice_ub_to_mantid(spice_ub)
  
          else:
              # not defined
              self.pop_one_button_dialog('Neither Mantid or SPICE-styled UB is checked!')
              return
  
          return mantid_ub
function_tokens: def get_ub_from_text ( self ) : # get the string for ub matrix ub_str = str ( self . ui . plainTextEdit_ubInput . toPlainText ( ) ) # check the float list string status , ret_obj = gutil . parse_float_array ( ub_str ) # check whether the ub matrix in text editor is valid if status is False : # unable to parse to float arrays self . pop_one_button_dialog ( ret_obj ) return elif len ( ret_obj ) != 9 : # number of floats is not 9 self . pop_one_button_dialog ( 'Requiring 9 floats for UB matrix.  Only %d are given.' % len ( ret_obj ) ) return # in good UB matrix format if self . ui . radioButton_ubMantidStyle . isChecked ( ) : # UB matrix in mantid style mantid_ub = gutil . convert_str_to_matrix ( ub_str , ( 3 , 3 ) ) elif self . ui . radioButton_ubSpiceStyle . isChecked ( ) : # UB matrix in SPICE style spice_ub = gutil . convert_str_to_matrix ( ub_str , ( 3 , 3 ) ) mantid_ub = r4c . convert_spice_ub_to_mantid ( spice_ub ) else : # not defined self . pop_one_button_dialog ( 'Neither Mantid or SPICE-styled UB is checked!' ) return return mantid_ub