34static constexpr const char *INVESTIGATION_ID =
"experiment_identifier";
35static constexpr const char *RUN_NAME =
"name";
36static constexpr const char *RUN_NUMBER =
"run_number";
37static constexpr const char *RUN_TITLE =
"title";
46std::vector<IJournal::RunData> getRuns(IJournal *journal, std::string
const &investigationId) {
47 static auto valuesToLookup = std::vector<std::string>{RUN_NUMBER, RUN_TITLE};
49 auto runs = journal->getRuns(valuesToLookup, filters);
63 workspace->addColumn(
"str",
"Run Number");
66 for (
auto &run : runs) {
68 const auto runNameIt = run.find(RUN_NAME);
69 const auto runNumberIt = run.find(RUN_NUMBER);
70 const auto runTitleIt = run.find(RUN_TITLE);
71 if (runNameIt != run.cend() && runNumberIt != run.cend() && runTitleIt != run.cend())
72 row << runNameIt->second << runNumberIt->second << runTitleIt->second;
80std::vector<std::string> getInstruments() {
81 auto instruments = std::vector<std::string>();
83 std::transform(instrInfo.cbegin(), instrInfo.cend(), std::back_inserter(instruments),
84 [](
const auto instrument) { return instrument.name(); });
93std::string getDefaultInstrument(std::vector<std::string>
const &instruments) {
94 if (instruments.empty())
98 if (std::find(instruments.cbegin(), instruments.cend(), instrument) == instruments.cend()) {
99 instrument = instruments.front();
106 auto const instruments = getInstruments();
107 auto const instrument = getDefaultInstrument(instruments);
109 declareProperty(
"Instrument", instrument, std::make_shared<StringListValidator>(instruments),
"The instrument name");
112 "ID of the selected investigation");
115 "The name of the workspace to store the run details.");
124 auto runs = getRuns(journal.get(), investigationId);
125 auto workspace = convertRunDataToTable(runs);
136 std::string
const &cycle) {
137 return std::make_unique<ISISJournal>(instrument, cycle);
#define DECLARE_ALGORITHM(classname)
IPeaksWorkspace_sptr workspace
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
std::string getPropertyValue(const std::string &name) const override
Get the value of a property as a string.
IJournal: Interface for classes that fetch information from journal files.
std::map< std::string, std::string > RunData
TableRow represents a row in a TableWorkspace.
A property class for workspaces.
void exec() override
Virtual method - must be overridden by concrete algorithm.
virtual std::unique_ptr< API::IJournal > makeJournal(std::string const &instrument, std::string const &cycle=std::string())
Construct a journal; can be overridden by tests to return a mock.
void init() override
Virtual method - must be overridden by concrete algorithm.
ISISJournal: Helper class to aid in fetching ISIS specific run information from journal files.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
ListValidator is a validator that requires the value of a property to be one of a defined list of pos...
Validator to check that a property is not left empty.
Manage the lifetime of a class intended to be a singleton.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< ITableWorkspace > ITableWorkspace_sptr
shared pointer to Mantid::API::ITableWorkspace
@ Output
An output workspace.