\(\renewcommand\AA{\unicode{x212B}}\)
SaveFocusedXYE v1¶
Summary¶
Saves a focused data set (usually the output of a diffraction focusing routine but not exclusively) into a three column format containing X_i, Y_i, and E_i.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
The name of the workspace containing the data you wish to save |
|
Filename |
Input |
string |
Mandatory |
The filename to use when saving data |
SplitFiles |
Input |
boolean |
True |
Save each spectrum in a different file (default true) |
StartAtBankNumber |
Input |
number |
0 |
Start bank (spectrum) numbers at this number in the file. The bank number in the file will be the workspace index + StartAtBankNumber. |
Append |
Input |
boolean |
False |
If true and Filename already exists, append, else overwrite |
IncludeHeader |
Input |
boolean |
True |
Whether to include the header lines (default: true) |
Format |
Input |
string |
XYE |
A type of the header: XYE (default) or MAUD. Allowed values: [‘XYE’, ‘MAUD’, ‘TOPAS’] |
Description¶
This algorithm outputs the data in ASCII as a 3 column X, Y ,E format for use in subsequent analysis by other programs. The output files can be read for example into FullProf with format instrument=10.
For data where the focusing routine has generated several spectra (for example, multi-bank instruments), the option is provided for saving all spectra into a single file, separated by headers, or into several files that will be named “workspaceName-“+spectra_number
Optionally, it can write the header lines (up to 6) which are preceded with # symbol, so do not count as data. Header provides some metadata information about the file. When the spectrum axis unit caption of the input workspace is Temperature, the corresponding header entry would be preceded with the Fullprof keyword TEMP.
Current Issues¶
Fullprof expects the data to be in TOF, however at present the DiffractionFocussing v2 algorithm in Mantid leaves the data in d-spacing.
If the written file is to be loaded into TOPAS, then headers should be omitted (set the IncludeHeader property to false);
Usage¶
Example - a basic example using SaveFocusedXYE.
import os
ws = CreateSampleWorkspace()
ws = ExtractSingleSpectrum(ws, 0)
file_name = "myworkspace.ascii"
path = os.path.join(os.path.expanduser("~"), "myworkspace.ascii")
SaveFocusedXYE(ws, path)
path = os.path.join(os.path.expanduser("~"), "myworkspace-0.ascii")
print(os.path.isfile(path))
Output:
True
Example - an example using SaveFocusedXYE with additional options.
import os
ws = CreateSampleWorkspace()
ws = CropWorkspace(ws, StartWorkspaceIndex=0, EndWorkspaceIndex=4)
file_name = "myworkspace.ascii"
path = os.path.join(os.path.expanduser("~"), file_name)
SaveFocusedXYE(ws, path, SplitFiles=False, IncludeHeader=True, Format='MAUD')
print(os.path.isfile(path))
Output:
True
Categories: AlgorithmIndex | Diffraction\DataHandling | DataHandling\Text
Source¶
C++ header: SaveFocusedXYE.h
C++ source: SaveFocusedXYE.cpp