parameters: (self, ws_name)
return_statement: return None
docstring: Gets the sample temperature for a given workspace.
  
          @param ws_name Name of workspace
          @returns Temperature in Kelvin or None if not found
docstring_summary: Gets the sample temperature for a given workspace.
docstring_tokens: Gets the sample temperature for a given workspace .
function: def _get_temperature(self, ws_name):
          """
          Gets the sample temperature for a given workspace.
  
          @param ws_name Name of workspace
          @returns Temperature in Kelvin or None if not found
          """
          instr, run_number = self._get_InstrRun(ws_name)
  
          pad_num = config.getInstrument(instr).zeroPadding(int(run_number))
          zero_padding = '0' * (pad_num - len(run_number))
  
          run_name = instr + zero_padding + run_number
          log_filename = run_name.upper() + '.log'
  
          run = mtd[ws_name].getRun()
  
          if self._sample_log_name in run:
              # Look for temperature in logs in workspace
              tmp = run[self._sample_log_name].value
              value_action = {'last_value': lambda x: x[len(x) - 1],
                              'average': lambda x: x.mean()
                              }
              temp = value_action[self._sample_log_value](tmp)
              logger.debug('Temperature %d K found for run: %s' % (temp, run_name))
              return temp
  
          else:
              # Logs not in workspace, try loading from file
              logger.information('Log parameter not found in workspace. Searching for log file.')
              log_path = FileFinder.getFullPath(log_filename)
  
              if log_path != '':
                  # Get temperature from log file
                  LoadLog(Workspace=ws_name, Filename=log_path)
                  run_logs = mtd[ws_name].getRun()
                  if self._sample_log_name in run_logs:
                      tmp = run_logs[self._sample_log_name].value
                      temp = tmp[len(tmp) - 1]
                      logger.debug('Temperature %d K found for run: %s' % (temp, run_name))
                      return temp
                  else:
                      logger.warning('Log entry %s for run %s not found' % (self._sample_log_name, run_name))
              else:
                  logger.warning('Log file for run %s not found' % run_name)
  
          # Can't find log file
          logger.warning('No temperature found for run: %s' % run_name)
          return None
function_tokens: def _get_temperature ( self , ws_name ) : instr , run_number = self . _get_InstrRun ( ws_name ) pad_num = config . getInstrument ( instr ) . zeroPadding ( int ( run_number ) ) zero_padding = '0' * ( pad_num - len ( run_number ) ) run_name = instr + zero_padding + run_number log_filename = run_name . upper ( ) + '.log' run = mtd [ ws_name ] . getRun ( ) if self . _sample_log_name in run : # Look for temperature in logs in workspace tmp = run [ self . _sample_log_name ] . value value_action = { 'last_value' : lambda x : x [ len ( x ) - 1 ] , 'average' : lambda x : x . mean ( ) } temp = value_action [ self . _sample_log_value ] ( tmp ) logger . debug ( 'Temperature %d K found for run: %s' % ( temp , run_name ) ) return temp else : # Logs not in workspace, try loading from file logger . information ( 'Log parameter not found in workspace. Searching for log file.' ) log_path = FileFinder . getFullPath ( log_filename ) if log_path != '' : # Get temperature from log file LoadLog ( Workspace = ws_name , Filename = log_path ) run_logs = mtd [ ws_name ] . getRun ( ) if self . _sample_log_name in run_logs : tmp = run_logs [ self . _sample_log_name ] . value temp = tmp [ len ( tmp ) - 1 ] logger . debug ( 'Temperature %d K found for run: %s' % ( temp , run_name ) ) return temp else : logger . warning ( 'Log entry %s for run %s not found' % ( self . _sample_log_name , run_name ) ) else : logger . warning ( 'Log file for run %s not found' % run_name ) # Can't find log file logger . warning ( 'No temperature found for run: %s' % run_name ) return None