Skip to content

Commit

Permalink
Merge branch 'master' into feature/10368_apply_corrections_preview_plot
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/src/ConvFit.cpp
	Code/Mantid/MantidQt/CustomInterfaces/src/Quasi.cpp

Refs #10368
  • Loading branch information
DanNixon committed Nov 7, 2014
2 parents 608d4a1 + 248d17f commit 0805584
Show file tree
Hide file tree
Showing 429 changed files with 38,049 additions and 14,409 deletions.
4 changes: 1 addition & 3 deletions Code/Mantid/Build/CMake/DarwinSetup.cmake
Expand Up @@ -128,9 +128,7 @@ else()
set ( PYQT4_PYTHONPATH /usr/local/lib/python${PY_VER}/site-packages/PyQt4 )
set ( SITEPACKAGES /usr/local/lib/python${PY_VER}/site-packages )
# use homebrew OpenSSL package
EXEC_PROGRAM( brew ARGS info openssl | grep openssl: | cut -c 17-22 OUTPUT_VARIABLE _openssl_version )
MESSAGE(STATUS "OpenSSL version: ${_openssl_version}")
set ( OPENSSL_ROOT_DIR /usr/local/Cellar/openssl/${_openssl_version}/ )
set ( OPENSSL_ROOT_DIR /usr/local/opt/openssl )
endif()

# Python packages
Expand Down
57 changes: 40 additions & 17 deletions Code/Mantid/Build/CMake/FindPyQt.py
@@ -1,25 +1,48 @@
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# Copyright (c) 2014, Raphael Kubo da Costa <rakuco@FreeBSD.org>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

import PyQt4.pyqtconfig
import PyQt4.QtCore
import os
import sys

pyqtcfg = PyQt4.pyqtconfig.Configuration()
print("pyqt_version:%06.0x" % pyqtcfg.pyqt_version)
print("pyqt_version_str:%s" % pyqtcfg.pyqt_version_str)

pyqt_version_tag = ""
in_t = False
for item in pyqtcfg.pyqt_sip_flags.split(' '):
if item=="-t":
in_t = True
elif in_t:
if item.startswith("Qt_4"):
pyqt_version_tag = item
def get_default_sip_dir():
# This is based on QScintilla's configure.py, and only works for the
# default case where installation paths have not been changed in PyQt's
# configuration process.
if sys.platform == 'win32':
pyqt_sip_dir = os.path.join(sys.platform, 'sip', 'PyQt4')
else:
in_t = False
print("pyqt_version_tag:%s" % pyqt_version_tag)
pyqt_sip_dir = os.path.join(sys.platform, 'share', 'sip', 'PyQt4')
return pyqt_sip_dir

def get_qt4_tag(sip_flags):
in_t = False
for item in sip_flags.split(' '):
if item == '-t':
in_t = True
elif in_t:
if item.startswith('Qt_4'):
return item
else:
in_t = False
raise ValueError('Cannot find Qt\'s tag in PyQt4\'s SIP flags.')

print("pyqt_sip_dir:%s" % pyqtcfg.pyqt_sip_dir)
print("pyqt_sip_flags:%s" % pyqtcfg.pyqt_sip_flags)
if __name__ == '__main__':
try:
import PyQt4.pyqtconfig
pyqtcfg = PyQt4.pyqtconfig.Configuration()
sip_dir = pyqtcfg.pyqt_sip_dir
sip_flags = pyqtcfg.pyqt_sip_flags
except ImportError:
# PyQt4 >= 4.10.0 was built with configure-ng.py instead of
# configure.py, so pyqtconfig.py is not installed.
sip_dir = get_default_sip_dir()
sip_flags = PyQt4.QtCore.PYQT_CONFIGURATION['sip_flags']

