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

LoadGSASInstrumentFile v1

Summary

Load parameters from a GSAS Instrument file.

See Also

SaveGSASInstrumentFile, LoadGSS, FixGSASInstrumentFile

Properties

Name

Direction

Type

Default

Description

Filename

Input

string

Mandatory

Path to an GSAS file to load. Allowed extensions: [‘.prm’]

OutputTableWorkspace

Output

TableWorkspace

Name of the output TableWorkspace containing instrument parameter information read from file.

UseBankIDsInFile

Input

boolean

True

Use bank IDs as given in file rather than ordinal number of bank. If the bank IDs in the file are not unique, it is advised to set this to false.

Banks

Input

int list

ID(s) of specified bank(s) to load, The IDs are as specified by UseBankIDsInFile. Default is all banks contained in input .prm file.

Workspace

InOut

WorkspaceGroup

A workspace group with the instrument to which we add the parameters from the GSAS instrument file, with one workspace for each bank of the .prm file

WorkspacesForBanks

Input

int list

For each bank, the ID of the corresponding workspace in same order as the banks are specified. ID=1 refers to the first workspace in the workspace group, ID=2 refers to the second workspace and so on. Default is all workspaces in numerical order. If default banks are specified, they too are taken to be in numerical order

Description

Load Ikeda-Carpenter PV parameters from a GSAS instrument file into a table workspace or a workspace group.

Later developments of this algorithm will enable to load back-to-back-exponential pseudo-Voigt parameters translated into BackToBackExponential.

Usage

Example - Run LoadGSASInstrumentFile for both TableWorkspace and workspace with Instrument

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.

# We load a GSAS Instrument file with 2 Banks
tws = LoadGSASInstrumentFile("GSAS_2bank.prm")

#Print first four rows
for i in [0,1,2,3]:
   row = tws.row(i)
   print("{{'Name': '{}','Value_1': {:.2f}, 'Value_2': {:.2f}}}".format(row["Name"], row["Value_1"],  row["Value_2"] ))

Output:

{'Name': 'BANK','Value_1': 1.00, 'Value_2': 2.00}
{'Name': 'Alph0','Value_1': 0.00, 'Value_2': 0.00}
{'Name': 'Alph1','Value_1': 0.21, 'Value_2': 0.22}
{'Name': 'Beta0','Value_1': 31.79, 'Value_2': 31.79}

Example - Run LoadGSASInstrumentFile and put parameters into workspace

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.

# First we load MUSR00015189 workspace group
Load("MUSR00015189",OutputWorkspace="groupWs")
groupWs=mtd["groupWs"]
# We clear instrument parameters...
ClearInstrumentParameters(groupWs)

# ...and check they do not exist
instrument = groupWs.getItem(0).getInstrument()
print("Alpha0 parameter exists:  {}".format(instrument.hasParameter("Alpha0")))
print("Beta0 parameter exists:  {}".format(instrument.hasParameter("Beta0")))
print("SigmaSquared parameter exists:  {}".format(instrument.hasParameter("SigmaSquared")))

# Now we load a GSAS Instrument file with 2 Banks into the workspace...
print("\nLoading parameters from GSAS\n")
tws = LoadGSASInstrumentFile(Filename="GSAS_2bank.prm",UseBankIDsInFile=True,Workspace=groupWs,Banks=[1,2])

# ...and check parameters are there again
instrument = groupWs.getItem(0).getInstrument()
print("Alpha0 parameter exists:  {}".format(instrument.hasParameter("Alpha0")))
print("Beta0 parameter exists:  {}".format(instrument.hasParameter("Beta0")))
print("SigmaSquared parameter exists:  {}".format(instrument.hasParameter("SigmaSquared")))

Output:

Alpha0 parameter exists:  False
Beta0 parameter exists:  False
SigmaSquared parameter exists:  False

Loading parameters from GSAS

Alpha0 parameter exists:  True
Beta0 parameter exists:  True
SigmaSquared parameter exists:  True

Categories: AlgorithmIndex | Diffraction\DataHandling

Source

C++ header: LoadGSASInstrumentFile.h

C++ source: LoadGSASInstrumentFile.cpp