16#include <boost/utility.hpp>
29 : m_historyItems(view->getAlgorithmsList()), m_output(), m_versionSpecificity(
std::move(versionSpecificity)),
41 const std::string &ws_comment) {
43 std::string workspace_details;
44 workspace_details =
"Workspace History: " + ws_name +
"\n";
45 workspace_details +=
"------------------------\n";
46 workspace_details += ws_title +
"\n";
47 workspace_details += ws_comment;
66 auto algHistory = iter->getAlgorithmHistory();
67 if (iter->isUnrolled()) {
69 m_nb_writer->markdownCell(std::string(
"Child algorithms of ") + algHistory->name());
73 m_nb_writer->markdownCell(std::string(
"End of child algorithms of ") + algHistory->name());
90 size_t numChildren = iter->numberOfChildren();
92 for (
size_t i = 0; i < numChildren && iter !=
m_historyItems.end(); ++i, ++iter) {
105 std::ostringstream properties;
106 const std::string name = algHistory->name();
109 auto props = algHistory->getProperties();
110 for (
auto &propIter : props) {
112 if (prop.length() > 0) {
113 properties << prop <<
", ";
119 properties <<
"Version=" << algHistory->version() <<
", ";
122 const auto &algName = algHistory->name();
124 int latestVersion = 0;
126 if (algFactory.exists(algName)) {
131 if (latestVersion > algHistory->version()) {
132 properties <<
"Version=" << algHistory->version() <<
", ";
137 std::string propStr = properties.str();
138 if (propStr.length() > 0) {
140 propStr.erase(propStr.size() - 1);
141 propStr.erase(propStr.size() - 1);
144 return name +
"(" + propStr +
")";
157 std::vector<std::string> nonWorkspaceTypes{
"number",
"boolean",
"string"};
161 if (!propHistory->isDefault()) {
163 if (find(nonWorkspaceTypes.begin(), nonWorkspaceTypes.end(), propHistory->type()) != nonWorkspaceTypes.end() &&
165 g_log.
debug() <<
"Ignoring property " << propHistory->name() <<
" of type " << propHistory->type() <<
'\n';
167 }
else if (propHistory->type() ==
"number") {
168 prop = propHistory->name() +
"=" + propHistory->value();
170 }
else if (propHistory->type() ==
"boolean") {
171 std::string
value = (propHistory->value() ==
"1" ?
"True" :
"False");
172 prop = propHistory->name() +
"=" +
value;
175 std::string opener =
"='";
176 if (propHistory->value().find(
'\\') != std::string::npos) {
180 prop = propHistory->name() + opener + propHistory->value() +
"'";
double value
The value of the point.
void buildChildren(std::vector< HistoryItem >::const_iterator &iter)
Iterate over each of the items children and output them to the script.
std::string m_versionSpecificity
const std::vector< HistoryItem > m_historyItems
const std::string buildAlgorithmString(const AlgorithmHistory_const_sptr &algHistory)
Build the script output for a single algorithm.
const std::string build(const std::string &ws_name, const std::string &ws_title, const std::string &ws_comment)
build an ipython notebook from the history view
std::unique_ptr< NotebookWriter > m_nb_writer
NotebookBuilder(const std::shared_ptr< HistoryView > &view, std::string versionSpecificity="old")
const std::string buildPropertyString(const Mantid::Kernel::PropertyHistory_const_sptr &propHistory)
Build the script output for a single property.
void writeHistoryToStream(std::vector< HistoryItem >::const_iterator &iter)
Write out an algorithm to the notebook.
The Logger class is in charge of the publishing messages from the framework through various channels.
void debug(const std::string &msg)
Logs at debug level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::shared_ptr< const AlgorithmHistory > AlgorithmHistory_const_sptr
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< const PropertyHistory > PropertyHistory_const_sptr
std::shared_ptr< PropertyHistory > PropertyHistory_sptr
Describes the direction (within an algorithm) of a Property.
@ Output
An output workspace.