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

SaveOpenGenieAscii v1

Summary

Saves a focused data set into an OpenGenie ASCII file

See Also

SaveAscii

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

The name of the workspace containing the data you wish to save

Filename

Input

string

Mandatory

The filename to use for the saved data. Allowed values: [‘.his’, ‘.txt’, ‘’]

IncludeHeader

Input

boolean

True

Whether to include the header lines (default: true)

OpenGenieFormat

Input

string

ENGIN-X Format

The format required to successfully load the file to OpenGenie: ENGIN-X Format (default). Allowed values: [‘ENGIN-X Format’]

Description

This algorithm outputs the data in OpenGenie ASCII file, which can also be generated by put /New/Ascii… ` on OpenGenie. The algorithm takes a focused workspaces which would generate an OpenGenie ASCII file with data saved inside. The algorithm will assume focused data (which contains single spectrum) has been provided, but if a workspace with multiple spectra is passed, the algorithm will save the first spectrum, while ignoring the rest. The algorithms will write out the x, y and e axis for each spectra along with all the sample logs which are available in the nexus file which is provided. The x, y, e axis and the sample logs are sorted by ascending alphabetical order within the file, which matches the format of OpenGenie ASCII file. The`ntc field is also included, which is required in order to run the generated file on OpenGenie, the value for ntc is the number of bins of the provided workspace.

Usage

Example - a basic example using SaveOpenGenieAscii.

import os

ws = CreateSampleWorkspace()
ws = ExtractSingleSpectrum(ws, WorkspaceIndex=0)
file_name = "myworkspace.ascii"
path = os.path.join(os.path.expanduser("~"), file_name)

SaveOpenGenieAscii(ws, path)

path = os.path.join(os.path.expanduser("~"), "myworkspace.ascii")
print(os.path.isfile(path))

Output:

True

Categories: AlgorithmIndex | Diffraction\DataHandling | DataHandling\Text

Source

C++ header: SaveOpenGenieAscii.h

C++ source: SaveOpenGenieAscii.cpp