parameters: (wav_start=None, wav_end=None, full_trans_wav=None, name_suffix=None, combineDet=None,
                        resetSetup=True, out_fit_settings=None, output_name=None, output_mode=OutputMode.PUBLISH_TO_ADS,
                        use_reduction_mode_as_suffix=False)
return_statement: return output_workspace_base_name
docstring: Run reduction from loading the raw data to calculating Q. Its optional arguments allows specifics
          details to be adjusted, and optionally the old setup is reset at the end. Note if FIT of RESCALE or SHIFT
          is selected then both REAR and FRONT detectors are both reduced EXCEPT if only the REAR detector is selected
          to be reduced
  
          @param wav_start: the first wavelength to be in the output data
          @param wav_end: the last wavelength in the output data
          @param full_trans_wav: if to use a wide wavelength range, the instrument's default wavelength range,
                                 for the transmission correction, false by default
          @param name_suffix: append the created output workspace with this
          @param combineDet: combineDet can be one of the following:
                             'rear'                (run one reduction for the 'rear' detector data)
                             'front'               (run one reduction for the 'front' detector data, and
                                                    rescale+shift 'front' data)
                             'both'                (run both the above two reductions)
                             'merged'              (run the same reductions as 'both' and additionally create
                                                    a merged data workspace)
                              None                 (run one reduction for whatever detector has been set as the
                                                    current detector
                                                    before running this method. If front apply rescale+shift)
          @param resetSetup: if true reset setup at the end
          @param out_fit_settings: An output parameter. It is used, specially when resetSetup is True, in order
                                   to remember the 'scale and fit' of the fitting algorithm.
          @param output_name: name of the output workspace/file, if none is specified then one is generated internally.
          @param output_mode: the way the data should be put out: Can be PublishToADS, SaveToFile or Both
          @param use_reduction_mode_as_suffix: If true then a second suffix will be used which is
                                               based on the reduction mode.
          @return Name of one of the workspaces created
docstring_summary: Run reduction from loading the raw data to calculating Q. Its optional arguments allows specifics
          details to be adjusted, and optionally the old setup is reset at the end. Note if FIT of RESCALE or SHIFT
          is selected then both REAR and FRONT detectors are both reduced EXCEPT if only the REAR detector is selected
          to be reduced
docstring_tokens: Run reduction from loading the raw data to calculating Q . Its optional arguments allows specifics details to be adjusted and optionally the old setup is reset at the end . Note if FIT of RESCALE or SHIFT is selected then both REAR and FRONT detectors are both reduced EXCEPT if only the REAR detector is selected to be reduced
function: def WavRangeReduction(wav_start=None, wav_end=None, full_trans_wav=None, name_suffix=None, combineDet=None,
                        resetSetup=True, out_fit_settings=None, output_name=None, output_mode=OutputMode.PUBLISH_TO_ADS,
                        use_reduction_mode_as_suffix=False):
      """
          Run reduction from loading the raw data to calculating Q. Its optional arguments allows specifics
          details to be adjusted, and optionally the old setup is reset at the end. Note if FIT of RESCALE or SHIFT
          is selected then both REAR and FRONT detectors are both reduced EXCEPT if only the REAR detector is selected
          to be reduced
  
          @param wav_start: the first wavelength to be in the output data
          @param wav_end: the last wavelength in the output data
          @param full_trans_wav: if to use a wide wavelength range, the instrument's default wavelength range,
                                 for the transmission correction, false by default
          @param name_suffix: append the created output workspace with this
          @param combineDet: combineDet can be one of the following:
                             'rear'                (run one reduction for the 'rear' detector data)
                             'front'               (run one reduction for the 'front' detector data, and
                                                    rescale+shift 'front' data)
                             'both'                (run both the above two reductions)
                             'merged'              (run the same reductions as 'both' and additionally create
                                                    a merged data workspace)
                              None                 (run one reduction for whatever detector has been set as the
                                                    current detector
                                                    before running this method. If front apply rescale+shift)
          @param resetSetup: if true reset setup at the end
          @param out_fit_settings: An output parameter. It is used, specially when resetSetup is True, in order
                                   to remember the 'scale and fit' of the fitting algorithm.
          @param output_name: name of the output workspace/file, if none is specified then one is generated internally.
          @param output_mode: the way the data should be put out: Can be PublishToADS, SaveToFile or Both
          @param use_reduction_mode_as_suffix: If true then a second suffix will be used which is
                                               based on the reduction mode.
          @return Name of one of the workspaces created
      """
      print_message('WavRangeReduction(' + str(wav_start) + ', ' + str(wav_end) + ', ' + str(full_trans_wav) + ')')
      _ = resetSetup
      _ = out_fit_settings
  
      # Set the provided parameters
      if combineDet is None:
          reduction_mode = None
      elif combineDet == 'rear':
          reduction_mode = ReductionMode.LAB
      elif combineDet == "front":
          reduction_mode = ReductionMode.HAB
      elif combineDet == "merged":
          reduction_mode = ReductionMode.MERGED
      elif combineDet == "both":
          reduction_mode = ReductionMode.ALL
      else:
          raise RuntimeError("WavRangeReduction: The combineDet input parameter was given a value of {0}. rear, front,"
                             " both, merged and no input are allowed".format(combineDet))
  
      if wav_start is not None:
          wav_start = float(wav_start)
  
      if wav_end is not None:
          wav_end = float(wav_end)
  
      wavelength_command = NParameterCommand(command_id=NParameterCommandId.WAV_RANGE_SETTINGS,
                                             values=[wav_start, wav_end, full_trans_wav, reduction_mode])
      director.add_command(wavelength_command)
  
      # Save options
      if output_name is not None:
          director.add_command(NParameterCommand(command_id=NParameterCommandId.USER_SPECIFIED_OUTPUT_NAME,
                                                 values=[output_name]))
      if name_suffix is not None:
          director.add_command(NParameterCommand(command_id=NParameterCommandId.USER_SPECIFIED_OUTPUT_NAME_SUFFIX,
                                                 values=[name_suffix]))
      if use_reduction_mode_as_suffix:
          director.add_command(NParameterCommand(command_id=NParameterCommandId.USE_REDUCTION_MODE_AS_SUFFIX,
                                                 values=[use_reduction_mode_as_suffix]))
  
      # Get the states
      state = director.process_commands()
  
      # Run the reduction
      batch_alg = SANSBatchReduction()
      batch_alg(states=[state], use_optimizations=True, output_mode=output_mode)
  
      # -----------------------------------------------------------
      # Return the name fo the reduced workspace (or WorkspaceGroup)
      # -----------------------------------------------------------
      reduction_mode = state.reduction.reduction_mode
      is_group = is_part_of_reduced_output_workspace_group(state)
      wav_range = state.wavelength.wavelength_interval.wavelength_full_range
      if reduction_mode != ReductionMode.ALL:
          _, output_workspace_base_name = get_output_name(state, reduction_mode, is_group, wav_range)
      else:
          _, output_workspace_base_name_hab = get_output_name(state, ReductionMode.HAB, is_group, wav_range)
          _, output_workspace_base_name_lab = get_output_name(state, ReductionMode.LAB, is_group, wav_range)
          output_workspace_base_name = [output_workspace_base_name_lab, output_workspace_base_name_hab]
      return output_workspace_base_name
