Engineering Diffraction Testing¶
Preamble¶
This document is tailored towards developers intending to test the Engineering Diffraction interface.
Runs can be loaded from the archive, however it is possible that different run numbers will be needed as older runs may be deleted.
Overview¶
The Engineering Diffraction interface allows scientists using the EnginX instrument to interactively process their data. There are 4 tabs in total. These are:
Calibration - This is where a cerium oxide run is entered to calibrate the subsequent data.
Focus - Where are the data across multiple spectra are normalised and summed into a single spectrum for later steps.
Fitting - Where peaks can be fitted on focused data
GSAS II - Run a basic refinement on the GSASIIscriptable API
Especially to aide GSASII testing, please test on an ENGINX IDAaaS instance.
The tests are designed to be run from a starting point where no settings relating to the Engineering Diffraction Gui
have been saved in the Mantid Workbench ini file. This file is in C:\Users\<fed id>\AppData\Roaming\mantidproject
on
Windows and ~/.config/mantidproject/
on linux. To ensure there are no saved settings open up the file mantidworkbench.ini
and delete the settings with names starting with EngineeringDiffraction2 from the CustomInterfaces section
Test 1¶
This test follows the simple steps for calibrating and focusing in the Engineering Diffraction Gui.
Calibration¶
Ensure you can access the ISIS data archive.
Open the Engineering Diffraction gui:
Interfaces
>Diffraction
>Engineering Diffraction
On opening the gui the Create New Calibration option should be selected.
Open the settings dialog from the cog in the bottom left of the gui.
Set the Save Location to a directory of your choice.
Check that the Full Calibration setting has a default path to a .nxs file (currently ENGINX_full_instrument_calibration_193749.nxs)
Close the settings window
For the Calibration Sample # enter 305738.
Tick the Plot Calibrated Workspace option.
Click Calibrate, after completing calibration it should produce the following plot.
Check that in your save location there is a Calibration folder containing three .prm files ENGINX_305738 with the suffixes _all_banks, _bank_1, _bank_2.
Close the Engineering Diffraction gui and reopen it. The Load Existing Calibration radio button should be checked on the Calibration tab and the path should be populated with the _all_banks.prm file generated earlier in this test.
In the Load Existing Calibration box browse to the _bank_2.prm file and click the Load button.
Focus¶
Change to the Focus tab.
For the Sample Run # use 305761 and for the Vanadium # enter 307521.
Tick the Plot Focused Workspace option and click Focus. It should produce a plot of a single spectrum for bank 2.
Go back to the Calibration tab and load in an existing calibration for both banks e.g. ENGINX_305738_all_banks.prm
Go back to the Focus tab and click Focus, after completing calibration it should produce a plot.
Check that in your save location there is a Focus folder containing the following files:
ENGINX_305738_305721_all_banks_dSpacing.abc
ENGINX_305738_305721_all_banks_dSpacing.gss
ENGINX_305738_305721_all_banks_TOF.abc
ENGINX_305738_305721_all_banks_TOF.gss
ENGINX_305738_305721_bank_1_dSpacing.nxs
ENGINX_305738_305721_bank_1_TOF.nxs
ENGINX_305738_305721_bank_2_dSpacing.abc
ENGINX_305738_305721_bank_2_dSpacing.gss
ENGINX_305738_305721_bank_2_dSpacing.nxs
ENGINX_305738_305721_bank_2_TOF.abc
ENGINX_305738_305721_bank_2_TOF.gss
ENGINX_305738_305721_bank_2_TOF.nxs
Test 2¶
This test covers the RB number.
Enter a string into the RB Number box.
Follow the steps of Test 1, any output files (for non-texture ROI) should now be located in both [Save location]/user/[RB number] and [Save location] (for texture ROI the files will be saved in the first location if an RB number is specified, otherwise they will be saved in the latter - this is to reduce the number of files being written).
Test 3¶
This test covers the Cropping functionality in the Calibration tab.
Change the RB Number to North, this is purely to separate the cropped output files into their own space.
Go to the Calibration tab, select Create New Calibration and tick the Crop Calibration option. In the drop down Region of Interest select 1 (North).
Check the Plot Calibrated Workspace checkbox and click calibrate.
The generated figure should show a plot of TOF vs d-spacing and plot showing residuals of the quadratic fit.
Check that only one .prm and one .nxs output file was generated.
Go to focus tab and click Focus.
Change the RB number to Custom.
Set the
Region Of Interest
toCrop to Spectra
and usingCustom Spectra
1200-2400
(these spectrum numbers correspond to the South Bank). Please note that some custom spectra values may cause the algorithms to fail. ClickCalibrate
and a similar plot to before should appear but with only 2 subplots.Set the
Region of Interest
toTexture (20 spec)
and clickCalibrate
- there should be 20 spectra per run (5 tiled plot windows, 4 spectra per window).
Test 4¶
This test covers the loading and plotting focused data in the fitting tab.
Create a new calibration, untick
Crop calibration
enter calibration sample #305738
and click Calibrate. On theFocus
tab, setSample Run #
to305793-305795
andVanadium #
to307521
and clickFocus
. These sample runs have different stress and strain log values.In the fitting tab, load multiple of these newly focused TOF .nxs files in the Load Focused Data section. The path to the focused files should be auto populated
Click the Load button. A row should be added to the UI table for each focused run. There should be a grouped workspace with the suffix _logs_Fitting in the ADS with tables corresponding to each log value specified in the settings (to open the settings use the cog in the bottom left corner of the UI). There should be an additional table called run_info that provides some of the metadata for each run. Each row in these tables should correspond to the equivalent row in the UI table.
The log values that are averaged can be selected in the settings (cog button in the bottom left corner of the UI). Change which sample log checkboxes are selected. Close settings and then close and re-open the Engineering Diffraction interface. Reopen settings to check these selected sample logs have been remembered. Note that any change to the selected logs won’t take effect until the interface is reopened.
Clear the runs by clicking
Remove All
below the table. Repeat steps 1-2 above but this time try checking the Add To Plot checkbox, when loading the run(s) the data should now be plotted and the checkbox in the Plot column of the UI table should be checked.Clear the runs by clicking
Remove All
below the table. Repeat steps 1-2 again but load the d-spacing .nxs file(s) insteadPlot some data and un-dock the plot in the UI by dragging or double-clicking the bar at the top of the plot labelled Fit Plot. The plot can now be re-sized.
To dock it double click the Fit Plot bar (or drag to the bottom of the toolbar). You may want to un-dock it again for subsequent tests.
Test 5¶
On the Fitting tab, test the functionality of the Load Focused Data section at the top. The tests so far have enabled you to produce many different focussed data files, so check that the Unit and region filters help you to find dSpacing data for Texture regions and TOF data for North bank.
Test 6¶
This tests the removal of focused runs from the fitting tab.
Load multiple runs using the Browse button. This should take you to a folder called “Focus” containing .nxs files that have been previously generated from the Focus tab. Select multiple files and click on Open
Having loaded multiple runs, select a row in the UI table and then click the Remove Selected button below the table. The row should be removed, if the run was plotted it will disappear from the plot and there should be one less row in each of the table workspaces inside the “_logs” workspace group with each row corresponding to the run in the same row of the UI table. The workspaces called “ENGINX_…._TOF” and “ENGINX_…._TOG_bgsub” will be deleted from the ADS
Try clicking the Remove All button, the UI table should be empty and the workspace group with name ending “_logs” should no longer be present.
Try loading in a run again, the UI should still be able to access the workspace and remember the log values - check there are no calls to
AverageLogData
in the log (should be visible at notice level).Try removing a workspace by deleting it in the ADS, the corresponding row in the log tables and the UI table should have been removed.
Delete a
_bgsub
workspace in the ADS, the corresponding row will not be deleted, but the bgsub checkbox will be unchecked.
Test 7¶
This tests that the background subtraction works.
Load in a run - the Subtract BG box should be checked in the UI table by default. This should generate a workspace with suffix _bgsub and the data should look like the background is flat and roughly zero on the plot using the default parameters (other columns in the UI table).
Select the row in the table and check the Inspect Background button should now be enabled regardless of whether the Subtract BG box is checked.
Click Inspect Background to open a new figure which shows the raw data, the background and the subtracted data. Changing the values of Niter, BG, XWindow and SG (input to
EnggEstimateFocussedBackground
, hover over a cell in the table to see a tool tip for explanation) should produce a change in the background on the external plot and in the UI plot.
Test 8¶
This tests the operation of the fit browser.
Check that when no data are plotted the Fit button on the toolbar does nothing.
Check the Browse Filter combobox is set to
TOF
and click Browse. In theFocus
folder of the save directory, there should be output focussed TOF files. Select multiple focussed files and click Open. Back on the main interface, check the boxAdd to Plot
and clickLoad
.Click the Fit button in the plot toolbar. A simplified version of the standard mantid fit property browser should now be visible.
In the fit property browser, all the plotted spectra should be available in the Settings > Workspace combo box. In the central
Run Selection
table, remove one spectrum from the plot by unticking thePlot
checkbox for one row. The Settings > Workspace combo box should now update and not include the removed spectrum.Right-click on the plot image and select Add Peak and add a peak to the plot. Change the peak type and add another peak. Also add a Linear background. Make sure to add a BackToBackExponential peak if you have not already. For BackToBackExponential peaks, the A and B parameters should be fixed automatically for ENGIN-X data.
Perform a fit by clicking
Fit > Fit
in the fit browser. On completion of the fit, a group workspace with suffix _fits should have appeared in the Workspaces Toolbox(ADS). In this group of workspaces there should be a matrix workspace for each parameter fitted (named by convention FunctionName_ParameterName), to view this right-click on the workspace and Show Data. Any runs not fit will have a NaN value in the Y and E fields. In addition there is a workspace that has converted any peak centres from TOF to d-spacing (suffix _dSpacing). There should be an additional table called model that summarises the chisq value and the function string including the best-fit parameters.In the Fit property browser, go to
Setup > Custom Setup
. The function string, including the best-fit parameters, should also have been automatically saved as a custom setup. SelectSetup > Clear Model
, then select this new custom setup model. Inspect the fit by clicking Fit > Evaluate Function.
Test 9¶
This tests the sequential fitting capability of the UI (where the result of a fit to one workspace is used as the initial guess for the next). This test uses data generated in Test 4.
In the main workbench window, right-click on the Message log and set the Log Level to
Notice
.Close and re-open the Engineering Diffraction interface.
Enter the Engineering Diffraction settings menu by clicking the cog wheel in the bottom left. In the Fitting Settings section, you can select which sample logs to output to table workspaces, the Primary Log for Sequential fit ordering, and whether this should be in ascending or descending order. In the primary log combobox, select
ADC1_0
and tickAscending
.On the Fitting tab, Load in several focused runs e.g. 305793-305795 from Test 4.
Plot just one run, click
Fit
to open the fit property browser and input a valid fit function including a peak and a background.Click the
Sequential Fit
button in the plot toolbar. A group of fit workspaces should appear in the Workspaces Toolbox (ADS), each with a row for each of the runs in the table. All the runs should have been fitted.The order of the runs in the sequential fit should be obtainable from the log at notice level - check that this corresponds to the order of the average value of the primary log -
ADC1_0
You can check the value of this sample log for each run in the output GroupWorkspace with the suffix_logs
. Note this order down.Try changing the primary log to blank and re-run the
Sequential Fit
This should make the Sequential fit use the order of the runs in the centralRun Selection
table.In the Engineering Diffraction settings, set the primary log back to
ADC1_0
and tickDescending
. Re-run theSequential Fit
and check that the order of runs in the output workspaces has reversed compared to step 8.Close and re-open the Engineering Diffraction interface. Reopen the Engineering Diffraction settings menu, it should remember the primary log and the order.
Test 10¶
This tests the serial fitting capability of the UI (where all loaded workspaces are fitted from the same starting parameters). This test uses data generated in Test 4.
Repeat steps 1-4 in the previous test (Test 9).
Now click the
Serial Fit
button in the plot toolbar and the group of fit workspaces should appear in the ADS, each with a row for each of the runs in the table. All the runs should have been fitted.The order of the runs in the serial fit should be obtainable from the log at notice level - check that this corresponds to the order of the runs in the table.
Test 11¶
Note this test will only work if GSASII is also installed. Please test this on IDAaaS: an ENGINX instance should have MantidWorkbenchNightly and GSASII installed in the expected location.
Close and re-open the Engineering Diffraction interface.
Go to the Calibration tab, select
Create New Calibration
and un-tick the Crop Calibration option.For the
Calibration Sample #
enter 305738 and click the Calibrate button.On the Focus tab, enter
Sample Run #
305761 andVanadium #
307521 and click the Focus button.
Change to the GSASII tab. The
Instrument Group
path should be pre-filled to a .prm file output by the calibration and theFocused Data
path should be pre-filled to the .gss file output from the Focus tab.For the
Phase
filepath, browse toMANTID_INSTALL_DIRECTORY/scripts/Engineering/ENGINX/phase_info/FE_GAMMA.cif
. For theProject Name
at the top, enter a string of your choice.Now, click
Refine in GSAS II
. After a few seconds, the output fit should be plotted. In the top right of the plot widget, the refined spectrum can be changed using the combo-box.Change the fitting range by dragging the limits and by editing the Min/Max line edit boxes. Again, click
Refine in GSAS II
and this should only fit to the user defined range.Back in the file loading section, Browse for files for the inputs
Instrument Group
andFocused Data
, and select files withbank_1
in the name, which were produced by the Calibration and Focus in Test 3.Now, click
Refine in GSAS II
. The previously set fitting range should be ignored as new input files were selected. There should now only be one spectrum available in the output spectrum combobox.Set the
Override Unit Cell Length
to3.65
and clickRefine in GSAS II
, the fit should be better.Tick all the checkboxes:
Microstrain
,Sigma-1
andGamma (Y)
. An asterisk should appear with an advice tooltip.