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

SaveParameterFile v1

Summary

Save an instrument’s parameters to an instrument parameter file.

See Also

LoadParameterFile

Properties

Name

Direction

Type

Default

Description

Workspace

Input

MatrixWorkspace

Mandatory

Workspace to save the instrument parameters from.

Filename

Input

string

Mandatory

The name of the file into which the instrument parameters will be saved. Allowed extensions: [‘.xml’]

LocationParameters

Input

boolean

False

Save the location parameters used to calibrate the instrument.

Description

This algorithm allows instrument parameters to be saved into an instrument parameter file. The parameter file can then be inspected and or modified. It can also be loaded back into Mantid using the LoadParameterFile v1 algorithm.

The LocationParameters property specifies whether or not to save any calibration parameters used to adjust the location of any components. If enabled, SaveParameterFile may also output “x”, “y”, “z”, “rotx”, “roty”, and “rotz” parameters when necessary to update the position and rotation of the components.

Usage

import os

#Create a path in the user's home directory
filename = os.path.expanduser("~/params.xml")

#Load a workspace
ws = Load(Filename = "MAR11001.raw")

#Save the workspace's instrument's parameters to the given file.
SaveParameterFile(Workspace = ws, Filename = filename, LocationParameters = False)

#Make sure the file was written successfully
if os.path.isfile(filename):
  print("Parameters written successfully.")
Parameters written successfully.

Example Output:

<?xml version="1.0" encoding="UTF-8"?>
<parameter-file instrument="InstrumentName" valid-from="1900-01-31T23:59:59">
  <component-link name="ComponentName">
    <parameter name="ParameterName">
      <value val="2.17"/>
    </parameter>
  </component-link>
</parameter-file>

Categories: AlgorithmIndex | DataHandling\Instrument

Source

C++ header: SaveParameterFile.h

C++ source: SaveParameterFile.cpp