function_tokens: def WavRangeReduction ( wav_start = None , wav_end = None , full_trans_wav = None , name_suffix = None , combineDet = None , resetSetup = True , out_fit_settings = None , output_name = None , output_mode = OutputMode . PUBLISH_TO_ADS , use_reduction_mode_as_suffix = False ) : print_message ( 'WavRangeReduction(' + str ( wav_start ) + ', ' + str ( wav_end ) + ', ' + str ( full_trans_wav ) + ')' ) _ = resetSetup _ = out_fit_settings # Set the provided parameters if combineDet is None : reduction_mode = None elif combineDet == 'rear' : reduction_mode = ReductionMode . LAB elif combineDet == "front" : reduction_mode = ReductionMode . HAB elif combineDet == "merged" : reduction_mode = ReductionMode . MERGED elif combineDet == "both" : reduction_mode = ReductionMode . ALL else : raise RuntimeError ( "WavRangeReduction: The combineDet input parameter was given a value of {0}. rear, front," " both, merged and no input are allowed" . format ( combineDet ) ) if wav_start is not None : wav_start = float ( wav_start ) if wav_end is not None : wav_end = float ( wav_end ) wavelength_command = NParameterCommand ( command_id = NParameterCommandId . WAV_RANGE_SETTINGS , values = [ wav_start , wav_end , full_trans_wav , reduction_mode ] ) director . add_command ( wavelength_command ) # Save options if output_name is not None : director . add_command ( NParameterCommand ( command_id = NParameterCommandId . USER_SPECIFIED_OUTPUT_NAME , values = [ output_name ] ) ) if name_suffix is not None : director . add_command ( NParameterCommand ( command_id = NParameterCommandId . USER_SPECIFIED_OUTPUT_NAME_SUFFIX , values = [ name_suffix ] ) ) if use_reduction_mode_as_suffix : director . add_command ( NParameterCommand ( command_id = NParameterCommandId . USE_REDUCTION_MODE_AS_SUFFIX , values = [ use_reduction_mode_as_suffix ] ) ) # Get the states state = director . process_commands ( ) # Run the reduction batch_alg = SANSBatchReduction ( ) batch_alg ( states = [ state ] , use_optimizations = True , output_mode = output_mode ) # ----------------------------------------------------------- # Return the name fo the reduced workspace (or WorkspaceGroup) # ----------------------------------------------------------- reduction_mode = state . reduction . reduction_mode is_group = is_part_of_reduced_output_workspace_group ( state ) wav_range = state . wavelength . wavelength_interval . wavelength_full_range if reduction_mode != ReductionMode . ALL : _ , output_workspace_base_name = get_output_name ( state , reduction_mode , is_group , wav_range ) else : _ , output_workspace_base_name_hab = get_output_name ( state , ReductionMode . HAB , is_group , wav_range ) _ , output_workspace_base_name_lab = get_output_name ( state , ReductionMode . LAB , is_group , wav_range ) output_workspace_base_name = [ output_workspace_base_name_lab , output_workspace_base_name_hab ] return output_workspace_base_name