Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/6752_improv…
Browse files Browse the repository at this point in the history
…e_comments

Refs #6752

Conflicts:
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_All.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_B1.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_D2.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_D4.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_Simple.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoWish0.py
	Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoWish_Simple.py
  • Loading branch information
KarlPalmen committed Apr 9, 2013
2 parents 86c543a + 69a8b22 commit 7de1dd4
Show file tree
Hide file tree
Showing 339 changed files with 12,597 additions and 4,383 deletions.
11 changes: 8 additions & 3 deletions Code/Mantid/Build/CMake/WindowsNSIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
install ( DIRECTORY ${CMAKE_LIBRARY_PATH}/Python27/Scripts DESTINATION bin PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
install ( FILES ${PY_DLL_PREFIX}${PY_DLL_SUFFIX_RELEASE} ${PYTHON_EXECUTABLE} ${PYTHONW_EXECUTABLE} DESTINATION bin )

install ( DIRECTORY ${CMAKE_LIBRARY_PATH}/qt_plugins/imageformats DESTINATION plugins/qtplugins PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Installers/WinInstaller/qt.conf DESTINATION bin )

# include files
install ( DIRECTORY ${CMAKE_INCLUDE_PATH}/boost DESTINATION include PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
install ( DIRECTORY ${CMAKE_INCLUDE_PATH}/Poco DESTINATION include PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE )
Expand Down Expand Up @@ -105,6 +102,14 @@
REGEX "(QtDesigner4.dll)|(QtDesignerComponents4.dll)|(QtScript4.dll)|(-gd-)|(d4.dll)|(_d.dll)"
EXCLUDE
PATTERN ".git" EXCLUDE )

# Qt plugins into out plugins directory and use qt.conf to point Qt at where they are
install ( DIRECTORY ${CMAKE_LIBRARY_PATH}/qt_plugins/imageformats ${CMAKE_LIBRARY_PATH}/qt_plugins/sqldrivers DESTINATION plugins/qtplugins
REGEX "^.*d4.dll$" EXCLUDE )
install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/Installers/WinInstaller/qt.conf DESTINATION bin )

# Copy assistant.exe
install ( FILES ${CMAKE_LIBRARY_PATH}/assistant.exe DESTINATION bin )

