Unverified Commit a892cb53 authored by Whitfield, Ross's avatar Whitfield, Ross Committed by GitHub
Browse files

Merge pull request #31924 from walshmm/pd276_CombineDifcAlco2_ornl_next

Pd276 combine difc alco2 ornl next
parents b578b205 94aa7d4f
......@@ -46,6 +46,7 @@ set(SRC_FILES
src/ClearInstrumentParameters.cpp
src/ClearMaskFlag.cpp
src/CloneWorkspace.cpp
src/CombineDiffCal.cpp
src/Comment.cpp
src/CommutativeBinaryOperation.cpp
src/CompareWorkspaces.cpp
......@@ -382,6 +383,7 @@ set(INC_FILES
inc/MantidAlgorithms/ClearInstrumentParameters.h
inc/MantidAlgorithms/ClearMaskFlag.h
inc/MantidAlgorithms/CloneWorkspace.h
inc/MantidAlgorithms/CombineDiffCal.h
inc/MantidAlgorithms/Comment.h
inc/MantidAlgorithms/CommutativeBinaryOperation.h
inc/MantidAlgorithms/CompareWorkspaces.h
......@@ -738,6 +740,7 @@ set(TEST_FILES
ClearInstrumentParametersTest.h
ClearMaskFlagTest.h
CloneWorkspaceTest.h
CombineDiffCalTest.h
CommentTest.h
CommutativeBinaryOperationTest.h
CompareWorkspacesTest.h
......
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include "MantidAPI/Algorithm.h"
#include "MantidAlgorithms/DllConfig.h"
#include "MantidDataObjects/TableWorkspace.h"
namespace Mantid {
namespace Algorithms {
/** CombineDiffCal : Calibrate groups of pixels after cross correlation so that diffraction peaks can be adjusted to the
* correct positions
*/
class MANTID_ALGORITHMS_DLL CombineDiffCal : public API::Algorithm {
public:
const std::string name() const override;
int version() const override;
const std::string category() const override;
const std::string summary() const override;
std::map<std::string, std::string> validateInputs() override;
private:
API::ITableWorkspace_sptr sortTableWorkspace(DataObjects::TableWorkspace_sptr &table);
void init() override;
void exec() override;
};
} // namespace Algorithms
} // namespace Mantid
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2021 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#include "MantidAlgorithms/CombineDiffCal.h"
#include "MantidAPI/SpectrumInfo.h"
#include "MantidAPI/TableRow.h"
#include "MantidDataObjects/MaskWorkspace.h"
#include "MantidDataObjects/OffsetsWorkspace.h"
#include "MantidDataObjects/TableWorkspace.h"
namespace Mantid {
namespace Algorithms {
using Mantid::API::WorkspaceProperty;
using Mantid::Kernel::Direction;
// Register the algorithm into the AlgorithmFactory
DECLARE_ALGORITHM(CombineDiffCal)
//----------------------------------------------------------------------------------------------
/// Algorithms name for identification. @see Algorithm::name
const std::string CombineDiffCal::name() const { return "CombineDiffCal"; }
/// Algorithm's version for identification. @see Algorithm::version
int CombineDiffCal::version() const { return 1; }
/// Algorithm's category for identification. @see Algorithm::category
const std::string CombineDiffCal::category() const { return "Diffraction\\Utility"; }
/// Algorithm's summary for use in the GUI and help. @see Algorithm::summary
const std::string CombineDiffCal::summary() const {
return "Combine a per-pixel calibration with a grouped spectrum calibration";
}
//----------------------------------------------------------------------------------------------
/** Initialize the algorithm's properties.
*/
void CombineDiffCal::init() {
declareProperty(
std::make_unique<WorkspaceProperty<DataObjects::TableWorkspace>>("PixelCalibration", "", Direction::Input),
"OffsetsWorkspace generated from cross-correlation. This is the source of DIFCpixel.");
declareProperty(
std::make_unique<WorkspaceProperty<DataObjects::TableWorkspace>>("GroupedCalibration", "", Direction::Input),
"DiffCal table generated from calibrating grouped spectra. This is the source of DIFCgroup.");
declareProperty(
std::make_unique<WorkspaceProperty<API::MatrixWorkspace>>("CalibrationWorkspace", "", Direction::Input),
"Workspace where conversion from d-spacing to time-of-flight for each spectrum is determined from. This is the "
"source of DIFCarb.");
declareProperty(
std::make_unique<WorkspaceProperty<DataObjects::TableWorkspace>>("OutputWorkspace", "", Direction::Output),
"DiffCal table generated from calibrating grouped spectra");
declareProperty(std::make_unique<WorkspaceProperty<DataObjects::MaskWorkspace>>("MaskWorkspace", "", Direction::Input,
API::PropertyMode::Optional),
"MaskedWorkspace for PixelCalibration");
}
/// sort the calibration table according increasing values in column "detid"
API::ITableWorkspace_sptr CombineDiffCal::sortTableWorkspace(DataObjects::TableWorkspace_sptr &table) {
auto alg = createChildAlgorithm("SortTableWorkspace");
alg->setLoggingOffset(1);
alg->setProperty("InputWorkspace", table);
alg->setProperty("OutputWorkspace", table);
alg->setProperty("Columns", "detid");
alg->executeAsChildAlg();
return alg->getProperty("OutputWorkspace");
}
bool findColumn(const std::vector<std::string> &columnNames, const std::string &name) {
return std::find(columnNames.begin(), columnNames.end(), name) != columnNames.end();
}
std::string generateErrorString(const DataObjects::TableWorkspace_sptr ws) {
const std::vector<std::string> columnNames = ws->getColumnNames();
std::stringstream error;
if (!findColumn(columnNames, "detid"))
error << "detid ";
if (!findColumn(columnNames, "difc"))
error << "difc ";
if (!findColumn(columnNames, "difa"))
error << "difa ";
if (!findColumn(columnNames, "tzero"))
error << "tzero ";
return error.str();
}
std::map<std::string, std::string> CombineDiffCal::validateInputs() {
std::map<std::string, std::string> results;
const DataObjects::TableWorkspace_sptr groupedCalibrationWS = getProperty("GroupedCalibration");
const DataObjects::TableWorkspace_sptr pixelCalibrationWS = getProperty("PixelCalibration");
const auto groupedResult = generateErrorString(groupedCalibrationWS);
if (!groupedResult.empty())
results["GroupedCalibration"] = "The GroupedCalibration Workspace is missing [ " + groupedResult + "]";
const auto pixelResult = generateErrorString(pixelCalibrationWS);
if (!pixelResult.empty())
results["PixelCalibration"] = "The PixelCalibration Workspace is missing [ " + pixelResult + "]";
return results;
}
std::shared_ptr<Mantid::API::TableRow> binarySearchForRow(API::ITableWorkspace_sptr ws, int detid) {
size_t start = 0;
size_t end = ws->rowCount() - 1;
while (end >= start) {
size_t currentPosition = start + ((end - start) / 2);
Mantid::API::TableRow currentRow = ws->getRow(currentPosition);
currentRow = ws->getRow(currentPosition);
if (currentRow.Int(0) > detid) {
end = currentPosition - 1;
} else if (currentRow.Int(0) < detid) {
start = currentPosition + 1;
} else {
return std::make_shared<Mantid::API::TableRow>(currentRow);
}
}
return nullptr;
}
void addRowFromGroupedCalibration(DataObjects::TableWorkspace_sptr ws, Mantid::API::TableRow row) {
Mantid::API::TableRow newRow = ws->appendRow();
newRow << row.Int(0) << row.Double(1) << row.Double(2) << row.Double(3);
}
// Per Pixel:
//
// DIFC{eff} = (DIFC{pd}/DIFC{arb}) * DIFC{prev}
//
// DIFC{eff} = Output of this Alg, the combined DIFC
// DIFC{pd} = The DIFC produced by PDCalibration, found in the "GroupedCalibration"
// DIFC{arb} = found in the "CalibrationWorkspace" param
// DIFC{prev} = The previous DIFCs, found in "PixelCalibration", as per description this was the set generated by CC
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
void CombineDiffCal::exec() {
const API::MatrixWorkspace_sptr calibrationWS = getProperty("CalibrationWorkspace");
DataObjects::TableWorkspace_sptr presortedGroupedCalibrationWS = getProperty("GroupedCalibration");
const API::ITableWorkspace_sptr groupedCalibrationWS = sortTableWorkspace(presortedGroupedCalibrationWS);
DataObjects::TableWorkspace_sptr presortedPixelCalibrationWS = getProperty("PixelCalibration");
const API::ITableWorkspace_sptr pixelCalibrationWS = sortTableWorkspace(presortedPixelCalibrationWS);
const DataObjects::MaskWorkspace_sptr maskWorkspace = getProperty("MaskWorkspace");
DataObjects::TableWorkspace_sptr outputWorkspace = std::make_shared<DataObjects::TableWorkspace>();
outputWorkspace->addColumn("int", "detid");
outputWorkspace->addColumn("double", "difc");
outputWorkspace->addColumn("double", "difa");
outputWorkspace->addColumn("double", "tzero");
Mantid::API::TableRow groupedCalibrationRow = groupedCalibrationWS->getFirstRow();
do {
int detid = groupedCalibrationRow.Int(0);
bool prevDifValsExist = false;
if (!(maskWorkspace && maskWorkspace->isMasked(detid))) {
std::shared_ptr<Mantid::API::TableRow> pixelCalibrationRow = binarySearchForRow(pixelCalibrationWS, detid);
if (pixelCalibrationRow) {
double difcPD = groupedCalibrationRow.Double(1);
double difcArb = calibrationWS->spectrumInfo().diffractometerConstants(
calibrationWS->getIndicesFromDetectorIDs({detid})[0])[Kernel::UnitParams::difc];
double difcPrev = pixelCalibrationRow->Double(1);
double difaPrev = pixelCalibrationRow->Double(2);
double difcNew = (difcPD / difcArb) * difcPrev;
double difaNew = ((difcPD / difcArb) * (difcPD / difcArb)) * difaPrev;
double tzeroNew = pixelCalibrationRow->Double(3);
Mantid::API::TableRow newRow = outputWorkspace->appendRow();
newRow << detid << difcNew << difaNew << tzeroNew;
prevDifValsExist = true;
}
}
if (!prevDifValsExist) {
// copy from group
addRowFromGroupedCalibration(outputWorkspace, groupedCalibrationRow);
}
} while (groupedCalibrationRow.next());
setProperty("OutputWorkspace", outputWorkspace);
}
} // namespace Algorithms
} // namespace Mantid
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright &copy; 2021 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once
#include <cxxtest/TestSuite.h>
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/TableRow.h"
#include "MantidAlgorithms/CombineDiffCal.h"
#include "MantidAlgorithms/CreateSampleWorkspace.h"
#include "MantidDataObjects/MaskWorkspace.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAlgorithms/CreateSampleWorkspace.h"
#include "MantidDataHandling/ApplyDiffCal.h"
#include "MantidDataHandling/GroupDetectors2.h"
using namespace Mantid;
using namespace Mantid::DataObjects;
using namespace Mantid::API;
using namespace Mantid::DataHandling;
using Mantid::Algorithms::CombineDiffCal;
using Mantid::Algorithms::CreateSampleWorkspace;
using Mantid::API::TableRow;
using Mantid::DataObjects::TableWorkspace;
using Mantid::DataObjects::TableWorkspace_sptr;
class CombineDiffCalTest : public CxxTest::TestSuite {
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static CombineDiffCalTest *createSuite() { return new CombineDiffCalTest(); }
static void destroySuite(CombineDiffCalTest *suite) { delete suite; }
CombineDiffCalTest() { FrameworkManager::Instance(); }
DataObjects::TableWorkspace_sptr createPixelCalibrationTableUnsorted() {
// create table with correct column names
DataObjects::TableWorkspace_sptr table = std::make_shared<DataObjects::TableWorkspace>();
table->addColumn("int", "detid");
table->addColumn("double", "difc");
table->addColumn("double", "difa");
table->addColumn("double", "tzero");
// fill the values
// new_row << entry.detector_id << entry.difc << entry.difa << entry.tzero;
TableRow newRow = table->appendRow();
newRow << 103 << 1101.0 << 4.0 << 0.0;
newRow = table->appendRow();
newRow << 100 << 1000.0 << 1.0 << 0.0;
newRow = table->appendRow();
newRow << 101 << 1001.0 << 2.0 << 0.0;
newRow = table->appendRow();
newRow << 102 << 1099.0 << 3.0 << 0.0;
return table;
}
DataObjects::TableWorkspace_sptr createPixelCalibrationTable() {
// create table with correct column names
DataObjects::TableWorkspace_sptr table = std::make_shared<DataObjects::TableWorkspace>();
table->addColumn("int", "detid");
table->addColumn("double", "difc");
table->addColumn("double", "difa");
table->addColumn("double", "tzero");
// fill the values
// new_row << entry.detector_id << entry.difc << entry.difa << entry.tzero;
TableRow newRow = table->appendRow();
newRow << 100 << 1000.0 << 1.0 << 0.0;
newRow = table->appendRow();
newRow << 101 << 1001.0 << 2.0 << 0.0;
newRow = table->appendRow();
newRow << 102 << 1099.0 << 3.0 << 0.0;
newRow = table->appendRow();
newRow << 103 << 1101.0 << 4.0 << 0.0;
return table;
}
DataObjects::TableWorkspace_sptr createGroupedCalibrationTable() {
// create table with correct column names
DataObjects::TableWorkspace_sptr table = std::make_shared<DataObjects::TableWorkspace>();
table->addColumn("int", "detid");
table->addColumn("double", "difc");
table->addColumn("double", "difa");
table->addColumn("double", "tzero");
// fill the values
// new_row << entry.detector_id << entry.difc << entry.difa << entry.tzero;
TableRow newRow = table->appendRow();
newRow << 100 << 1000.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 101 << 1001.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 102 << 1110.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 103 << 1110.0 << 0.0 << 0.0;
return table;
}
DataObjects::TableWorkspace_sptr createCalibrationTableArgs() {
// create table with correct column names
DataObjects::TableWorkspace_sptr table = std::make_shared<DataObjects::TableWorkspace>();
table->addColumn("int", "detid");
table->addColumn("double", "difc");
table->addColumn("double", "difa");
table->addColumn("double", "tzero");
// fill the values
// new_row << entry.detector_id << entry.difc << entry.difa << entry.tzero;
TableRow newRow = table->appendRow();
newRow << 100 << 1000.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 101 << 1000.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 102 << 1100.0 << 0.0 << 0.0;
newRow = table->appendRow();
newRow << 103 << 1100.0 << 0.0 << 0.0;
return table;
}
MatrixWorkspace_sptr getInstrumentWorkspace() {
CreateSampleWorkspace createSampleWorkspaceAlgo;
createSampleWorkspaceAlgo.setChild(true);
createSampleWorkspaceAlgo.initialize();
createSampleWorkspaceAlgo.setPropertyValue("OutputWorkspace", "outWSName");
createSampleWorkspaceAlgo.execute();
MatrixWorkspace_sptr instrumentWS = createSampleWorkspaceAlgo.getProperty("OutputWorkspace");
GroupDetectors2 groupDetectorsAlgo;
groupDetectorsAlgo.setChild(true);
groupDetectorsAlgo.initialize();
groupDetectorsAlgo.setProperty("InputWorkspace", instrumentWS);
groupDetectorsAlgo.setProperty("GroupingPattern", "0+1,2+3");
groupDetectorsAlgo.setPropertyValue("OutputWorkspace", "outWSName");
groupDetectorsAlgo.execute();
instrumentWS = groupDetectorsAlgo.getProperty("OutputWorkspace");
return instrumentWS;
}
MatrixWorkspace_sptr createCalibrationWorkspace() {
MatrixWorkspace_sptr instrumentWS = getInstrumentWorkspace();
const auto calibrationArgsTable = createCalibrationTableArgs();
std::string testWorkspaceName = "TestWorkspace";
AnalysisDataService::Instance().add(testWorkspaceName, instrumentWS);
const auto outWS = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>(testWorkspaceName);
ApplyDiffCal applyDiffCalAlgo;
applyDiffCalAlgo.setChild(true);
applyDiffCalAlgo.initialize();
applyDiffCalAlgo.setProperty("InstrumentWorkspace", testWorkspaceName);
applyDiffCalAlgo.setProperty("CalibrationWorkspace", calibrationArgsTable);
applyDiffCalAlgo.execute();
AnalysisDataService::Instance().remove(testWorkspaceName);
return outWS;
}
DataObjects::MaskWorkspace_sptr getMaskWorkspace() {
MatrixWorkspace_sptr instrumentWS = getInstrumentWorkspace();
// In case of MaskWorkspace
DataObjects::MaskWorkspace_sptr maskWS = std::make_shared<DataObjects::MaskWorkspace>(instrumentWS);
maskWS->setMasked(100, true);
maskWS->setMasked(101, true);
return maskWS;
}
Mantid::API::IAlgorithm_sptr setupAlg(DataObjects::TableWorkspace_sptr difCalPixelCalibration,
DataObjects::TableWorkspace_sptr difCalGroupedCalibration,
MatrixWorkspace_sptr diffCalCalibrationWs) {
// set up algorithm
auto alg = std::make_shared<CombineDiffCal>();
alg->setChild(true); // Don't put output in ADS by default
TS_ASSERT_THROWS_NOTHING(alg->initialize());
TS_ASSERT(alg->isInitialized());
TS_ASSERT_THROWS_NOTHING(alg->setProperty("PixelCalibration", difCalPixelCalibration));
TS_ASSERT_THROWS_NOTHING(alg->setProperty("GroupedCalibration", difCalGroupedCalibration));
TS_ASSERT_THROWS_NOTHING(alg->setProperty("CalibrationWorkspace", diffCalCalibrationWs));
TS_ASSERT_THROWS_NOTHING(alg->setPropertyValue("OutputWorkspace", "_unused_for_child"));
return alg;
}
void confirmResults(DataObjects::TableWorkspace_sptr output) {
// double difc = (difcPD /difcArb) * difcPrev;
// double difa = ((difcPD / difcArb) * (difcPD / difcArb)) * difaPrev;
auto difc = output->getColumn("difc");
TS_ASSERT(difc);
TS_ASSERT_EQUALS(difc->toDouble(0), (1000. / 1000.) * 1000.);
TS_ASSERT_EQUALS(difc->toDouble(1), (1001. / 1000.) * 1001.);
TS_ASSERT_EQUALS(difc->toDouble(2), (1110. / 1100.) * 1099.);
TS_ASSERT_EQUALS(difc->toDouble(3), (1110. / 1100.) * 1101.);
auto difa = output->getColumn("difa");
TS_ASSERT_EQUALS(difa->toDouble(0), ((1000. / 1000.) * (1000. / 1000.)) * 1.);
TS_ASSERT_EQUALS(difa->toDouble(1), ((1001. / 1000.) * (1001. / 1000.)) * 2.);
TS_ASSERT_EQUALS(difa->toDouble(2), ((1110. / 1100.) * (1110. / 1100.)) * 3.);
TS_ASSERT_EQUALS(difa->toDouble(3), ((1110. / 1100.) * (1110. / 1100.)) * 4.);
}
void confirmMaskedResults(DataObjects::TableWorkspace_sptr output) {
// double difc = (difcPD /difcArb) * difcPrev;
// double difa = ((difcPD / difcArb) * (difcPD / difcArb)) * difaPrev;
auto difc = output->getColumn("difc");
TS_ASSERT(difc);
// 1st and 2nd are both masked, since they are grouped together, will take groupcalibration val instead
TS_ASSERT_EQUALS(difc->toDouble(0), 1000.);
TS_ASSERT_EQUALS(difc->toDouble(1), 1001);
TS_ASSERT_EQUALS(difc->toDouble(2), (1110. / 1100.) * 1099.);
TS_ASSERT_EQUALS(difc->toDouble(3), (1110. / 1100.) * 1101.);
auto difa = output->getColumn("difa");
// 1st and 2nd are both masked, since they are grouped together, will take groupcalibration val instead
TS_ASSERT_EQUALS(difa->toDouble(0), 0);
TS_ASSERT_EQUALS(difa->toDouble(1), 0);
TS_ASSERT_EQUALS(difa->toDouble(2), ((1110. / 1100.) * (1110. / 1100.)) * 3.);
TS_ASSERT_EQUALS(difa->toDouble(3), ((1110. / 1100.) * (1110. / 1100.)) * 4.);
}
void test_init() {
CombineDiffCal alg;
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
}
void test_exec() {
// cases to cover (can be in the same dataset)
// single pixel with pixel==group==arb
// single pixel with pixel==arb!=group
// single pixel with pixel==arb!=group
// grouped with arb==group
// grouped with arb!=group
// test input
// fake data to simulate the output of cross correlate PixelCalibration
const auto difCalPixelCalibration = createPixelCalibrationTable();
// fake data to simulate the output of PDCalibration GroupedCalibration
const auto difCalGroupedCalibration = createGroupedCalibrationTable();
// fake data to simulate CalibrationWorkspace
const auto diffCalCalibrationWs = createCalibrationWorkspace();
// set up algorithm
auto alg = setupAlg(difCalPixelCalibration, difCalGroupedCalibration, diffCalCalibrationWs);
// run the algorithm
TS_ASSERT_THROWS_NOTHING(alg->execute(););
TS_ASSERT(alg->isExecuted());
DataObjects::TableWorkspace_sptr output = alg->getProperty("OutputWorkspace");
TS_ASSERT(output);
confirmResults(output);
}
void testUnsorted() {
// test input
// fake data to simulate the output of cross correlate PixelCalibration
const auto difCalPixelCalibration = createPixelCalibrationTableUnsorted();
// fake data to simulate the output of PDCalibration GroupedCalibration
const auto difCalGroupedCalibration = createGroupedCalibrationTable();
// fake data to simulate CalibrationWorkspace
const auto diffCalCalibrationWs = createCalibrationWorkspace();
// set up algorithm
auto alg = setupAlg(difCalPixelCalibration, difCalGroupedCalibration, diffCalCalibrationWs);
// run the algorithm
TS_ASSERT_THROWS_NOTHING(alg->execute(););
TS_ASSERT(alg->isExecuted());
DataObjects::TableWorkspace_sptr output = alg->getProperty("OutputWorkspace");
TS_ASSERT(output);
confirmResults(output);
}
void testMasked() {
// test input
// fake data to simulate the output of cross correlate PixelCalibration
const auto difCalPixelCalibration = createPixelCalibrationTable();
// fake data to simulate the output of PDCalibration GroupedCalibration
const auto difCalGroupedCalibration = createGroupedCalibrationTable();
// fake data to simulate CalibrationWorkspace
const auto diffCalCalibrationWs = createCalibrationWorkspace();
const auto maskWorkspace = getMaskWorkspace();
TS_ASSERT(maskWorkspace->isMasked(100));
// set up algorithm
auto alg = setupAlg(difCalPixelCalibration, difCalGroupedCalibration, diffCalCalibrationWs);
TS_ASSERT_THROWS_NOTHING(alg->setProperty("MaskWorkspace", maskWorkspace));
// run the algorithm
TS_ASSERT_THROWS_NOTHING(alg->execute(););
TS_ASSERT(alg->isExecuted());
DataObjects::TableWorkspace_sptr output = alg->getProperty("OutputWorkspace");
TS_ASSERT(output);
confirmMaskedResults(output);