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

SaveDaveGrp v1

Summary

Saves a 2D workspace to DAVE grouped data format file.See http://www.ncnr.nist.gov/dave/documentation/ascii_help.pdf

See Also

LoadDaveGrp

This algorithm is also known as: SaveDASC

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

An input workspace.

Filename

Input

string

Mandatory

A DAVE grouped data format file that will be created. Allowed extensions: [‘.grp’]

ToMicroEV

Input

boolean

False

Transform all energy units from milli eV to micro eV

Description

Saves a workspace to a DAVE grp file. A description of the DAVE grouped data format can be found here.

Usage

The DAVE grouped ASCII file is normally used to support S(Q, E) workspaces. So, a contrived example will be created.

Note

To run these usage examples please first download the usage data, and add these to your path. In Mantid this is done using Manage User Directories.

ws = Load("CNCS_7860_event.nxs")
ws = ConvertUnits(ws, Target="DeltaE", EMode="Direct", EFixed=3.0)
ws = Rebin(ws, Params=[-3,0.01,3], PreserveEvents=False)
ws = SofQW(ws, QAxisBinning=[0.2,0.2,3], EMode="Direct", EFixed=3.0)
print("Workspace size = ( {} , {} )".format(ws.getNumberHistograms(), ws.blocksize()))
import os
savefile = os.path.join(config["default.savedirectory"], "CNCS_7860_sqw.grp")
SaveDaveGrp(ws, Filename=savefile)
print("File created: {}".format(os.path.exists(savefile)))
ifile = open(savefile, 'r')
lines = ifile.readlines()
ifile.close()
# Number of lines = header(4) + Q axis spec(1 + 14) + E axis spec(1 + 600)
#                   + data(14 * 601)
print("Number of lines = {}".format(len(lines)))

Output:

Workspace size = ( 14 , 600 )
File created: True
Number of lines = 9034

Categories: AlgorithmIndex | DataHandling\Text | Inelastic\DataHandling

Source

C++ header: SaveDaveGrp.h

C++ source: SaveDaveGrp.cpp