CheckWorkspacesMatch v1

../_images/CheckWorkspacesMatch-v1_dlg.png

CheckWorkspacesMatch dialog.

Warning

CheckWorkspacesMatch is deprecated (on 2015-10-27). Use CompareWorkspaces instead.

Summary

Compares two workspaces for equality. This algorithm is mainly intended for use by the Mantid development team as part of the testing process.

Properties

Name Direction Type Default Description
Workspace1 Input Workspace Mandatory The name of the first input workspace.
Workspace2 Input Workspace Mandatory The name of the second input workspace.
Tolerance Input number 0 The maximum amount by which values may differ between the workspaces.
CheckType Input boolean True Whether to check that the data types (Workspace2D vs EventWorkspace) match.
CheckAxes Input boolean True Whether to check that the axes match.
CheckSpectraMap Input boolean True Whether to check that the spectra-detector maps match.
CheckInstrument Input boolean True Whether to check that the instruments match.
CheckMasking Input boolean True Whether to check that the bin masking matches.
CheckSample Input boolean False Whether to check that the sample (e.g. logs).
Result Output string    
ToleranceRelErr Input boolean False Treat tolerance as relative error rather then the absolute error. This is only applicable to Matrix workspaces.
CheckAllData Input boolean False Usually checking data ends when first mismatch occurs. This forces algorithm to check all data and print mismatch to the debug log. Very often such logs are huge so making it true should be the last option.
NumberMismatchedSpectraToPrint Input number 1 Number of mismatched spectra from lowest to be listed.
DetailedPrintIndex Input number Optional Mismatched spectra that will be printed out in details.

Description

This algorithm is deprecated. Please use CompareWorkspaces instead.

Compares two workspaces for equality. This algorithm is mainly intended for use by Mantid developers as part of the testing process.

The data values (X,Y and error) are always checked. The algorithm can also optionally check the axes (this includes the units), the spectra-detector map, the instrument (the name and parameter map) and any bin masking.

In the case of EventWorkspaces, they are checked to hold identical event lists. Comparisons between an EventList and a Workspace2D always fail.

Usage

Example - check that two workspaces are equal to one another:

dataX = [0,1,2,3,4,5,6,7,8,9]
dataY = [1,1,1,1,1,1,1,1,1]
ws1 = CreateWorkspace(dataX, dataY)

#create a copy of the workspace
ws2 = CloneWorkspace(ws1)

print(CheckWorkspacesMatch(ws1, ws2))

Output:

Success!

Example - check that two workspaces match within a certain tolerance:

import numpy as np

#create a workspace with some simple data
dataX = range(0,20)
dataY1 = np.sin(dataX)
ws1 = CreateWorkspace(dataX, dataY1)

#create a similar workspace, but with added noise
dataY2 = np.sin(dataX) + 0.1*np.random.random_sample(len(dataX))
ws2 = CreateWorkspace(dataX, dataY2)

print(CheckWorkspacesMatch(ws1, ws2)) #fails, they're not the same
print(CheckWorkspacesMatch(ws1, ws2, Tolerance=0.1)) #passes, they're close enough

Output:

Data mismatch
Success!

Categories: Algorithms | Utility\Workspaces | Deprecated

Source

C++ source: CheckWorkspacesMatch.cpp (last modified: 2016-07-11)

C++ header: CheckWorkspacesMatch.h (last modified: 2016-06-13)