print('pyqt_version:%06.x' % PyQt4.QtCore.PYQT_VERSION)
print('pyqt_version_str:%s' % PyQt4.QtCore.PYQT_VERSION_STR)
print('pyqt_version_tag:%s' % get_qt4_tag(sip_flags))
print('pyqt_sip_dir:%s' % sip_dir)
print('pyqt_sip_flags:%s' % sip_flags)
53 changes: 38 additions & 15 deletions Code/Mantid/Build/CMake/FindPyQt4.cmake
Expand Up @@ -9,16 +9,20 @@
# Find the installed version of PyQt4. FindPyQt4 should only be called after
# Python has been found.
#
# This file defines the following variables:
# This file defines the following variables, which can also be overriden by
# users:
#
# PYQT4_VERSION - The version of PyQt4 found expressed as a 6 digit hex number
# suitable for comparision as a string
# suitable for comparison as a string
#
# PYQT4_VERSION_STR - The version of PyQt4 as a human readable string.
#
# PYQT4_VERSION_TAG - The PyQt version tag using by PyQt's sip files.
# PYQT4_VERSION_TAG - The Qt4 version tag used by PyQt's sip files.
#
# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files.
# PYQT4_SIP_DIR - The directory holding the PyQt4 .sip files. This can be unset
# if PyQt4 was built using its new build system and pyqtconfig.py is not
# present on the system, as in this case its value cannot be determined
# automatically.
#
# PYQT4_SIP_FLAGS - The SIP flags used to build PyQt.

Expand All @@ -30,19 +34,38 @@ ELSE(EXISTS PYQT4_VERSION)
FIND_FILE(_find_pyqt_py FindPyQt.py PATHS ${CMAKE_MODULE_PATH})

EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${_find_pyqt_py} OUTPUT_VARIABLE pyqt_config)
IF( NOT ${pyqt_config} MATCHES "Traceback" )
STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config})
STRING(REGEX REPLACE ".*\npyqt_version_str:([^\n]+).*$" "\\1" PYQT4_VERSION_STR ${pyqt_config})
STRING(REGEX REPLACE ".*\npyqt_version_tag:([^\n]+).*$" "\\1" PYQT4_VERSION_TAG ${pyqt_config})
STRING(REGEX REPLACE ".*\npyqt_sip_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config})
STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${pyqt_config})
IF(pyqt_config)
STRING(REGEX MATCH "^pyqt_version:([^\n]+).*$" _dummy ${pyqt_config})
SET(PYQT4_VERSION "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a 6-digit hexadecimal number")

SET(PYQT4_FOUND TRUE)
ENDIF()
STRING(REGEX MATCH ".*\npyqt_version_str:([^\n]+).*$" _dummy ${pyqt_config})
SET(PYQT4_VERSION_STR "${CMAKE_MATCH_1}" CACHE STRING "PyQt4's version as a human-readable string")

include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( PyQt4 DEFAULT_MSG PYQT4_VERSION )
STRING(REGEX MATCH ".*\npyqt_version_tag:([^\n]+).*$" _dummy ${pyqt_config})
SET(PYQT4_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt4 version tag used by PyQt4's .sip files")

mark_as_advanced ( _find_pyqt_py )
STRING(REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${pyqt_config})
SET(PYQT4_SIP_DIR "${CMAKE_MATCH_1}" CACHE FILEPATH "The base directory where PyQt4's .sip files are installed")

STRING(REGEX MATCH ".*\npyqt_sip_flags:([^\n]+).*$" _dummy ${pyqt_config})
SET(PYQT4_SIP_FLAGS "${CMAKE_MATCH_1}" CACHE STRING "The SIP flags used to build PyQt4")

IF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
MESSAGE(WARNING "The base directory where PyQt4's SIP files are installed could not be determined. This usually means PyQt4 was built with its new build system and pyqtconfig.py is not present.\n"
"Please set the PYQT4_SIP_DIR variable manually.")
ELSE(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
SET(PYQT4_FOUND TRUE)
ENDIF(NOT IS_DIRECTORY "${PYQT4_SIP_DIR}")
ENDIF(pyqt_config)

IF(PYQT4_FOUND)
IF(NOT PYQT4_FIND_QUIETLY)
MESSAGE(STATUS "Found PyQt4 version: ${PYQT4_VERSION_STR}")
ENDIF(NOT PYQT4_FIND_QUIETLY)
ELSE(PYQT4_FOUND)
IF(PYQT4_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Python")
ENDIF(PYQT4_FIND_REQUIRED)
ENDIF(PYQT4_FOUND)

ENDIF(EXISTS PYQT4_VERSION)
2 changes: 1 addition & 1 deletion Code/Mantid/Build/CMake/FindTcmalloc.cmake
Expand Up @@ -7,7 +7,7 @@
# TCMALLOC_FOUND If false, do not try to use TCMALLOC

find_path ( TCMALLOC_INCLUDE_DIR tcmalloc.h
PATHS /usr/include/google
PATHS /usr/include/gperftools
)

find_library ( TCMALLOC_LIB NAMES tcmalloc tcmalloc_minimal )
Expand Down
9 changes: 7 additions & 2 deletions Code/Mantid/Build/CMake/UseSystemQt4.cmake
Expand Up @@ -23,8 +23,13 @@
# License text for the above reference.)

ADD_DEFINITIONS(${QT_DEFINITIONS})
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.9)
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:QT_DEBUG>)
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>)
ELSE()
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QT_DEBUG)
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG)
ENDIF()
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_RELWITHDEBINFO QT_NO_DEBUG)
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_MINSIZEREL QT_NO_DEBUG)

Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/Build/class_maker.py
Expand Up @@ -129,6 +129,8 @@ def write_source(subproject, classname, filename, args):
algorithm_source = """
//----------------------------------------------------------------------------------------------
/// Algorithms name for identification. @see Algorithm::name
const std::string %s::name() const { return "%s"; }
/// Algorithm's version for identification. @see Algorithm::version
int %s::version() const { return 1;};
Expand Down Expand Up @@ -156,7 +158,7 @@ def write_source(subproject, classname, filename, args):
// TODO Auto-generated execute stub
}
""" % (classname, classname, classname, classname, classname)
""" % (classname, classname, classname, classname, classname, classname, classname)

if not args.alg:
algorithm_top = ""
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/CMakeLists.txt
Expand Up @@ -121,6 +121,7 @@ set ( CORE_MANTIDLIBS Kernel Geometry API )

# Add a target for all GUI tests
add_custom_target ( GUITests )
add_dependencies ( GUITests MantidWidgetsTest)
add_dependencies ( check GUITests )
# Collect all tests together
add_custom_target ( AllTests )
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Expand Up @@ -105,6 +105,7 @@ set ( SRC_FILES
src/Run.cpp
src/Sample.cpp
src/SampleEnvironment.cpp
src/SampleShapeValidator.cpp
src/ScopedWorkspace.cpp
src/ScriptBuilder.cpp
src/ScriptRepository.cpp
Expand Down Expand Up @@ -264,6 +265,7 @@ set ( INC_FILES
inc/MantidAPI/Run.h
inc/MantidAPI/Sample.h
inc/MantidAPI/SampleEnvironment.h
inc/MantidAPI/SampleShapeValidator.h
inc/MantidAPI/ScopedWorkspace.h
inc/MantidAPI/ScriptBuilder.h
inc/MantidAPI/ScriptRepository.h
Expand Down Expand Up @@ -355,6 +357,7 @@ set ( TEST_FILES
PropertyNexusTest.h
RunTest.h
SampleEnvironmentTest.h
SampleShapeValidatorTest.h
SampleTest.h
ScopedWorkspaceTest.h
ScriptBuilderTest.h
Expand Down
19 changes: 10 additions & 9 deletions Code/Mantid/Framework/API/inc/MantidAPI/Column.h
Expand Up @@ -9,9 +9,10 @@
#ifndef Q_MOC_RUN
# include <boost/shared_ptr.hpp>
#endif
#include <cstring>
#include <string>
#include <typeinfo>
#include <limits>
#include <typeinfo>
#include <vector>

namespace Mantid
Expand Down Expand Up @@ -114,7 +115,7 @@ class MANTID_API_DLL Column
{
return *static_cast<T*>(void_pointer(index));
}


/// Templated method for returning a value (const version). No type checks are done.
template<class T>
Expand All @@ -127,17 +128,17 @@ class MANTID_API_DLL Column
template<class T>
bool isType()const
{
return get_type_info() == typeid(T);
return !std::strcmp(get_type_info().name(), typeid(T).name());
}

/// get plot type
/// @return See description of setPlotType() for the interpretation of the returned int
/// get plot type
/// @return See description of setPlotType() for the interpretation of the returned int
int getPlotType() const
{
return m_plotType;
}

/// Set plot type where
/// Set plot type where
void setPlotType(int t);

/**
Expand Down Expand Up @@ -169,7 +170,7 @@ class MANTID_API_DLL Column
std::string m_name;///< name
std::string m_type;///< type

/// plot type where
/// plot type where
/// None = 0 (means it has specifically been set to 'no plot type')
/// NotSet = -1000 (this is the default and means plot style has not been set)
/// X = 1, Y = 2, Z = 3, xErr = 4, yErr = 5, Label = 6
Expand All @@ -184,7 +185,7 @@ class MANTID_API_DLL Column
};

/** @class Boolean
As TableColumn stores its data in a std::vector bool type cannot be used
As TableColumn stores its data in a std::vector bool type cannot be used
in the same way as the other types. Class Boolean is used instead.
*/
struct MANTID_API_DLL Boolean
Expand All @@ -197,7 +198,7 @@ struct MANTID_API_DLL Boolean
operator bool(){return value;}
/// equal to operator
bool operator==(const Boolean& b)const
{return(this->value==b.value);
{return(this->value==b.value);
}
//
operator double(void)const{return double(this->value);}
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IMDNode.h
Expand Up @@ -71,6 +71,7 @@ class IMDNode
*@param loadFileData -- if true, the data on HDD and not yet in memory are loaded into memory before deleting fileBacked information,
if false, all on HDD contents are discarded, which can break the data integrity (used by destructor) */
virtual void clearFileBacked(bool loadFileData)=0;
virtual void reserveMemoryForLoad(uint64_t)=0;

/**Save the box at specific disk position using the class, respoinsible for the file IO. */
virtual void saveAt(API::IBoxControllerIO *const /*saver */, uint64_t /*position*/)const=0;
Expand Down
34 changes: 34 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/MatrixWorkspace.h
Expand Up @@ -16,6 +16,7 @@
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidAPI/SpectraDetectorTypes.h"
#include "MantidKernel/EmptyValues.h"


namespace Mantid
Expand All @@ -33,6 +34,13 @@ namespace Mantid
{
class SpectrumDetectorMapping;

/// typedef for the image type
typedef std::vector<std::vector<double>> MantidImage;
/// shared pointer to MantidImage
typedef boost::shared_ptr<MantidImage> MantidImage_sptr;
/// shared pointer to const MantidImage
typedef boost::shared_ptr<const MantidImage> MantidImage_const_sptr;

//----------------------------------------------------------------------
/** Base MatrixWorkspace Abstract Class.
Expand Down Expand Up @@ -227,6 +235,9 @@ namespace Mantid
/// Return a vector with the integrated counts for all spectra withing the given range
virtual void getIntegratedSpectra(std::vector<double> & out, const double minX, const double maxX, const bool entireRange) const;

/// Return an index in the X vector for an x-value close to a given value
std::pair<size_t,double> getXIndex(size_t i, double x, bool isLeft = true, size_t start = 0) const;

//----------------------------------------------------------------------

int axes() const;
Expand Down Expand Up @@ -311,6 +322,25 @@ namespace Mantid
// End IMDWorkspace methods
//=====================================================================================

//=====================================================================================
// Image methods
//=====================================================================================

/// Get start and end x indices for images
std::pair<size_t,size_t> getImageStartEndXIndices( size_t i, double startX, double endX ) const;
/// Create an image of Ys.
MantidImage_sptr getImageY (size_t start = 0, size_t stop = 0, size_t width = 0, double startX = EMPTY_DBL(), double endX = EMPTY_DBL() ) const;
/// Create an image of Es.
MantidImage_sptr getImageE (size_t start = 0, size_t stop = 0, size_t width = 0, double startX = EMPTY_DBL(), double endX = EMPTY_DBL() ) const;
/// Copy the data (Y's) from an image to this workspace.
void setImageY( const MantidImage &image, size_t start = 0 );
/// Copy the data from an image to this workspace's errors.
void setImageE( const MantidImage &image, size_t start = 0 );

//=====================================================================================
// End image methods
//=====================================================================================

protected:
MatrixWorkspace(Mantid::Geometry::INearestNeighboursFactory* factory = NULL);

Expand All @@ -328,6 +358,10 @@ namespace Mantid
MatrixWorkspace(const MatrixWorkspace&);
/// Private copy assignment operator. NO ASSIGNMENT ALLOWED
MatrixWorkspace& operator=(const MatrixWorkspace&);
/// Create an MantidImage instance.
MantidImage_sptr getImage(const MantidVec& (MatrixWorkspace::*read)(std::size_t const) const, size_t start, size_t stop, size_t width, size_t indexStart, size_t indexEnd) const;
/// Copy data from an image.
void setImage( MantidVec& (MatrixWorkspace::*dataVec)(const std::size_t), const MantidImage &image, size_t start );

/// Has this workspace been initialised?
bool m_isInitialized;
Expand Down

0 comments on commit 0805584

Please sign in to comment.