Autoreduction process for the Liquids Reflectometer

assemble_results

Find related runs and assemble them in one R(q) data set

Parameters:
  • first_run (int) –

    The first run number in the sequence

  • output_dir (str) –

    Directory where the output files are saved

  • average_overlap (bool, default: False ) –

    If True, the overlapping points will be averaged

  • is_live (bool, default: False ) –

    If True, the data is live and will be saved in a separate file to avoid conflict with auto-reduction

Returns:
  • seq_list( list ) –

    The sequence identifiers

  • run_list( list ) –

    The run numbers

offset_from_first_run

Find a theta offset by comparing the peak location of the reflected and direct beam compared to the theta value in the meta data.

When processing the first run of a set, store that offset in a file so it can be used for later runs.

Parameters:
  • ws (Mantid workspace) –

    The workspace to process

  • template_file (str) –

    Path to the template file

  • output_dir (str) –

    Directory where the output files are saved

Returns:
  • float

    The theta offset

reduce

Function called by reduce_REFL.py, which lives in /SNS/REF_L/shared/autoreduce and is called by the automated reduction workflow.

If average_overlap is used, overlapping points will be averaged, otherwise they will be left in the final data file.

Parameters:
  • average_overlap (bool, default: False ) –

    If True, the overlapping points will be averaged

  • q_summing (bool, default: False ) –

    If True, constant-Q binning will be used

  • bck_in_q (bool, default: False ) –

    If True, and constant-Q binning is used, the background will be estimated along constant-Q lines rather than along TOF/pixel boundaries.

  • theta_offset (float, default: 0 ) –

    Theta offset to apply. If None, the template value will be used.

  • is_live (bool, default: False ) –

    If True, the data is live and will be saved in a separate file to avoid conflict with auto-reduction

  • output_dir (str) –

    Directory where the output files will be saved

  • template_file (str) –

    Path to the template file containing the reduction parameters

Returns:
  • int

    The sequence identifier for the run sequence

reduce_explorer

Very simple rough reduction for when playing around.

Parameters:
  • ws (Mantid workspace) –

    The workspace to process

  • ws_db (Mantid workspace) –

    The workspace with the direct beam data

  • theta_pv (str, default: None ) –

    The PV name for the theta value

  • center_pixel (int, default: 145 ) –

    The pixel number for the center of the reflected beam

  • db_center_pixel (int, default: 145 ) –

    The pixel number for the center of the direct beam

  • peak_width (int, default: 10 ) –

    The width of the peak to use for the reflected beam

Returns:
  • qz_mid( ndarray ) –

    The Q values

  • refl( ndarray ) –

    The reflectivity values

  • d_refl( ndarray ) –

    The uncertainty in the reflectivity

write_template

Read the appropriate entry in a template file and save an updated copy with the updated run number.

Parameters:
  • seq_list (list) –

    The sequence identifiers

  • run_list (list) –

    The run numbers

  • template_file (str) –

    Path to the template file

  • output_dir (str) –

    Directory where the output files are saved