EQSANS Data Reduction With drtsans

Quick Reference for working in MantidWorkbench

Editors: Changwoo Do, Gergely Nagy, William Heller

Date: 07/16/2020

Introduction

EQ-SANS data reduction is typically performed through two equivalent means:

The present document details the latter method. Your local contact will work with you to configure the reduction for the various instrument configurations that you use during your experiment.

The content of the document is also explained in a video tutorial.

Below is a step by step description of the procedure.

Data reduction using MantidWorkbench and scripts

  1. Visit analysis.sns.gov

    a. Data reduction can be performed both from inside and outside of ORNL

    b. Log in with your ucams ID and password

    c. The same credentials can be used for easy file transfer to personal computer via e.g. WinSCP

  2. Populate the shared directory of your IPTS with the required reduction tools and activate the reduction environment

    a. open a terminal

    b. go to the shared folder of your IPTS

    cd /SNS/EQSANS/IPTS-****/shared

    c. copy eqsans_setup.sh from /SNS/EQSANS/shared/usertools/

    cp /SNS/EQSANS/shared/usertools/* ./

    d. run eqsans_setup.sh by typing

    ./eqsans_setup.sh

    e. run eqsans_activatedrtsans.sh by typing

    `source ./eqsans_activatedrtsans.sh

  3. Start mantidworkbecnhnightly

    a. In the terminal, type mantidworkbenchnightly and press Enter.

    b. When running the software for the first time you will not see EQSANS in the algorithm list

    1. To make it available go to File -> Manage user directories -> Python Script Directories Tab -> Browse to Directory and select the following directory: /SNS/EQSANS/shared/script/MantidAlgorithms and Open it.

    2. Close mantidworkbench and restart it as shown in Step 3.a.

    3. You will now see EQSANS listed in the algorithm browser window, shown below.

    c. Under File, open reduce_template_mantid.py script that was created during the actions of Step 2.

    d. The template is very similar to the reduce_template.py described in the partner document. The main differences are summarized below.

    1. The from drtsans.stitch import stitch_profiles is removed

    2. The line from eqsans_drtsans_script import * has been changed to from eqsans_drtsans_script_mantid import *

    3. The command reduceNow has been changed to the command mreduceNow

    e. To run the reduction, click the green arrow above the script.

  4. Example of writing and running a script for a single configuration reduction

    a. Information about how to write a data reduction script for reducing data collected with a single instrument configuration is provided in the partner document. The process does not change.

  5. Stitching of individual runs

    a. Information about how to stitch data collected using two different configurations into a single profile is provided in the partner document. The process does not change.

  6. Reducing and stitching two configurations in a single script

    a. The integration of data reduction of multiple configurations with automated data stitching into a single provide is provided in the partner document. The process does not change.

  7. Data reduction with added flexibility

    a. Information about how to access the flexibility provided by drtsans for data reduction is provided in the partner document. The method does not change. Users are encouraged to discuss their needs with their local contact.

  8. Displaying the obtained results

    a. The reduced 1D data files, which are simple ASCII text, can be loaded via the Load button

    1. Note that in the Load dialog box the proper unit of the data files for the x-axis has to be selected i.e. Energy or Momentum transfer etc. When plotting I(q) files for EQSANS always use Momentum transfer as unit.

    2. Files loaded into the workspaces window can be plotted

      1. Right click on the desired workspace.

      2. Select plot spectrum with errors

      3. Within the plot, axis can be changed by right click and choosing desired axis combination.

    b. The detector-efficiency calibrated, masked 2D data, which have file names that end in ".nxs", can be also loaded into the workspaces window by the Load button of the interface.

    1. Once loaded and visible in the workspaces window, right click on the workspace and select show instrument.

    2. The data can be displayed as a function of the considered wavelength band, via the bar at the bottom of the pop-up window

Data reduction using MantidWorkbench and a data catalog

An alternative method for reducing data is to use an algorithm that allows necessary information to be entered in a spreadsheet. The actual data reduction software remains drtsans, so the use of the different approach does not impact the final results.

  1. Visit analysis.sns.gov

    a. Data reduction can be performed both from inside and outside of ORNL

    b. Log in with your ucams ID and password

    c. The same credentials can be used for easy file transfer to personal computer via e.g. WinSCP

  2. Creating catalog of the measurement parameters**

    a. A catalog of the runs collected up to that point in time during the experiment can be created with the EQSANSCreateCatalog algorithm. You must supply the IPTS number of the experiment.

    1. Simple catalogs -- containing total counts, duration, sample-to-detector distance and wavelength information can be created via checking SimpleCatalog box. Such catalogs are useful when working with the scripting described in the partner document.

    2. For data reduction purposes leave the SimpleCatalog box option unchecked

    3. If the catalog file already exists under the same name, it will be overwritten only if the Overwrite box is checked. Otherwise, the catalog will not be created.

    b. The resulting catalog is saved in .xlsx format which can be viewed using spreadsheet software. The file format is native to Excel, but can also be read on the Linux computers (analysis.sns.gov or the instrument data reduction computers) using gnumeric or Calc. Table file can also be opened by using the opentable algorithm from the EQSANS algorithm list.

    1. The top of the table contains reduction configuration parameters, which can be used here, or in support of customizing the script based reduction.

    2. If good practice was used when naming scattering and transmission runs, the table will also show a guess at the transmission run numbers with their corresponding scattering run numbers.

      It is a good practice to verify that that the association of scattering and transmission runs is correct before reducing data.

  3. Catalog based data reduction

    a. Your catalog must have been created with the SimpleCatalog option left unchecked.

    b. Column A in the catalog is used to specify how information on that line is treated. There are 3 options. Leaving the column blank means that the row is not processed.

    1. y -- for reduction

    2. s -- for stitching

    3. v -- for changing variables

    An explanation of the options is also provided on the top three lines of the catalog.

    c. To reduce data listed in a specific row complete columns D to G with relevant information. Reduction can be performed without subtracting a background. To do so, leave columns E and F empty

    d. Sample thickness, output name and number of Q bins in the output intensity data set can also be specified independently for each row. The absolute scale factor that is specified in column J should come from a measurement and analysis of the standard sample, which your local contact will help you with. Filenames will be created with the _suffix parameter specified at the top of the table along other parameters.

    e. If specific configuration information needs to be provided for each different instrument configuration employed, it can be provided using the "Config name" parameter. Your local contact can be of assistance.

    1. Config name is the same variable that is used to define the EQVar class object. For example, in the script method, reduction variable object can be defined as

      1. eq = EQVar('2020A') or by specifying json file such as eq=EQVar('4m10a.json')

      2. Those configuration json files are created and provided by the instrument scientists.

    f. To stitch data from different configurations together, create new rows in the table and flag them with "s", as described above. The rows for stitching will not interfere with the data reduction process. Additionally, creating extra rows in the table and copying another line to use as a template for performing an operation does not interfere with the data reduction processes specified in the catalog.

    1. Note that during stitching, the "ref-to" option defines the data set in the list to which the other scattering data will be scaled. Unlike in script mode, in the catalog based reduction 1 means that the data will be stitched to the first data set in the list.

    2. As is done in the script-based reduction, provide the desired name for the stitched data file and the overlapping momentum transfer ranges to use for stitching and calculating the relative scale factor.

    3. By default, the output format for stitching will be ASCII text, and the file extension will be ".txt".

g. After filling all of the desired rows, save the file and close the catalog.

h. To reduce the data, chose the EQSAMSTableDRT algorithm from the list in MantidWorkbench and select the catalog that you have created.

i. Execute the algorithm

j. The reduced data can be displayed as described in paragraph 8.

Disclaimer

The data reduction scripting method presented here was developed by Dr. Changwoo Do (doc1@ornl.gov). Responsibility for its use, bug fixes and further development lie solely with the EQ-SANS team. All questions and concerns should be directed to your local contact, who will either help debug your reduction script or provide feedback to the Research Software Engineering group about bugs in the drtsans package that performs the reduction.


Up: Index