\(\renewcommand\AA{\unicode{x212B}}\)
SaveGSS v1¶
Summary¶
Saves a focused data set into a three column GSAS format.
See Also¶
Properties¶
Name |
Direction |
Type |
Default |
Description |
---|---|---|---|---|
InputWorkspace |
Input |
Mandatory |
The input workspace |
|
Filename |
Input |
string |
Mandatory |
The filename to use for the saved data. Allowed extensions: [‘.gsa’, ‘.gss’, ‘.gda’, ‘.txt’] |
SplitFiles |
Input |
boolean |
True |
Whether to save each spectrum into a separate file (‘true’) or not (‘false’). Note that this is a string, not a boolean property. |
Append |
Input |
boolean |
True |
If true and Filename already exists, append, else overwrite |
Bank |
Input |
number |
1 |
The bank number to include in the file header for the first spectrum, i.e., the starting bank number. This will increment for each spectrum or group member. |
Format |
Input |
string |
RALF |
GSAS format to save as. Allowed values: [‘RALF’, ‘SLOG’] |
DataFormat |
Input |
string |
FXYE |
Saves RALF data as either FXYE or alternative format. Allowed values: [‘FXYE’, ‘ALT’] |
MultiplyByBinWidth |
Input |
boolean |
True |
Multiply the intensity (Y) by the bin width; default TRUE. |
ExtendedHeader |
Input |
boolean |
False |
Add information to the header about iparm file and normalization |
UseSpectrumNumberAsBankID |
Input |
boolean |
False |
If true, then each bank’s bank ID is equal to the spectrum number; otherwise, the continuous bank IDs are applied. |
UserSpecifiedGSASHeader |
Input |
str list |
Each line will be put to the header of the output GSAS file. |
|
OverwriteStandardHeader |
Input |
boolean |
True |
If true, then the standard header will be replaced by the user specified header. Otherwise, the user specified header will be inserted before the original header |
UserSpecifiedBankHeader |
Input |
str list |
Each string will be used to replaced the standard GSAS bank header.Number of strings in the give array must be same as number of banks.And the order is preserved. |
|
SLOGXYEPrecision |
Input |
int list |
9,9,9 |
Enter 3 integers as the precisions of output X, Y and E for SLOG data only.Default is (9, 9, 9) if it is left empty. Otherwise it is not allowed. |
Description¶
Saves a focused data set into a three column GSAS format containing X_i, Y_i*step, and E_I*step. Exclusively for the crystallography package GSAS . 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_”+workspace_index_number.
From the GSAS manual a description of the format options:
If BINTYP is ‘SLOG’ then the neutron TOF data was collected in constant ∆T/T steps. BCOEF(1) is the initial TOF in μsec, and BCOEF(3) is the value of ∆T/T used in the data collection. BCOEF(2) is a maximum TOF for the data set. BCOEF(4) is zero and ignored.
If BINTYP equals ‘RALF’ then the data was collected at one of the TOF neutron diffractometers at the ISIS Facility, Rutherford-Appleton Laboratory. The width of the time bins is constant for a section of the data at small values of TOF and then varies (irregularly) in pseudoconstant ∆T/T steps. In this case BCOEF(1) is the starting TOF in μsec*32, BCOEF(2) is the width of the first step in μsec*32, BCOEF(3) is the start of the log scaled step portion of the data in μsec*32 and BCOEF(4) is the resolution to be used in approximating the size of each step beyond BCOEF(3).
The format is limited to saving 99 spectra in total. Trying to save more will generate an error, unless SplitFiles is on.
Usage¶
Example - a basic example using SaveGSS.
import os
# Create a workspace to save
ws = CreateSampleWorkspace(OutputWorkspace="SaveGSSWorkspace")
ws = ExtractSingleSpectrum(ws, WorkspaceIndex=0)
# Save to the users home directory
file_name = "myworkspace.ascii"
path = os.path.join(os.path.expanduser("~"), file_name)
SaveGSS(ws, path)
# Does the file exist
path = os.path.join(os.path.expanduser("~"), file_name)
print(os.path.isfile(path))
Output:
True
Example - an example using SaveGSS with additional options.
import os
ws = CreateSampleWorkspace(OutputWorkspace="SaveGSSWorkspace")
# GSAS file cannot have more than 99 entries
ws = CropWorkspace(ws, StartWorkspaceIndex=0, EndworkspaceIndex=98)
# Save out GSAS file
file_name = "myworkspace.ascii"
path = os.path.join(os.path.expanduser("~"), file_name)
SaveGSS(ws, path, SplitFiles=False, ExtendedHeader=True, UseSpectrumNumberAsBankID=True)
print(os.path.isfile(path))
Output:
True
Categories: AlgorithmIndex | Diffraction\DataHandling | DataHandling\Text
Source¶
C++ header: SaveGSS.h
C++ source: SaveGSS.cpp