\(\renewcommand\AA{\unicode{x212B}}\)

GetSpiceDataRawCountsFromMD v1

Summary

Get detectors’ raw counts or sample environment log values from IMDEventWorkspace created from SPICE data file.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MDEventWorkspace

Mandatory

Name of the input data MDEventWorkspace from which the raw values are retrieved.

MonitorWorkspace

Input

MDEventWorkspace

Mandatory

Name of the input monitor MDEventWorkspace paired with input data workspace.

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Name of the output MatrixWorkspace containing the raw data required.

Mode

Input

string

Detector

Mode selector. (1) Pt.: get the raw detectors’ signal of the specified Pt.; (2) Detector: get one detector’s signals along all experiment points; (3) Sample Log: get the value of a sample log along all experiment points. Allowed values: [‘Pt.’, ‘Detector’, ‘Sample Log’]

XLabel

Input

string

Label for the X-values of the output MatrixWorkspace. For mode ‘Pt.’, it won’t take value. The output of X-axis is always 2-theta. For mode ‘Detector’, if it is left blank, the default then will be 2-theta value of detector’s position. For mode ‘Sample Log’, the default value is ‘Pt.’. In the later 2 modes, XLabel can be any supported sample log’s name.

Pt

Input

number

Optional

Experiment point number (i.e., run_number in MDEventWorkspace of the detectors’ counts to be exported. It is used in mode ‘Pt.’ only.

DetectorID

Input

number

Optional

Detector ID of the detector whose raw counts will be exported for all experiment points.It is used in mode ‘Detector’ only.

SampleLogName

Input

string

Name of the sample log whose value to be exported. It is used in mode ‘Sample Log’ only.

NormalizeByMonitorCounts

Input

boolean

True

If specified as true, all the output detectors’ counts will be normalized by their monitor counts.

Description

This algorithm is to export raw experimental data from MDEventWorkspaces, to which a SPICE data file is loaded.

It provides 3 modes, Pt., Detector and Sample Log for various types of experimental data to export.

Limitation

This algorithm fully supports the SPICE data of powder diffractometers. Some features may not work with other SPICE data.

Inputs

Two input MDEventWorkspaces that are required.

InputWorkspace is an MDEventWorkspace that stores detectors counts and sample logs. Each run in this MDEventWorkspace corresponds to an individual measurement point in experiment run. Each run has its own instrument object.

The other input MDEventWorkspace, i.e., MonitorWorkspace contains the monitor counts of each measurement point. The signal value of each MDEvent in this workspace is the monitor counts corresponding to an individual detector.

These two MDEventWorkspace should have the same number of runs and same number of MDEvent.

Outputs

One single-spectrum MatrixWorkspace is the output of this algorithm.

Mode Pt.

The x-values are the \(2\theta\) positions of all detectors in a specific experiment measuring point (i.e., Pt. and run number). The y-values are the raw counts or normalized intensities (by monitor counts) of all those detectors of the same Pt..

Mode Detector

The x-values can be either \(2\theta\) positions of all detectors or any sample log’s values for all experiment measuring points (i.e., Pt.). The y-values are the raw counts or normalized intensities of a specified detector among all Pt..

Mode Sample Log

The x-values can be any sample log’s values of all experiment measuring points (i.e., Pt.). The y-values are the values of a specified sample log among all Pt..

Usage

Example - load a SPICE .dat file for HB2A:

# create table workspace and parent log workspace
LoadSpiceAscii(Filename='HB2A_exp0231_scan0001.dat',
      IntegerSampleLogNames="Sum of Counts, scan, mode, experiment_number",
      FloatSampleLogNames="samplemosaic, preset_value, Full Width Half-Maximum, Center of Mass",
      DateAndTimeLog='date,MM/DD/YYYY,time,HH:MM:SS AM',
      OutputWorkspace='Exp0231DataTable',
      RunInfoWorkspace='Exp0231ParentWS')

# load for HB2A
ConvertSpiceDataToRealSpace(InputWorkspace='Exp0231DataTable',
      RunInfoWorkspace='Exp0231ParentWS',
      OutputWorkspace='Exp0231DataMD',
      OutputMonitorWorkspace='Exp0231MonitorMD')


# Get raw counts of DetID = 20 out
ws = GetSpiceDataRawCountsFromMD(InputWorkspace='Exp0231DataMD',
    MonitorWorkspace='Exp0231MonitorMD',
    OutputWorkspace='Det20Counts', DetectorID=20)

# output
for i in [3, 9, 44, 60]:
    print("X[{}] = {:.5f}, Y[{}] = {:.5f}".format(i, ws.readX(0)[i], i, ws.readY(0)[i]))

Output:

X[3] = 57.53600, Y[3] = 0.00281
X[9] = 58.13600, Y[9] = 0.00354
X[44] = 61.63600, Y[44] = 0.00315
X[60] = 63.23600, Y[60] = 0.00325

Categories: AlgorithmIndex | Diffraction\ConstantWavelength

Source

C++ header: GetSpiceDataRawCountsFromMD.h

C++ source: GetSpiceDataRawCountsFromMD.cpp