Skip to content

Commit

Permalink
Re #11105. Added one more unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Mar 11, 2015
1 parent 5bc2a27 commit e330b17
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Expand Up @@ -122,14 +122,21 @@ void EstimatePeakErrors::init() {
void EstimatePeakErrors::exec() {

IFunction_sptr function = getProperty("Function");
auto matrix = function->getCovarianceMatrix();

ITableWorkspace_sptr results =
WorkspaceFactory::Instance().createTable("TableWorkspace");
results->addColumn("str", "Parameter");
results->addColumn("double", "Value");
results->addColumn("double", "Error");

auto matrix = function->getCovarianceMatrix();
if ( !matrix )
{
g_log.warning() << "Function dosn't have covariance matrix." << std::endl;
setProperty("OutputWorkspace", results);
return;
}

IPeakFunction *peak = dynamic_cast<IPeakFunction *>(function.get());

if (peak) {
Expand Down
17 changes: 17 additions & 0 deletions Code/Mantid/Framework/CurveFitting/test/EstimatePeakErrorsTest.h
Expand Up @@ -101,6 +101,23 @@ class EstimatePeakErrorsTest : public CxxTest::TestSuite
AnalysisDataService::Instance().clear();
}

void test_on_Gaussian_unfitted()
{
auto fun = FunctionFactory::Instance().createInitialized("name=Gaussian,PeakCentre=0,Height=1,Sigma=2");

EstimatePeakErrors alg;
alg.initialize();
alg.setProperty("Function",fun);
alg.setPropertyValue("OutputWorkspace","Errors");
alg.execute();

auto res = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>("Errors");
TS_ASSERT_EQUALS( res->rowCount(), 0 );

AnalysisDataService::Instance().clear();
}


void test_on_Lorentzians()
{
std::string funStr = "name=Lorentzian,Amplitude=10,PeakCentre=-4,FWHM=2;"
Expand Down

0 comments on commit e330b17

Please sign in to comment.