Skip to content

Commit

Permalink
Merge branch 'master' into feature/10626_better_preview_plots_in_indi…
Browse files Browse the repository at this point in the history
…rect_ui

Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp
	Code/Mantid/MantidQt/CustomInterfaces/src/FuryFit.cpp

Refs #10626
  • Loading branch information
DanNixon committed Nov 28, 2014
2 parents c39aa88 + 4427370 commit fd7615b
Show file tree
Hide file tree
Showing 70 changed files with 2,150 additions and 1,118 deletions.
4 changes: 2 additions & 2 deletions Code/Mantid/Build/dev-packages/deb/mantid-developer/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ This directory contains the structure required to build the simple mantid-develo

To build the package:
* Switch to the directory containing this file
* Run "dpkg --build mantid-developer-1.2.1"
* A file called mantid-developer-1.2.1.deb will appear in the current directory.
* Run "dpkg --build mantid-developer-1.2.2"
* A file called mantid-developer-1.2.2.deb will appear in the current directory.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Package: mantid-developer
Version: 1.2.2
Section: main
Priority: optional
Architecture: all
Depends: git, cmake-qt-gui(>=2.8.12), qt4-qmake, qt4-dev-tools, libqt4-dbg, libpoco-dev(>=1.4.2), libboost-all-dev, libboost-dbg, libnexus0-dev, libgoogle-perftools-dev, libqwt5-qt4-dev, libqwtplot3d-qt4-dev, python-qt4-dev, libgsl0-dev, liboce-visualization-dev, libmuparser-dev, python-numpy, libssl-dev, libqscintilla2-dev, texlive,texlive-latex-extra, dvipng, libhdf4-dev, doxygen, python-sphinx, python-scipy, ipython-qtconsole (>=1.2.0), libhdf5-dev, libhdf4-dev, libpococrypto11-dbg, libpocodata11-dbg, libpocofoundation11-dbg, libpocomysql11-dbg, libpoconet11-dbg, libpoconetssl11-dbg, libpocoodbc11-dbg, libpocosqlite11-dbg, libpocoutil11-dbg, libpocoxml11-dbg, libpocozip11-dbg, python-qt4-dbg, qt4-default, ninja-build, libjsoncpp-dev, python-dateutil
Installed-Size: 0
Maintainer: Mantid Project <mantid-help@mantidproject.org>
Description: Installs all packages required for a Mantid developer
A metapackage which requires all the dependencies and tools that are
required for Mantid development. It works for Ubuntu version 14.04, 14.10
Some packages (poco) must be newer than thiose in the Ubuntu repository. Please
follow instructions at http://www.mantidproject.org/Mantid_Prerequisites#Repositories
5 changes: 5 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
void setLoggingOffset(const int value) { g_log.setLevelOffset(value); }
///returns the logging priority offset
int getLoggingOffset() const { return g_log.getLevelOffset(); }
/// disable Logging of start and end messages
void setAlgStartupLogging(const bool enabled);
/// get the state of Logging of start and end messages
bool getAlgStartupLogging() const;

///setting the child start progress
void setChildStartProgress(const double startProgress)const{m_startChildProgress=startProgress;}
Expand Down Expand Up @@ -380,6 +384,7 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
bool m_runningAsync; ///< Algorithm is running asynchronously
bool m_running; ///< Algorithm is running
bool m_rethrow; ///< Algorithm should rethrow exceptions while executing
bool m_isAlgStartupLoggingEnabled; /// Whether to log alg startup and closedown messages from the base class (default = true)
mutable double m_startChildProgress; ///< Keeps value for algorithm's progress at start of an Child Algorithm
mutable double m_endChildProgress; ///< Keeps value for algorithm's progress at Child Algorithm's finish
AlgorithmID m_algorithmID; ///< Algorithm ID for managed algorithms
Expand Down
5 changes: 5 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ namespace Mantid
void setLoggingOffset(const int value) { m_loggingOffset=value; }
///returns the logging priority offset
int getLoggingOffset() const { return m_loggingOffset; }
/// disable Logging of start and end messages
void setAlgStartupLogging(const bool enabled);
/// get the state of Logging of start and end messages
bool getAlgStartupLogging() const;

