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

CreateLogTimeCorrection v1

Summary

Create log time correction table. Correction for each pixel is based on L1 and L2.

See Also

ChangePulsetime, ShiftLogTime

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Name of the input workspace to generate log correct from.

OutputWorkspace

Output

TableWorkspace

Mandatory

Name of the output workspace containing the corrections.

OutputFilename

Input

string

Name of the output time correction file.

Description

For fast frequency sample logs, the time-of-flight of each neutron is recorded at detector. As the sample log time is recorded at sample, each neutron’s flight time must be corrected to sample to be filtered correctly by log value.

Usage

Example - generate correction table workspace and file for a powder diffractomer:

# Load nexus file
LoadNexusProcessed(Filename="PG3_2538_2k.nxs", OutputWorkspace="PG3_2538")

# Calculate the correction factor
corrws = CreateLogTimeCorrection(InputWorkspace="PG3_2538", OutputFilename="/tmp/tempcorr.txt")

# Load output file
cfile = open("/tmp/tempcorr.txt", "r")
lines = cfile.readlines()
cfile.close()

# Print out partial result
print("From output TableWorkspace:")
print("detector (ID: {}) correction = {:.6f}".format(corrws.cell(0, 0), corrws.cell(0, 1)))
print("detector (ID: {}) correction = {:.6f}".format(corrws.cell(10, 0), corrws.cell(10, 1)))
print("detector (ID: {}) correction = {:.6f}".format(corrws.cell(100, 0), corrws.cell(100, 1)))
print("detector (ID: {}) correction = {:.6f}".format(corrws.cell(1000, 0), corrws.cell(1000, 1)))
print("detector (ID: {}) correction = {:.6f}".format(corrws.cell(10000, 0), corrws.cell(1000, 1)))

print("\nFrom output file:")
terms = lines[0].split()
print("detector (ID: {}) correction = {}".format(terms[0], terms[1]))
terms = lines[10].split()
print("detector (ID: {}) correction = {}".format(terms[0], terms[1]))
terms = lines[100].split()
print("detector (ID: {}) correction = {}".format(terms[0], terms[1]))
terms = lines[1000].split()
print("detector (ID: {}) correction = {}".format(terms[0], terms[1]))
terms = lines[10000].split()
print("detector (ID: {}) correction = {}".format(terms[0], terms[1]))

Output:

From output TableWorkspace:
detector (ID: 27500) correction = 0.959075
detector (ID: 27510) correction = 0.959216
detector (ID: 27600) correction = 0.959075
detector (ID: 28500) correction = 0.956743
detector (ID: 102798) correction = 0.956743

From output file:
detector (ID: 27500) correction = 0.95908
detector (ID: 27510) correction = 0.95922
detector (ID: 27600) correction = 0.95907
detector (ID: 28500) correction = 0.95674
detector (ID: 102798) correction = 0.95036

Categories: AlgorithmIndex | Events\EventFiltering

Source

C++ header: CreateLogTimeCorrection.h

C++ source: CreateLogTimeCorrection.cpp