AddSampleLog v1

../_images/AddSampleLog-v1_dlg.png

AddSampleLog dialog.

Summary

Used to insert a value into the sample logs in a workspace.

Properties

Name Direction Type Default Description
Workspace InOut Workspace Mandatory Workspace to add the log entry to
LogName Input string Mandatory The name that will identify the log entry
LogText Input string   The content of the log
LogType Input string String The type that the log data will be. Allowed values: [‘String’, ‘Number’, ‘Number Series’]
LogUnit Input string   The units of the log
NumberType Input string AutoDetect Force LogText to be interpreted as a number of type ‘int’ or ‘double’. Allowed values: [‘Int’, ‘Double’, ‘AutoDetect’]
TimeSeriesWorkspace Input MatrixWorkspace   Optional workspace contain the data
WorkspaceIndex Input number 0 The workspace index of the TimeSeriesWorkspace to be imported.
AutoMetaData Input boolean False If it is specified as true, then all the meta data information will be retrieved from the input workspace. It will be used with algorithm ExportTimeSeriesProperty.
TimeUnit Input string Second The unit of the time of the input workspace. Allowed values: [‘Second’, ‘Nanosecond’]
RelativeTime Input boolean True If specified as True, then then the time stamps are relative to the run start time of the target workspace.

Description

Workspaces contain information in logs. Often these detail what happened to the sample during the experiment. This algorithm allows one named log to be entered.

The log can be either a String, a Number, or a Number Series. If you select Number Series, the workspace start time will be used as the time of the log entry, and the number in the text used as the (only) value.

If the LogText contains a numeric value, the created log will be of integer type if an integer is passed and floating point (double) otherwise. This applies to both the Number & Number Series options.

The algorithm can be forced to create a log of integer or floating point type by using the optional NumberType property as ‘Int’ or ‘Double’. For example, with NumberType=’Double’ the log for LogText=‘12’ would be created as a floating point (double) rather than an integer. NumberType defaults to ‘AutoDetect’ which decides whether to use integer or floating point based on the format of the string, e.g. LogText=‘12’ would create an integer type log and LogText=‘12.0’ would create a floating point type log.

To add logs that vary over time (Time Series Logs) use AddTimeSeriesLog v1.

Usage

Example - Add Sample Logs in different ways

# Create a host workspace
demo_ws = CreateWorkspace(DataX=range(0,3), DataY=(0,2))

# Add sample logs
AddSampleLog(Workspace=demo_ws, LogName='x', LogText='hello world', LogType='String')
AddSampleLog(Workspace=demo_ws, LogName='y', LogText='1', LogType='Number')
AddSampleLog(Workspace=demo_ws, LogName='z', LogText='2', LogType='Number Series')

# Fetch the generated logs
run = demo_ws.getRun()
log_x = run.getLogData('x')
log_y = run.getLogData('y')
log_z = run.getLogData('z')

# Print the log values
print(log_x.value)
print(log_y.value)
print(log_z.value)

Output:

hello world
1
[2]

Categories: AlgorithmIndex | DataHandling\Logs

Source

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

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