CompareSampleLogs v1

../_images/CompareSampleLogs-v1_dlg.png

CompareSampleLogs dialog.

Summary

Compares specified sample logs for a given list of workspaces.

Properties

Name Direction Type Default Description
InputWorkspaces Input str list Mandatory Comma separated list of workspaces or groups of workspaces.
SampleLogs Input str list Mandatory Comma separated list of sample logs to compare.
Tolerance Input number 0.001 Tolerance for comparison of double values.
Result Output string    

Description

Utility algorithm. Compares specified sample logs for a given list of workspaces or workspace groups. If sample logs match, no output will be produced. If sample logs do not match or do not exist, comma separated list of these sample logs will be returned. This list can be used as an input for CreateLogPropertyTable v1 algorithm to get a TableWorkspace with not identical properties.

For the moment, algorithm does not support comparison of the time series logs.

Usage

Example 1: compare identical sample logs

# create workspaces with some sample logs
ws1 = CreateSampleWorkspace()
ws2 = CreateSampleWorkspace()

lognames = 'omega,wavelength,polarisation,flipper'
logvalues = '10.0,4.2,x,ON'
AddSampleLogMultiple(Workspace=ws1, LogNames=lognames, LogValues=logvalues, ParseType=True)
logvalues = '10.0,4.2,x,ON'
AddSampleLogMultiple(Workspace=ws2, LogNames=lognames, LogValues=logvalues, ParseType=True)

# compare sample logs
result = CompareSampleLogs('ws1,ws2', 'omega,wavelength,polarisation,flipper' , 0.01)
if result == '':
    print "All sample logs match!"

Output:

All sample logs match!

Example 2: create a table of not identical sample logs

# create workspaces with some sample logs
ws1 = CreateSampleWorkspace()
ws2 = CreateSampleWorkspace()

lognames = 'run_title,omega,wavelength,polarisation,flipper'
logvalues = 'ws1,10.0,4.2,x,ON'
AddSampleLogMultiple(Workspace=ws1, LogNames=lognames, LogValues=logvalues, ParseType=True)
logvalues = 'ws2,12.0,4.2,x,OFF'
AddSampleLogMultiple(Workspace=ws2, LogNames=lognames, LogValues=logvalues, ParseType=True)

# compare sample logs
result = CompareSampleLogs('ws1,ws2', lognames , 0.01)
print "Following sample logs do not match: ", result

# create a table
table = CreateLogPropertyTable('ws1,ws2', result, GroupPolicy='All')
print "Column names are: ", table.getColumnNames()
print "The omega values are:", table.column(1)
print "The flipper values are:", table.column(2)

Output:

Following sample logs do not match:  run_title,omega,flipper
Column names are:  ['run_title', 'omega', 'flipper']
The omega values are: ['10', '12']
The flipper values are: ['ON', 'OFF']

Categories: Algorithms | Utility\Workspaces