///setting the child start progress
void setChildStartProgress(const double startProgress)const;
Expand Down Expand Up @@ -171,6 +175,7 @@ namespace Mantid
bool m_isExecuted; ///< Executed flag
bool m_isLoggingEnabled;///< is the logging of the underlying algorithm enabled
int m_loggingOffset; ///< the logging priority offset
bool m_isAlgStartupLoggingEnabled; /// Whether to log alg startup and closedown messages from the base class (default = true)
bool m_rethrow; ///< Whether or not to rethrow exceptions.
bool m_isChild; ///< Is this a child algo

Expand Down
9 changes: 7 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/ExperimentInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,13 @@ namespace API
/// Populate the parameter map given a string
void readParameterMap(const std::string & parameterStr);

/// Returns the start date for this experiment
std::string getWorkspaceStartDate();
/// Returns the start date for this experiment (or current time if no info available)
std::string getWorkspaceStartDate() const;

// run/experiment stat time if available, empty otherwise
std::string getAvailableWorkspaceStartDate() const;
// run end time if available, empty otherwise
std::string getAvailableWorkspaceEndDate() const;

/// Utility to retrieve the validity dates for the given IDF
static void getValidFromTo(const std::string& IDFfilename, std::string& outValidFrom, std::string& outValidTo);
Expand Down
4 changes: 4 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IAlgorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ class MANTID_API_DLL IAlgorithm : virtual public Kernel::IPropertyManager
virtual void setLoggingOffset(const int value) = 0;
///returns the logging priority offset
virtual int getLoggingOffset() const = 0;
/// disable Logging of start and end messages
virtual void setAlgStartupLogging(const bool enabled) = 0;
/// get the state of Logging of start and end messages
virtual bool getAlgStartupLogging() const = 0;
///setting the child start progress
virtual void setChildStartProgress(const double startProgress)const = 0;
/// setting the child end progress
Expand Down
43 changes: 32 additions & 11 deletions Code/Mantid/Framework/API/src/Algorithm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ namespace Mantid
m_progressObserver(NULL),
m_isInitialized(false), m_isExecuted(false),m_isChildAlgorithm(false), m_recordHistoryForChild(false),
m_alwaysStoreInADS(false),m_runningAsync(false),
m_running(false), m_rethrow(false), m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false)
m_running(false), m_rethrow(false), m_isAlgStartupLoggingEnabled(true),
m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false)
{
}

Expand Down Expand Up @@ -1034,6 +1035,7 @@ namespace Mantid
m_algorithmID = proxy.getAlgorithmID();
setLogging(proxy.isLogging());
setLoggingOffset(proxy.getLoggingOffset());
setAlgStartupLogging(proxy.getAlgStartupLogging());
setChild(proxy.isChild());
}

Expand Down Expand Up @@ -1209,13 +1211,16 @@ namespace Mantid
{
auto & logger = getLogger();

logger.notice() << name() << " started";
if (this->isChild())
logger.notice() << " (child)";
logger.notice() << std::endl;
// Make use of the AlgorithmHistory class, which holds all the info we want here
AlgorithmHistory AH(this);
logger.information() << AH;
if (m_isAlgStartupLoggingEnabled)
{
logger.notice() << name() << " started";
if (this->isChild())
logger.notice() << " (child)";
logger.notice() << std::endl;
// Make use of the AlgorithmHistory class, which holds all the info we want here
AlgorithmHistory AH(this);
logger.information() << AH;
}
}


Expand Down Expand Up @@ -1662,8 +1667,11 @@ namespace Mantid

if (!m_isChildAlgorithm || m_alwaysStoreInADS)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl;
if (m_isAlgStartupLoggingEnabled)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl;
}
}

else
Expand All @@ -1673,8 +1681,21 @@ namespace Mantid
m_running = false;
}

/** Enable or disable Logging of start and end messages
@param enabled : true to enable logging, false to disable
*/
void Algorithm::setAlgStartupLogging(const bool enabled)
{
m_isAlgStartupLoggingEnabled = enabled;
}


/** return the state of logging of start and end messages
@returns : true to logging is enabled
*/
bool Algorithm::getAlgStartupLogging() const
{
return m_isAlgStartupLoggingEnabled;
}
} // namespace API

//---------------------------------------------------------------------------
Expand Down
16 changes: 15 additions & 1 deletion Code/Mantid/Framework/API/src/AlgorithmProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Mantid
PropertyManagerOwner(), m_executeAsync(new Poco::ActiveMethod<bool, Poco::Void, AlgorithmProxy>(this,&AlgorithmProxy::executeAsyncImpl)),
m_name(alg->name()),m_category(alg->category()), m_categorySeparator(alg->categorySeparator()),
m_alias(alg->alias()),m_summary(alg->summary()), m_version(alg->version()), m_alg(alg),
m_isExecuted(),m_isLoggingEnabled(true), m_loggingOffset(0), m_rethrow(false),
m_isExecuted(),m_isLoggingEnabled(true), m_loggingOffset(0), m_isAlgStartupLoggingEnabled(true), m_rethrow(false),
m_isChild(false)
{
if (!alg)
Expand Down Expand Up @@ -334,6 +334,20 @@ namespace Mantid
return res;
}

/** Enable or disable Logging of start and end messages
@param enabled : true to enable logging, false to disable
*/
void AlgorithmProxy::setAlgStartupLogging(const bool enabled)
{
m_isAlgStartupLoggingEnabled = enabled;
}

/** return the state of logging of start and end messages
@returns : true to logging is enabled
*/
bool AlgorithmProxy::getAlgStartupLogging() const
{
return m_isAlgStartupLoggingEnabled;
}
} // namespace API
} // namespace Mantid
73 changes: 69 additions & 4 deletions Code/Mantid/Framework/API/src/ExperimentInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ namespace API
<< inst->getValidFromDate().toFormattedString("%Y-%b-%d")
<< " to " << inst->getValidToDate().toFormattedString("%Y-%b-%d") << ")";
out << "\n";
if (!inst->getFilename().empty())
{
out << "Instrument from: " << inst->getFilename();
out << "\n";
}

//parameter files loaded
auto paramFileVector = this->instrumentParameters().getParameterFilenames();
for (auto itFilename = paramFileVector.begin(); itFilename != paramFileVector.end(); ++itFilename)
{
out << "Parameters from: " << *itFilename;
out << "\n";
}

std::string runStart = getAvailableWorkspaceStartDate();
std::string runEnd = getAvailableWorkspaceEndDate();
std::string msgNA = "not available";
if (runStart.empty())
runStart = msgNA;
if (runEnd.empty())
runEnd = msgNA;
out << "Run start: " << runStart << "\n";
out << "Run end: " << runEnd << "\n"; // note extra space for pseudo/approx-alignment

