SavePHX v1

../_images/SavePHX-v1_dlg.png

SavePHX dialog.

Summary

Writes the detector geometry information of a workspace into a PHX format file.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The input workspace
Filename Input string Mandatory The filename to use for the saved data

Description

Saves the geometry information of the detectors in a workspace into a PHX format ASCII file. The angular positions and angular sizes of the detectors are calculated using FindDetectorsPar v1 algorithm.

Mantid generated PHX file is an ASCII file consisting of the header and 7 text columns. Header contains the number of the rows in the phx file excluding the header (number of detectors). The column has the following information about a detector:

Column Number Column Description
1st secondary flightpath,e.g. sample to detector distance (m)
2nd 0
3rd scattering angle (deg)
4th azimuthal angle (deg) (west bank = 0 deg, north bank = 90 deg etc.) Note the reversed sign convention wrt the .par files. For details, see: SavePAR v1
5th angular width e.g. delta scattered angle (deg)
6th angular height e.g. delta azimuthal angle (deg)
7th  detector ID   – this is Mantid specific value, which may not hold similar meaning in files written by different applications.

In standard phx file only the columns 3,4,5 and 6 contain useful information. You can expect to find column 1 to be the secondary flightpath and the column 7 – the detector ID in Mantid-generated phx files only.

Usage

Example - Save PHX file

# import os functions to work with folders
import os
# create sample workspace
ws=CreateSampleWorkspace()
# test file name
file_name = os.path.join(config["defaultsave.directory"], "TestSavePhx.phx")
 # save the file
SavePHX(ws,Filename=file_name);

print("target file exists? {0}".format(os.path.exists(file_name)))

Output:

target file exists? True

Categories: AlgorithmIndex | DataHandling\SPE | Inelastic\DataHandling

Source

C++ source: SavePHX.cpp (last modified: 2019-07-17)

C++ header: SavePHX.h (last modified: 2018-10-05)