# Release deployments do modify enviromental variables, other deployments do not.
if(CPACK_PACKAGE_SUFFIX STREQUAL "")
Expand Down
74 changes: 12 additions & 62 deletions Code/Mantid/Build/wiki_maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,66 +179,14 @@ def wiki_maker_page(page):
returns True if the wikimaker was the last editor.
determines if there is a bot comment, which implies that the wikimaker was used to create the page last.
"""
#Get the last editor of the page.
# If there are no previous authors, we also count this as a wikimaker page.
revisions = page.revisions()
if len(list(page.revisions())) == 0:
return True;
# Get the last editor of the page.
for rev in revisions:
return re.search("^Bot", rev['comment'])

#======================================================================
def create_function_signature(alg, algo_name):
"""
create the function signature for the algorithm.
"""
from mantid.simpleapi import _get_function_spec
import mantid.simpleapi
_alg = getattr(mantid.simpleapi, algo_name)
prototype = algo_name + _get_function_spec(_alg)

# Replace every nth column with a newline.
nth = 3
commacount = 0
prototype_reformated = ""
for char in prototype:
if char == ',':
commacount += 1
if (commacount % nth == 0):
prototype_reformated += ",\n "
else:
prototype_reformated += char
else:
prototype_reformated += char

# Strip out the version.
prototype_reformated = prototype_reformated.replace(",[Version]", "")
prototype_reformated = prototype_reformated.replace(",\n [Version]", "")

# Add the output properties
props = alg._ProxyObject__obj.getProperties()
allreturns = []
workspacereturn = None
# Loop through all the properties looking for output properties
for prop in props:
if (direction_string[prop.direction] == OutputDirection):
allreturns.append(prop.name)
# Cache the last workspace property seen.
if isinstance(prop, IWorkspaceProperty):
workspacereturn = prop.name

lhs = ""
comments = ""
if not allreturns:
pass
elif (len(allreturns) == 1) and (workspacereturn is not None):
lhs = workspacereturn + " = "
else :
lhs = "result = "
comments = "\n "
comments += "\n # -------------------------------------------------- \n"
comments += " # result is a tuple containing\n"
comments += " # (" + ",".join(allreturns ) + ")\n"
comments += " # To access individual outputs use result[i], where i is the index of the required output.\n"

return lhs + prototype_reformated + comments

#======================================================================
def do_algorithm(args, algo, version):
Expand All @@ -262,14 +210,16 @@ def do_algorithm(args, algo, version):

print "Generating wiki page for %s at http://www.mantidproject.org/%s" % (algo, wiki_page_name)
site = wiki_tools.site

# Use wikitools to make the new contents.
new_contents = make_wiki(algo, version, latest_version)

#Open the page with the name of the algo
# Open the page with the name of the algo
page = site.Pages[wiki_page_name]
if not page_exists(page):
print "Error: Wiki Page wiki_page_name %s does not exist on the wiki." % wiki_page_name
reporter.addFailureNoPage(algo, wiki_page_name)
return

# Wiki page should have a description.
if re.search(missing_description, new_contents):
reporter.addFailureNoDescription(algo, version)

old_contents = page.edit() + "\n"

Expand Down Expand Up @@ -298,7 +248,7 @@ def do_algorithm(args, algo, version):
# Report a failure test case
reporter.addFailureTestCase(algo, version, last_modifier, ''.join(diff_list))
else:
print "The last edit was automatic via a script. Last edit was done by WIKIMAKER script."
print "The last edit was automatic via a script, or this is a new page. Last edit was done by WIKIMAKER script."
print "Last change by ", last_modifier

if args.dryrun:
Expand Down
5 changes: 2 additions & 3 deletions Code/Mantid/Build/wiki_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@ def addSuccessTestCase(self, algorithm):
def addFailureTestCase(self, algorithm, version, last_editor, diff):
contents = "Algorithm %s Version %i last edited by %s is out of sync.\n\nDifferences are:\n\n%s" % (algorithm, version, last_editor, diff)
self.__addGenericFailure__(contents, algorithm)


def addFailureNoPage(self, algorithm, expected_page):
contents = "Algorithm %s has no wiki page. Wiki page expected %s still needs creating." % (algorithm, expected_page)
def addFailureNoDescription(self, algorithm, version):
contents = "Algorithm %s Version %i has no description" % (algorithm, version)
self.__addGenericFailure__(contents, algorithm)

15 changes: 7 additions & 8 deletions Code/Mantid/Build/wiki_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import codecs
import fnmatch
import platform
import re

module_name=os.path.basename(os.path.splitext(__file__)[0])
mantid_initialized = False
Expand All @@ -29,6 +30,9 @@
python_files = []
python_files_bare = []

# Missing description tag.
missing_description = "INSERT FULL DESCRIPTION HERE"

#======================================================================
def remove_wiki_from_header():
"""One-time method to remove *WIKI* tags from all header files """
Expand Down Expand Up @@ -193,21 +197,17 @@ def create_function_signature(alg, algo_name):
# Add the output properties
props = alg.getProperties()
allreturns = []
workspacereturn = None
# Loop through all the properties looking for output properties
for prop in props:
if (direction_string[prop.direction] == OutputDirection):
allreturns.append(prop.name)
# Cache the last workspace property seen.
if isinstance(prop, IWorkspaceProperty):
workspacereturn = prop.name

lhs = ""
comments = ""
if not allreturns:
pass
elif (len(allreturns) == 1) and (workspacereturn is not None):
lhs = workspacereturn + " = "
elif (len(allreturns) == 1):
lhs = allreturns[0] + " = "
else :
lhs = "result = "
comments = "\n "
Expand Down Expand Up @@ -276,7 +276,6 @@ def initialize_wiki(args):


#======================================================================

def flag_if_build_is_debug(mantidpath):
"""
Check if the given build is a debug build of Mantid
Expand Down Expand Up @@ -601,7 +600,7 @@ def do_make_wiki(algo_name, version, latest_version):
except IndexError:
pass
if (desc == ""):
out += "INSERT FULL DESCRIPTION HERE\n"
out += missing_description + "\n"
print "Warning: missing wiki description for %s! Placeholder inserted instead." % algo_name
else:
out += desc + "\n"
Expand Down
11 changes: 11 additions & 0 deletions Code/Mantid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ if ( ENABLE_CPACK )
else()
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla" )
endif()

