Commit 14f4caad authored by Anthony Lim's avatar Anthony Lim
Browse files

PSI BG test fixes

parent dfda4317
......@@ -101,11 +101,11 @@ std::map<std::string, std::string> PSIBackgroundSubtraction::validateInputs() {
errors["InputWorkspace"] +=
"\n Input Workspace should have last good data > first good data. ";
}
if (firstGood <= 0) {
if (firstGood < 0) {
errors["InputWorkspace"] +=
"\n Input Workspace should have first good data > 0. ";
}
if (lastGood > int(inputWS->readX(index).size())) {
if (lastGood >= int(inputWS->readX(index).size())) {
errors["InputWorkspace"] +=
"\n Input Workspace should have last good data < number of bins. ";
}
......
......@@ -31,7 +31,7 @@ MatrixWorkspace_sptr createCountsTestWorkspace(const size_t numberOfHistograms,
ws->mutableRun().addProperty("First good spectra " +
std::to_string(index),
int(numberOfBins / 2.));
int(double(numberOfBins) / 2.));
ws->mutableRun().addProperty("Last good spectra " + std::to_string(index),
numberOfBins);
}
......@@ -72,7 +72,8 @@ private:
calculateBackgroundFromFit(IAlgorithm_sptr &,
const std::pair<double, double> &range,
const int &index) override {
(void)range, index;
(void) range;
(void) index;
return std::make_tuple(m_background, m_fitQuality);
}
double m_background{0.00};
......
......@@ -49,8 +49,8 @@ Usage
input_workspace = CreateWorkspace(time, counts)
input_workspace.setYUnit("Counts")
run = input_workspace.getRun()
run.addProperty("First good spectra 0","0","None",True)
run.addProperty("Last good spectra 0","10","None",True)
run.addProperty("First good spectra 0",10,"None",True)
run.addProperty("Last good spectra 0",99,"None",True)
workspace_copy = input_workspace.clone()
# Run PSIBackgroundSubtraction Algorithm
......@@ -58,8 +58,9 @@ Usage
# Find the difference between the workspaces
workspace_diff = Minus(workspace_copy, input_workspace)
diffs = np.round(workspace_diff.readY(0),4)
# The counts in workspace diff should be a flat line corresponding to the background
print("Differences in counts are: {}".format(workspace_diff.dataY(0)))
print("Differences in counts are: {}".format(diffs))
Output:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment