parameters: (run_number, focus_file_path)
return_statement: return focused_ws
docstring: Searches for the focused workspace to use (based on user specified run number) in the ADS and then the output
      directory.
      If unsuccessful, a ValueError exception is thrown.
      :param run_number: The run number to search for.
      :param focus_file_path: The expected file path for the focused file.
      :return: The focused workspace.
docstring_summary: Searches for the focused workspace to use (based on user specified run number) in the ADS and then the output
      directory.
      If unsuccessful, a ValueError exception is thrown.
      :param run_number: The run number to search for.
      :param focus_file_path: The expected file path for the focused file.
      :return: The focused workspace.
docstring_tokens: Searches for the focused workspace to use ( based on user specified run number ) in the ADS and then the output directory . If unsuccessful a ValueError exception is thrown . : param run_number : The run number to search for . : param focus_file_path : The expected file path for the focused file . : return : The focused workspace .
function: def _obtain_focused_run(run_number, focus_file_path):
      """
      Searches for the focused workspace to use (based on user specified run number) in the ADS and then the output
      directory.
      If unsuccessful, a ValueError exception is thrown.
      :param run_number: The run number to search for.
      :param focus_file_path: The expected file path for the focused file.
      :return: The focused workspace.
      """
      # Try the ADS first to avoid undesired loading
      if mantid.mtd.doesExist('%s-ResultTOF' % run_number):
          focused_ws = mantid.mtd['%s-ResultTOF' % run_number]
      elif mantid.mtd.doesExist('%s-ResultD' % run_number):
          focused_ws = mantid.mtd['%s-ResultD' % run_number]
      else:
          # Check output directory
          print('No loaded focused files found. Searching in output directory...')
          try:
              focused_ws = mantid.LoadNexus(Filename=focus_file_path, OutputWorkspace='focused_ws').OutputWorkspace
          except ValueError:
              raise ValueError("Could not find focused file for run number:%s\n"
                               "Please ensure a focused file has been produced and is located in the output directory."
                               % run_number)
      return focused_ws
function_tokens: def _obtain_focused_run ( run_number , focus_file_path ) : # Try the ADS first to avoid undesired loading if mantid . mtd . doesExist ( '%s-ResultTOF' % run_number ) : focused_ws = mantid . mtd [ '%s-ResultTOF' % run_number ] elif mantid . mtd . doesExist ( '%s-ResultD' % run_number ) : focused_ws = mantid . mtd [ '%s-ResultD' % run_number ] else : # Check output directory print ( 'No loaded focused files found. Searching in output directory...' ) try : focused_ws = mantid . LoadNexus ( Filename = focus_file_path , OutputWorkspace = 'focused_ws' ) . OutputWorkspace except ValueError : raise ValueError ( "Could not find focused file for run number:%s\n" "Please ensure a focused file has been produced and is located in the output directory." % run_number ) return focused_ws