# qt assistant is in different places in every distro
if ( ${UNIX_DIST} MATCHES "RedHatEnterprise" )
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qt4-x11" )
elseif ( ${UNIX_DIST} MATCHES "Fedora" )
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qt4-assistant" )
elseif ( ${UNIX_DIST} MATCHES "SUSE LINUX" )
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} libqt4-devel-doc" )
endif ( ${UNIX_DIST} MATCHES "RedHatEnterprise" )

if( ${UNIX_DIST} STREQUAL "Ubuntu" )
if( ${UNIX_CODENAME} STREQUAL "lucid" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-date-time1.40.0,libboost-regex1.40.0,libboost-signals1.40.0,libpocofoundation9,libpocoutil9,libpoconet9,libpoconetssl9,libpococrypto9,libpocoxml9,libnexus0 (>= 4.2),libgsl0ldbl,libqtcore4 (>= 4.2),libqtgui4 (>= 4.2),libqt4-opengl (>= 4.2),libqt4-xml (>= 4.2),libqt4-svg (>= 4.2),libqt4-qt3support (>= 4.2),libqscintilla2-5,libqwt5-qt4,libqwtplot3d-qt4-0" )
Expand All @@ -196,6 +206,7 @@ if ( ENABLE_CPACK )
else()
message( WARNING "Mantid does not support packaging of this Ubuntu version: ${UNIX_CODENAME}")
endif()
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},qt4-dev-tools" ) # for qt assistant
endif()
# soft requirement of tcmalloc - if built with it, then require it
IF ( USE_TCMALLOC AND TCMALLOC_FOUND )
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ set ( SRC_FILES
src/Run.cpp
src/Sample.cpp
src/SampleEnvironment.cpp
src/SelectionNotificationService.cpp
src/ScriptRepository.cpp
src/ScriptRepositoryFactory.cpp
src/SpectraAxis.cpp
Expand Down Expand Up @@ -239,6 +240,7 @@ set ( INC_FILES
inc/MantidAPI/SampleEnvironment.h
inc/MantidAPI/ScriptRepository.h
inc/MantidAPI/ScriptRepositoryFactory.h
inc/MantidAPI/SelectionNotificationService.h
inc/MantidAPI/SingleValueParameter.h
inc/MantidAPI/SingleValueParameterParser.h
inc/MantidAPI/SpecialCoordinateSystem.h
Expand Down Expand Up @@ -315,6 +317,7 @@ set ( TEST_FILES
RunTest.h
SampleEnvironmentTest.h
SampleTest.h
SelectionNotificationServiceTest.h
SpectraAxisTest.h
SpectraDetectorMapTest.h
TextAxisTest.h
Expand Down
16 changes: 6 additions & 10 deletions Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
virtual std::map<std::string, std::string> validateInputs();
virtual bool isInitialized() const;
virtual bool isExecuted() const;
bool isRunning() const;

using Kernel::PropertyManagerOwner::getProperty;

bool isChild() const;
Expand All @@ -200,10 +202,6 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag

/** @name Asynchronous Execution */
Poco::ActiveResult<bool> executeAsync();
/// True if the algorithm is running asynchronously.
bool isRunningAsync(){return m_runningAsync;}
/// True if the algorithm is running.
bool isRunning(){return m_running;}

/// Add an observer for a notification
void addObserver(const Poco::AbstractObserver& observer)const;
Expand All @@ -212,7 +210,7 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
void removeObserver(const Poco::AbstractObserver& observer)const;

/// Raises the cancel flag.
virtual void cancel() const;
virtual void cancel();
/// Returns the cancellation state
bool getCancel() const { return m_cancel; }

Expand Down Expand Up @@ -298,7 +296,7 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
bool isWorkspaceProperty(const Kernel::Property* const prop) const;

/// Set to true to stop execution
mutable bool m_cancel;
bool m_cancel;
/// Set if an exception is thrown, and not caught, within a parallel region
bool m_parallelException;
/// Reference to the logger class
Expand All @@ -322,9 +320,6 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
std::vector<IWorkspaceProperty *> m_inputWorkspaceProps;

private:
/// VectorWorkspaces


/// Private Copy constructor: NO COPY ALLOWED
Algorithm(const Algorithm&);
/// Private assignment operator: NO ASSIGNMENT ALLOWED
Expand Down Expand Up @@ -381,7 +376,8 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
size_t m_groupSize;
/// All the groups have similar names (group_1, group_2 etc.)
bool m_groupsHaveSimilarNames;

/// A non-recursive mutex for thread-safety
mutable Kernel::Mutex m_mutex;
};

///Typedef for a shared pointer to an Algorithm
Expand Down
41 changes: 12 additions & 29 deletions Code/Mantid/Framework/API/inc/MantidAPI/AlgorithmManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
//----------------------------------------------------------------------
#include <deque>
#include <string>
#include <Poco/NotificationCenter.h>
#include "MantidAPI/DllConfig.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/SingletonHolder.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/AlgorithmFactory.h"
#include <Poco/NotificationCenter.h>

namespace Mantid
{
Expand All @@ -37,10 +36,7 @@ namespace API
/** The AlgorithmManagerImpl class is responsible for controlling algorithm
instances. It incorporates the algorithm factory and initializes algorithms.
@author Dickon Champion, ISIS, RAL
@date 30/10/2007
Copyright &copy; 2007-9 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
Copyright &copy; 2007-2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Expand Down Expand Up @@ -68,42 +64,29 @@ class MANTID_API_DLL AlgorithmManagerImpl
/// Creates an unmanaged algorithm with the option of choosing a version
boost::shared_ptr<Algorithm> createUnmanaged(const std::string& algName, const int& version = -1) const;

/// deletes all registered algorithms
void clear();
/** Gives the number of managed algorithms
* @return The number of registered algorithms
*/
int size() const
{
return static_cast<int>(m_managed_algs.size());
}
/// Returns the names and categories of all algorithms
const std::vector<std::pair<std::string, std::string> > getNamesAndCategories() const;
/// Returns a reference to the container of managed algorithms
const std::deque<IAlgorithm_sptr>& algorithms() const
{
return m_managed_algs;
}
/// Return the pointer to an algorithm with the given ID
std::size_t size() const;

IAlgorithm_sptr getAlgorithm(AlgorithmID id) const;
IAlgorithm_sptr newestInstanceOf(const std::string& algorithmName) const;
std::vector<IAlgorithm_const_sptr> runningInstancesOf(const std::string& algorithmName) const;

/// Sends notifications to observers. Observers can subscribe to notificationCenter
/// using Poco::NotificationCenter::addObserver(...)
Poco::NotificationCenter notificationCenter;

void notifyAlgorithmStarting(AlgorithmID id);

void clear();
void cancelAll();

private:
friend struct Mantid::Kernel::CreateUsingNew<AlgorithmManagerImpl>;

///Class cannot be instantiated by normal means
AlgorithmManagerImpl();
///destructor
~AlgorithmManagerImpl();
///Copy constructor
AlgorithmManagerImpl(const AlgorithmManagerImpl&);

/// Standard Assignment operator
/// Unimplemented copy constructor
AlgorithmManagerImpl(const AlgorithmManagerImpl&);
/// Unimplemented assignment operator
AlgorithmManagerImpl& operator =(const AlgorithmManagerImpl&);

/// Reference to the logger class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/AlgorithmManager.h"
#include <Poco/NObserver.h>

Expand Down

0 comments on commit 7de1dd4

Please sign in to comment.