Table of Contents
Modifies an ISIS detector dot data file, so that the detector positions are as in the given workspace
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | Workspace | Mandatory | Workspace with detectors in the positions to be put into the detector dot dat file |
InputFilename | Input | string | Mandatory | Path to a detector dot dat file. Must be of type .dat or .txt. Allowed extensions: [‘.dat’, ‘.txt’] |
OutputFilename | Input | string | Mandatory | Path to the modified detector dot dat file. Must be of type .dat or .txt. Allowed extensions: [‘.dat’, ‘.txt’] |
Modifies an ISIS detector dot data file, so that the detector positions are as in the given workspace. This algorithm can be used to transfer a calibration done via the ApplyCalibration v1 algorithm to an ISIS detector dot dat file by selecting a workspace that has been modified by ApplyCalibration.
A typical ISIS dot data file has a format like this:
DETECTOR.DAT generated by CREATE_DETECTOR_FILE
286729 14
det no. offset l2 code theta phi w_x w_y w_z f_x ...
11 0.000 -3.25800 1 180.00000 0.00000 0.00000 0.00000 0.00000 0.00000 ...
21 0.000 -1.50400 1 180.00000 0.00000 0.00000 0.00000 0.00000 0.00000 ...
1110001 5.300 2.88936 3 52.28653 -140.67224 0.02540 0.02540 0.00283 0.02750 ...
1110002 5.300 2.88794 3 52.26477 -140.72720 0.02540 0.02540 0.00283 0.02750 ...
....
Each row corresponds to a detector whose type is indicated in the code column. The algorithm will only modify values in columns l2, theta and phi and only if the value in the code column is 3, which indicates a PSD gas tube. For more details about the detector dot data file see LoadDetectorInfo#File_format.
Example - Modify a simple dot dat file
import os
result = Load("MUSR00015189")
group = result[0]
ws_1 = group[0]
ws_2 = group[1]
newFile = os.path.join(os.path.expanduser("~"), "detector_1_M.dat")
# Run the Algorithm
ModifyDetectorDotDatFile(ws_1, "detector_1.dat", newFile)
# Check the output file
print("File Exists: {}".format(os.path.exists(newFile)))
f = open( newFile, 'r' )
file = f.read().split('\n')
f.close()
for line in file[0:4]:
# print the line truncating before system dependent line break can take effect
# also stripping off any trailing spaces
print(line[0:89].rstrip())
Output:
File Exists: True
DETECTOR.DAT generated by CREATE_DETECTOR_FILE and edited by hand and modified by MANTID
286729 14
det no. offset l2 code theta phi w_x w_y w_z
1 5.300 0.20156 3 43.99491 -129.37500 0.02540 0.02540 0.0
Categories: AlgorithmIndex | DataHandling\Instrument
C++ source: ModifyDetectorDotDatFile.cpp (last modified: 2019-06-05)
C++ header: ModifyDetectorDotDatFile.h (last modified: 2018-10-05)