Skip to content

Commit

Permalink
Refs #8506. Changed property type, simple test for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Nov 26, 2013
1 parent 694f62c commit 55466cf
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
5 changes: 2 additions & 3 deletions Code/Mantid/Framework/DataHandling/src/LoadMuonNexus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ namespace Mantid
declareProperty("TimeZero", 0.0, "Time zero in units of micro-seconds (default to 0.0)", Direction::Output);
declareProperty("FirstGoodData", 0.0, "First good data in units of micro-seconds (default to 0.0)", Direction::Output);

std::vector<double> defaultDeadTimes;
declareProperty("DeadTimes", defaultDeadTimes,
"The name of the vector in which to store the list of deadtimes for each spectrum", Direction::Output);
declareProperty(new WorkspaceProperty<Workspace>("DeadTimesTable", "", Direction::Output, PropertyMode::Optional),
"Table or a group of tables containing detector dead times");
}

/// Validates the optional 'spectra to read' properties, if they have been set
Expand Down
32 changes: 29 additions & 3 deletions Code/Mantid/Framework/DataHandling/test/LoadMuonNexus1Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// These includes seem to make the difference between initialization of the
// workspace names (workspace2D/1D etc), instrument classes and not for this test case.
#include "MantidDataObjects/WorkspaceSingleValue.h"
#include "MantidDataObjects/TableWorkspace.h"
#include "MantidDataHandling/LoadInstrument.h"
//

Expand Down Expand Up @@ -186,9 +187,6 @@ class LoadMuonNexus1Test : public CxxTest::TestSuite
TS_ASSERT_DELTA( timeZero, 0.55,0.001);
double firstgood = nxL.getProperty("FirstGoodData");
TS_ASSERT_DELTA( firstgood, 0.656,0.001);
std::vector<double> deadTimes = nxL.getProperty("DeadTimes");
TS_ASSERT_DELTA( deadTimes[0], 0.006,0.001);
TS_ASSERT_DELTA( deadTimes[deadTimes.size()-1], 0.011,0.001);
}

void testExec2()
Expand Down Expand Up @@ -384,6 +382,34 @@ class LoadMuonNexus1Test : public CxxTest::TestSuite
// Check that the error on that value is correct
TS_ASSERT_DELTA( output2D->dataX(8)[479], 7.410, 0.0001);
}

void test_loadingDeadTimes_singlePeriod()
{
const std::string outWSName = "LoadMuonNexus1Test_OutputWS";
const std::string deadTimesWSName = "LoadMuonNexus1Test_DeadTimes";

LoadMuonNexus1 alg;

TS_ASSERT_THROWS_NOTHING( alg.initialize() );
TS_ASSERT( alg.isInitialized() );

TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("Filename", "emu00006473.nxs") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", outWSName) );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("DeadTimesTable", deadTimesWSName) );

TS_ASSERT_THROWS_NOTHING( alg.execute() );
TS_ASSERT( alg.isExecuted() );

TableWorkspace_sptr deadTimesTable;

TS_ASSERT_THROWS_NOTHING( deadTimesTable =
AnalysisDataService::Instance().retrieveWS<TableWorkspace>( deadTimesWSName ) );

TS_ASSERT( deadTimesTable );

AnalysisDataService::Instance().remove(outWSName);
AnalysisDataService::Instance().remove(deadTimesWSName);
}

private:
LoadMuonNexus1 nxLoad,nxload2,nxload3;
Expand Down

0 comments on commit 55466cf

Please sign in to comment.