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

UpdatePeakParameterTableValue v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Update cell value(s) in a TableWorkspace containing instrument peak profile parameters.

Properties

Name

Direction

Type

Default

Description

InputWorkspace

InOut

TableWorkspace

Mandatory

TableWorkspace containing peak profile parameters

Column

Input

string

Value

Column name of the cell to have value updated. Choices include ‘FitOrTie’, ‘Max’, ‘Min’, ‘StepSize’ and ‘Value’. Allowed values: [‘Value’, ‘FitOrTie’, ‘Min’, ‘Max’, ‘StepSize’]

Rows

Input

long list

List of row numbers of the cell to have value updated

ParameterNames

Input

str list

List of names of parameters that will have their values updated

NewFloatValue

Input

number

0

New value for the specified cell of type ‘float’.

NewStringValue

Input

string

New value for the specified cell of type ‘string’.

Description

In algorithms related to Le Bail Fit and powder diffractomer instrument profile calibration, TableWorkspace containing the peak profile parameters’ information are used as input and output. UpdatePeakParameterTableValue gives user the method to change the value of parameters’ information, including its status to fit, value, minimum/maximum value (for boundary contrains) and step size (for Monte Carlo optimizer).

Format of TableWorkspace

TableWorkspace containing peak profile parameters must have 2 columns, “Name” and “Value”. It can have but not be limited to the following columns, “Min”, “Max”, “Stepsize” and “FitOrTie”.

Specify A Cell or Cells

The cell to have value updated can be specified by its row and column index.

  • Column index is determined by property “Column”.

  • Row index can be specified by property “Row”, which requires a list of row indexes, or property “ParameterNames”, which requires a list of strings. If “ParameterNames” is used as the input of row indexes, the algorithm will go through each row to match the string value of cell “Name” (i.e., parameter name) to each input parameter name.

  • If neither “Row” nor “ParameterNames” is given by user, then all cells in the column will have the value updated to a same value from either “NewFloatValue” or “NewStringValue” according to the type of the cell.

  • If multiple row indexes are specified, then all the cells of the specified column and rows are updated to same value from either “NewFloatValue” or “NewStringValue”.

How to use algorithm with other algorithms

This algorithm is designed to work with other algorithms to do Le Bail fit.

Usage

Example - Changing the value for a parameter:

tablews=CreateEmptyTableWorkspace()
tablews.addColumn("str", "Name")
tablews.addColumn("double", "Value")
tablews.addRow(["A", 1.34])
tablews.addRow(["B", 2.34])

print("Value before %.2f" % tablews.cell(0, 1))

UpdatePeakParameterTableValue(tablews, Column="Value", ParameterNames=["A"], NewFloatValue=1.00)

print("Value after %.2f" % tablews.cell(0, 1))

Output:

Value before 1.34
Value after 1.00

Categories: AlgorithmIndex | Inelastic\Utility | Transforms\Grouping

Source

Python: UpdatePeakParameterTableValue.py