if (this->sample().hasOrientedLattice())
{
const Geometry::OrientedLattice & latt = this->sample().getOrientedLattice();
Expand Down Expand Up @@ -365,7 +389,6 @@ namespace API
{
if(m_detgroups.empty())
{
g_log.debug("No detector mapping cached, getting detector from instrument");
return getInstrument()->getDetector(detID);
}
else
Expand Down Expand Up @@ -766,11 +789,11 @@ namespace API

//---------------------------------------------------------------------------------------
/** Return workspace start date as an ISO 8601 string. If this info not stored in workspace the
* method returns current date.
* method returns current date. This date is used for example to retrieve the instrument file.
*
* @return workspace start date as a string
* @return workspace start date as a string (current time if start date not available)
*/
std::string ExperimentInfo::getWorkspaceStartDate()
std::string ExperimentInfo::getWorkspaceStartDate() const
{
std::string date;
try
Expand All @@ -785,6 +808,48 @@ namespace API
return date;
}

//---------------------------------------------------------------------------------------
/** Return workspace start date as a formatted string (strftime, as
* returned by Kernel::DateAndTime) string, if available. If
* unavailable, an empty string is returned
*
* @return workspace start date as a string (empty if no date available)
*/
std::string ExperimentInfo::getAvailableWorkspaceStartDate() const
{
std::string date;
try
{
date = run().startTime().toFormattedString();
}
catch (std::runtime_error &)
{
g_log.information("Note: run_start/start_time not stored in workspace.");
}
return date;
}

//---------------------------------------------------------------------------------------
/** Return workspace end date as a formatted string (strftime style,
* as returned by Kernel::DateAdnTime) string, if available. If
* unavailable, an empty string is returned
*
* @return workspace end date as a string (empty if no date available)
*/
std::string ExperimentInfo::getAvailableWorkspaceEndDate() const
{
std::string date;
try
{
date = run().endTime().toFormattedString();
}
catch (std::runtime_error &)
{
g_log.information("Note: run_start/start_time not stored in workspace.");
}
return date;
}

//---------------------------------------------------------------------------------------
/** A given instrument may have multiple IDFs associated with it. This method return an
* identifier which identify a given IDF for a given instrument. An IDF filename is
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/API/test/AlgorithmTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,15 @@ class AlgorithmTest : public CxxTest::TestSuite
TS_ASSERT_EQUALS(false, alg.isChild());
}

void testAlgStartupLogging()
{
TSM_ASSERT_EQUALS("Default logging should be true", true, alg.getAlgStartupLogging());
alg.setAlgStartupLogging(false);
TSM_ASSERT_EQUALS("After setting logging should be false", false, alg.getAlgStartupLogging());
alg.setAlgStartupLogging(true);
TSM_ASSERT_EQUALS("After setting logging it back it should be true", true, alg.getAlgStartupLogging());
}

void testInitialize()
{
TS_ASSERT_THROWS_NOTHING(alg.initialize());
Expand Down
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/API/test/MatrixWorkspaceTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ class MatrixWorkspaceTest : public CxxTest::TestSuite
"X axis: Time-of-flight / microsecond\n"
"Y axis: Counts\n"
"Distribution: False\n"
"Instrument: (1990-Jan-01 to 1990-Jan-01)\n";
"Instrument: (1990-Jan-01 to 1990-Jan-01)\n"
"Run start: not available\n"
"Run end: not available\n"
;

TS_ASSERT_EQUALS(expected, testWS->toString());
}
Expand Down
9 changes: 1 addition & 8 deletions Code/Mantid/Framework/Algorithms/src/CreateDummyCalFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include <Poco/DOM/DOMParser.h>
#include <Poco/DOM/Document.h>
#include <Poco/DOM/Element.h>
#include <Poco/DOM/NodeList.h>
#include <Poco/DOM/NodeIterator.h>
#include <Poco/DOM/NodeFilter.h>
#include <Poco/File.h>
#include <Poco/Path.h>
#include <boost/algorithm/string/split.hpp>
Expand All @@ -25,10 +22,6 @@
using Poco::XML::DOMParser;
using Poco::XML::Document;
using Poco::XML::Element;
using Poco::XML::Node;
using Poco::XML::NodeList;
using Poco::XML::NodeIterator;
using Poco::XML::NodeFilter;


namespace Mantid
Expand Down Expand Up @@ -87,7 +80,7 @@ namespace Mantid

// Set up the DOM parser and parse xml file
DOMParser pParser;
Document* pDoc;
Poco::AutoPtr<Document> pDoc;
try
{
pDoc = pParser.parse(directoryName+instshort);
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/ReadGroupsFromFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ namespace Algorithms
void ReadGroupsFromFile::readXMLGroupingFile(const std::string& filename)
{
Poco::XML::DOMParser xmlParser;
Poco::XML::Document* file;
Poco::AutoPtr<Poco::XML::Document> file;
try
{
file = xmlParser.parse(filename);
Expand All @@ -220,7 +220,7 @@ namespace Algorithms
throw Kernel::Exception::FileError("No root element in XML grouping file: ", filename);
}

Poco::XML::NodeList* groups = root->getElementsByTagName("group");
Poco::AutoPtr<Poco::XML::NodeList> groups = root->getElementsByTagName("group");

if ( groups->length() == 0 )
{
Expand Down

0 comments on commit fd7615b

Please sign in to comment.