LoadSpiceXML2DDet v1

../_images/LoadSpiceXML2DDet-v1_dlg.png

LoadSpiceXML2DDet dialog.

Summary

Load 2-dimensional detector data file in XML format from SPICE.

Properties

Name Direction Type Default Description
Filename Input string Mandatory XML file name for one scan including 2D detectors counts from SPICE. Allowed extensions: [‘.xml’]
OutputWorkspace Output MatrixWorkspace Mandatory Name of output matrix workspace. Output workspace will be an X by Y Workspace2D if instrument is not loaded.
DetectorLogName Input string Detector Log name (i.e., XML node name) for detector counts in XML file.By default, the name is ‘Detector’
DetectorGeometry Input unsigned int list   A size-2 unsigned integer array [X, Y] for detector geometry. Such that the detector contains X x Y pixels.
LoadInstrument Input boolean True Flag to load instrument to output workspace. HFIR’s HB3A will be loaded if InstrumentFileName is not specified.
InstrumentFilename Input string   The filename (including its full or relative path) of an instrument definition file. The file extension must either be .xml or .XML when specifying an instrument definition file. Note Filename or InstrumentName must be specified but not both. Allowed extensions: [‘.xml’]
SpiceTableWorkspace Input TableWorkspace   Name of TableWorkspace loaded from SPICE scan file by LoadSpiceAscii.
PtNumber Input number 0 Pt. value for the row to get sample log from.
ShiftedDetectorDistance Input number 0 Amount of shift of the distance between source and detector centre.It is used to apply instrument calibration.

Description

This algorithm is to import SPICE-generated XML file that records data of one measurement by a (two-dimensional) Anger camera and create a MatrixWorkspace to contain the detectors’ counts, monitor counts and other sample log data.

Format of SPICE XML data file

The SPICE XML data file contains four sections under parent node SPICErack. Each section contains child nodes for detailed information.

  • Header: instrument name, reactor power, experiment title and number, scan number and etc.
  • Motor_Position: positions of motor m1, marc, 2theta, chi, phi, omega and etc.
  • Parameter_Positions: reading of sample environment devices, such as temperature at sample.
  • Counters: counting time, monitor counts, and N x N detectors’ counts,

Counts of 2D detector

Counts of an n\times m 2D detectors are recorded in XML file as below:

X(1,1)  X(1,2)  X(1,3) ... X(1,m)
.
.
.
X(n,1)  X(n,2) X(n,3) ... X(n,m)

And the (1,1) position is the bottom left corner of the Anger camera as seen from the sample position.

Output Worskpaces

The output from this algorithm is a MatrixWorskpaces.

MatrixWorskpace with instrument loaded

For a 2D detector with n\times m pixels, the output MatrixWorkspace will have n \times m spectrum. Each spectrum has 1 data point corresponding to 1 detector’s count.

All experiment information, sample environment devices’ readings and monitor counts, which are recorded in XML files, are converted to the properties in output MatrixWorkspace’s sample log.

MatrixWorkspace without instrument loaded

For a 2D detector with n\times m pixels, the output MatrixWorkspace will have n spectrum, each of which has a vector of length equal to m. It can be mapped to the raw data as WS.readY(i)[j] = X(i+1,j+1).

All experiment information, sample environment devices’ readings and monitor counts, which are recorded in XML files, are converted to the properties in output MatrixWorkspace’s sample log.

Workflow

Algorithm LoadSpiceXML2DDet is one of a series of algorithms that are implemented to reduced HFIR HB3A data collected from Anger camera. It will be called next to LoadSpiceAscii to load the detector’s reading.

Usage

Example - load a HB3A SPICE .xml file without loading instrument:

# Load data by LoadSpiceXML2DDet()
LoadSpiceXML2DDet(Filename='HB3A_exp355_scan0001_0522.xml',
    OutputWorkspace='s0001_0522', DetectorGeometry='256,256',
    LoadInstrument=False)

# Access output workspace and print out some result
ws = mtd["s0001_0522"]

print "Number of spectrum = %d." % (ws.getNumberHistograms())
for i, j in [(0, 0), (255, 255), (136, 140), (143, 140)]:
    print "Y[%-3d, %-3d] = %.5f" % (i, j, ws.readY(i)[j])

Output:

Number of spectrum = 256.
Y[0  , 0  ] = 0.00000
Y[255, 255] = 0.00000
Y[136, 140] = 0.00000
Y[143, 140] = 1.00000

Categories: Algorithms | DataHandling\XML