diff --git a/Framework/MDAlgorithms/src/AccumulateMD.cpp b/Framework/MDAlgorithms/src/AccumulateMD.cpp index a2bed96b5c9cf45e438f5cde0fb7e47f6ca2cd3b..e7c992a075a7c5bde62cbe6072c0621da7f8c52d 100644 --- a/Framework/MDAlgorithms/src/AccumulateMD.cpp +++ b/Framework/MDAlgorithms/src/AccumulateMD.cpp @@ -284,7 +284,7 @@ void AccumulateMD::init() { "gs rotation in degrees. Optional or one entry per run."); declareProperty( - new PropertyWithValue<bool>("InPlace", false, Direction::Input), + new PropertyWithValue<bool>("InPlace", true, Direction::Input), "Execute conversions to MD and Merge in one-step. Less " "memory overhead."); @@ -336,7 +336,7 @@ void AccumulateMD::exec() { IMDEventWorkspace_sptr out_ws = createMDWorkspace(input_data, psi, gl, gs, efix); this->setProperty("OutputWorkspace", out_ws); - g_log.notice() << this->name() << " succesfully created a clean workspace" + g_log.notice() << this->name() << " successfully created a clean workspace" << std::endl; this->progress(1.0); return; // POSSIBLE EXIT POINT diff --git a/Framework/MDAlgorithms/src/ConvertToMD.cpp b/Framework/MDAlgorithms/src/ConvertToMD.cpp index 8d4d866eea91bca4686f4981b2936c7e2265ab81..4c51970dc9ca3a3732b64a14bd38fa433e02a98a 100644 --- a/Framework/MDAlgorithms/src/ConvertToMD.cpp +++ b/Framework/MDAlgorithms/src/ConvertToMD.cpp @@ -67,11 +67,11 @@ void ConvertToMD::init() { this->initBoxControllerProps("5" /*SplitInto*/, 1000 /*SplitThreshold*/, 20 /*MaxRecursionDepth*/); // additional box controller settings property. - auto mustBeMoreThen1 = boost::make_shared<BoundedValidator<int>>(); - mustBeMoreThen1->setLower(1); + auto mustBeMoreThan1 = boost::make_shared<BoundedValidator<int>>(); + mustBeMoreThan1->setLower(1); declareProperty( - new PropertyWithValue<int>("MinRecursionDepth", 1, mustBeMoreThen1), + new PropertyWithValue<int>("MinRecursionDepth", 1, mustBeMoreThan1), "Optional. If specified, then all the boxes will be split to this " "minimum recursion depth. 0 = no splitting, " "1 = one level of splitting, etc. \n Be careful using this since it can " diff --git a/Framework/MDAlgorithms/src/CreateMD.cpp b/Framework/MDAlgorithms/src/CreateMD.cpp index d7b3403eed19c36bbd88cadadb89f622e28f97d8..ccaad3eae996833ae63c027bc549c1db8f19ddaa 100644 --- a/Framework/MDAlgorithms/src/CreateMD.cpp +++ b/Framework/MDAlgorithms/src/CreateMD.cpp @@ -14,6 +14,11 @@ namespace MDAlgorithms { using Mantid::Kernel::Direction; using Mantid::API::WorkspaceProperty; +// Box manager parameters for child algorithms +static const std::string SPLITINTO("2"); +static const std::string SPLITTHRESHOLD("500"); +static const std::string MAXRECURSIONDEPTH("20"); + /* * Pad the vector of parameter values to the same size as data sources * @@ -159,7 +164,7 @@ void CreateMD::init() { "gs rotation in degrees. Optional or one entry per run."); declareProperty( - new PropertyWithValue<bool>("InPlace", false, Direction::Input), + new PropertyWithValue<bool>("InPlace", true, Direction::Input), "Execute conversions to MD and Merge in one-step. Less " "memory overhead."); } @@ -198,6 +203,7 @@ void CreateMD::exec() { MatrixWorkspace_sptr workspace; std::stringstream ws_name; IMDEventWorkspace_sptr run_md; + Progress progress(this, 0.0, 1.0, entries + 1); for (unsigned long entry_number = 0; entry_number < entries; ++entry_number, ++counter) { ws_name.str(std::string()); @@ -228,21 +234,29 @@ void CreateMD::exec() { run_md = single_run(workspace, emode, efix[entry_number], psi[entry_number], gl[entry_number], gs[entry_number], do_in_place, alatt, angdeg, u, v, run_md); + to_merge_names.push_back(to_merge_name); // We are stuck using ADS as we can't pass workspace pointers to MergeMD // There is currently no way to pass a list of workspace pointers - AnalysisDataService::Instance().addOrReplace(to_merge_name, run_md); + if (!do_in_place) { + AnalysisDataService::Instance().addOrReplace(to_merge_name, run_md); + } + + progress.report(); } Workspace_sptr output_workspace; if (to_merge_names.size() > 1 && !in_place) { + progress.doReport("Merging loaded data into single workspace"); output_workspace = merge_runs(to_merge_names); } else { output_workspace = AnalysisDataService::Instance().retrieve(to_merge_names[0]); } + progress.report(); + // Clean up temporary workspaces for (auto &to_merge_name : to_merge_names) { AnalysisDataService::Instance().remove(to_merge_name); @@ -370,6 +384,13 @@ CreateMD::convertToMD(Mantid::API::Workspace_sptr workspace, convert_alg->setProperty("dEAnalysisMode", analysis_mode); convert_alg->setPropertyValue("MinValues", min_values); convert_alg->setPropertyValue("MaxValues", max_values); + // Use same box split settings in ConvertToMD and MergeMD + // Otherwise InPlace=True or False will give different results + convert_alg->setProperty("SplitInto", SPLITINTO); + convert_alg->setProperty("SplitThreshold", SPLITTHRESHOLD); + convert_alg->setProperty("MaxRecursionDepth", MAXRECURSIONDEPTH); + // OverwriteExisting=false means events are added to the existing workspace, + // effectively doing the merge in place (without using MergeMD) convert_alg->setProperty("OverwriteExisting", !in_place); if (in_place) { convert_alg->setProperty("OutputWorkspace", out_mdws); @@ -393,6 +414,11 @@ CreateMD::merge_runs(const std::vector<std::string> &to_merge) { merge_alg->setProperty("InputWorkspaces", to_merge); merge_alg->setPropertyValue("OutputWorkspace", "dummy"); + // Use same box split settings in ConvertToMD and MergeMD + // Otherwise InPlace=True or False will give different results + merge_alg->setProperty("SplitInto", SPLITINTO); + merge_alg->setProperty("SplitThreshold", SPLITTHRESHOLD); + merge_alg->setProperty("MaxRecursionDepth", MAXRECURSIONDEPTH); merge_alg->executeAsChildAlg(); return merge_alg->getProperty("OutputWorkspace"); diff --git a/Framework/MDAlgorithms/src/MergeMD.cpp b/Framework/MDAlgorithms/src/MergeMD.cpp index 68762fbd97759d02f2716c21434637300d9882ba..cd96c400d90b646e71d6ce1529531600acdadf0c 100644 --- a/Framework/MDAlgorithms/src/MergeMD.cpp +++ b/Framework/MDAlgorithms/src/MergeMD.cpp @@ -1,8 +1,5 @@ #include "MantidMDAlgorithms/MergeMD.h" -#include "MantidKernel/Strings.h" -#include "MantidGeometry/MDGeometry/IMDDimension.h" #include "MantidDataObjects/MDEventFactory.h" -#include "MantidGeometry/MDGeometry/MDHistoDimension.h" #include "MantidKernel/ArrayProperty.h" #include "MantidDataObjects/MDBoxIterator.h" #include "MantidKernel/CPUTimer.h"