Skip to content
Snippets Groups Projects
Commit 4d8a8719 authored by RichardWaiteSTFC's avatar RichardWaiteSTFC
Browse files

Add validation for input CommonUBForAll

Ensure CommonUBForAll cannot be used if there are peaks from only one run present.
parent a052e8da
No related branches found
No related tags found
No related merge requests found
......@@ -412,6 +412,23 @@ std::map<std::string, std::string> IndexPeaks::validateInputs() {
helpMsgs[Prop::PEAKSWORKSPACE] = exc.what();
}
// get all runs which have peaksin the table
bool commonUB = this->getProperty(Prop::COMMONUB);
if (commonUB) {
auto &allPeaks = ws->getPeaks();
std::unordered_map<int, int> peaksPerRun;
auto it = allPeaks.begin();
while (peaksPerRun.size() < 2 && it != allPeaks.end()) {
peaksPerRun[it->getRunNumber()] = 1;
++it;
};
if (peaksPerRun.size() < 2) {
helpMsgs[Prop::COMMONUB] =
"CommonUBForAll can only be True if there are peaks from more"
"than one run present in the peaks worksapce";
};
};
return helpMsgs;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment