Skip to content

Commit

Permalink
Re #11868 Validate inputs and change asymmetry and phase init values
Browse files Browse the repository at this point in the history
  • Loading branch information
raquelalvarezbanos committed Sep 29, 2015
1 parent c98e9bb commit 90b3972
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DLLExport CalMuonDetectorPhases : public API::Algorithm {
// Overridden Algorithm methods
void init();
void exec();
std::map<std::string, std::string> validateInputs();
API::MatrixWorkspace_sptr
prepareWorkspace(const API::MatrixWorkspace_sptr &ws, double startTime,
double endTime);
Expand Down
21 changes: 19 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/CalMuonDetectorPhases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,23 @@ void CalMuonDetectorPhases::init() {

}

//----------------------------------------------------------------------------------------------
/** Validates the inputs.
*/
std::map<std::string, std::string> CalMuonDetectorPhases::validateInputs() {

std::map<std::string, std::string> result;

API::MatrixWorkspace_const_sptr inputWS = getProperty("InputWorkspace");

// Check units, should be microseconds
Unit_const_sptr unit = inputWS->getAxis(0)->unit();
if ((unit->caption() != "Time") || (unit->label().ascii() != "microsecond")) {
result["InputWorkspace"] = "InputWorkspace units must be microseconds";
}

return result;
}
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
*/
Expand Down Expand Up @@ -162,9 +179,9 @@ std::string CalMuonDetectorPhases::createFittingFunction(int nspec, double freq)
for (int s = 0; s < nspec; s++) {
ss << "name=UserFunction,";
ss << "Formula=A*sin(w*x+p),";
ss << "A=1.0,";
ss << "A=0.5,";
ss << "w=" << freq << ",";
ss << "p=1.0;";
ss << "p=0.;";
}
ss << "ties=(";
for (int s = 1; s < nspec - 1; s++) {
Expand Down

0 comments on commit 90b3972

Please sign in to comment.