Skip to content
Snippets Groups Projects
Commit a64c0999 authored by Steve Williams's avatar Steve Williams
Browse files

Load() now has an extra optional property, the entry number to load in a...

Load() now has an extra optional property, the entry number to load in a multi-period file. Currently only ISIS Nexus files support this re #2209
parent fb91dabd
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,8 @@ namespace Mantid
declareProperty("SpectrumMin", 1, mustBePositive);
declareProperty("SpectrumMax", EMPTY_INT(), mustBePositive->clone());
declareProperty(new ArrayProperty<int>("SpectrumList"));
declareProperty("EntryNumber", 0,
"Load a particular entry, if supported by the file format (default: Load all entries)");
}
/** checks this property exists in the list of algorithm properties.
*/
......
......@@ -3,11 +3,13 @@
#include <cxxtest/TestSuite.h>
#include "MantidDataHandling/Load.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidAPI/MatrixWorkspace.h"
#include "MantidAPI/WorkspaceGroup.h"
#include "MantidAPI/AnalysisDataService.h"
using namespace Mantid::API;
using namespace Mantid::DataObjects;
using namespace Mantid::DataHandling;
class LoadTest : public CxxTest::TestSuite
......@@ -56,7 +58,7 @@ public:
AnalysisDataService::Instance().remove("LoadTest_Output_5");
AnalysisDataService::Instance().remove("LoadTest_Output_6");
}
//disabled because hdf4 can't be opened on windows 64-bit, I think
void t1estNexus()
{
Load loader;
......@@ -96,6 +98,18 @@ public:
AnalysisDataService::Instance().remove("LoadTest_Output");
}
void testEntryNumber()
{
Load loader;
loader.initialize();
loader.setPropertyValue("Filename","TEST00000008.nxs");
loader.setPropertyValue("OutputWorkspace","LoadTest_entry2");
loader.setPropertyValue("EntryNumber","2");
TS_ASSERT_THROWS_NOTHING(loader.execute());
Workspace2D_sptr wsg = boost::dynamic_pointer_cast<Workspace2D>(AnalysisDataService::Instance().retrieve("LoadTest_entry2"));
TS_ASSERT(wsg);
AnalysisDataService::Instance().remove("LoadTest_entry2");
}
void testUnknownExt()
{
Load loader;
......
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