Skip to content

Commit

Permalink
Merge branch 'master' into 11619_crop_by_mask
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/Framework/Algorithms/src/CropWorkspace.cpp
Re #11619.
  • Loading branch information
mantid-roman committed May 1, 2015
2 parents bcf2536 + 5e3ce44 commit 349d1bd
Show file tree
Hide file tree
Showing 457 changed files with 22,663 additions and 7,069 deletions.
5 changes: 2 additions & 3 deletions Code/Mantid/Build/CMake/LinuxPackageScripts.cmake
Expand Up @@ -82,9 +82,8 @@ set ( PRE_UNINSTALL_FILE ${CMAKE_CURRENT_BINARY_DIR}/prerm )
set ( POST_UNINSTALL_FILE ${CMAKE_CURRENT_BINARY_DIR}/postrm )

if ( "${UNIX_DIST}" MATCHES "RedHatEnterprise" OR "${UNIX_DIST}" MATCHES "^Fedora" ) # RHEL/Fedora
if ( "${UNIX_CODENAME}" MATCHES "Santiago" OR
"${UNIX_CODENAME}" MATCHES "Maipo" )
set ( WRAPPER_PREFIX "scl enable mantidlibs \"" )
if ( "${UNIX_CODENAME}" MATCHES "Santiago" )
set ( WRAPPER_PREFIX "scl enable mantidlibs34 \"" )
set ( WRAPPER_POSTFIX "\"" )
else()
set ( WRAPPER_PREFIX "" )
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Build/Jenkins/buildscript
Expand Up @@ -124,7 +124,7 @@ fi
# RHEL6 setup steps - nodes must have a "rhel6" label set (in lowercase)
###############################################################################
if [[ ${NODE_LABELS} == *rhel6* ]]; then
SCL_ON_RHEL6="scl enable mantidlibs"
SCL_ON_RHEL6="scl enable mantidlibs34"
ON_RHEL6=true
else
SCL_ON_RHEL6="eval"
Expand Down Expand Up @@ -176,7 +176,7 @@ $SCL_ON_RHEL6 "cmake -DCMAKE_BUILD_TYPE=${BUILD_CONFIG} -DENABLE_CPACK=ON -DMAKE
# Coverity build should exit early
###############################################################################
if [[ ${JOB_NAME} == *coverity_build_and_submit* ]]; then
${COVERITY_DIR}/cov-build --dir cov-int scl enable mantidlibs "make -j${BUILD_THREADS}"
${COVERITY_DIR}/cov-build --dir cov-int scl enable mantidlibs34 "make -j${BUILD_THREADS}"
tar czvf mantid.tgz cov-int
status=$(curl --form token=$COVERITY_TOKEN --form email=mantidproject@gmail.com \
--form file=@mantid.tgz --form version=$GIT_COMMIT \
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/Build/Jenkins/jenkins-slave.sh
Expand Up @@ -34,12 +34,14 @@ JAR_FILE=slave.jar
# Some versions of cron don't set the USER environment variable
# required by vnc
[ -z "$USER" ] && export USER=$(whoami)
# Put /usr/local/bin on the PATH if brew is installed
[ -f /usr/local/bin/brew ] && export PATH=${PATH}:/usr/local/bin

#####################################################################
# Script
#####################################################################
# exit if it is already running
RUNNING=$(ps u -u $(whoami) | grep java | grep ${JAR_FILE})
RUNNING=$(ps u -U $(whoami) | grep java | grep ${JAR_FILE})
if [ ! -z "${RUNNING}" ]; then
echo "Slave process is already running"
exit 0
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Build/Jenkins/systemtests
Expand Up @@ -28,7 +28,7 @@ fi
# RHEL6 setup steps - nodes must have a "rhel6" label set (in lowercase)
###############################################################################
if [[ ${NODE_LABELS} == *rhel6* ]]; then
SCL_ON_RHEL6="scl enable mantidlibs"
SCL_ON_RHEL6="scl enable mantidlibs34"
ON_RHEL6=true
else
SCL_ON_RHEL6="eval"
Expand Down
Expand Up @@ -57,8 +57,8 @@ Requires: texlive-was
Requires: tex-preview
Requires: dvipng
%if 0%{?el6}
Requires: mantidlibs-qt-devel
Requires: mantidlibs-qtwebkit-devel
Requires: mantidlibs34-qt-devel
Requires: mantidlibs34-qtwebkit-devel
Requires: scl-utils
%else
Requires: qt-devel
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/CMakeLists.txt
Expand Up @@ -239,7 +239,7 @@ if ( ENABLE_CPACK )
# On RHEL6 we have to use an updated qscintilla to fix an auto complete bug
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla >= 2.4.6" )
# On RHEL6 we are using SCL packages for Qt
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},scl-utils,mantidlibs,mantidlibs-runtime,mantidlibs-qt,mantidlibs-qt-x11" )
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES},scl-utils,mantidlibs34,mantidlibs34-runtime,mantidlibs34-qt,mantidlibs34-qt-x11,mantidlibs34-qt-webkit" )
else()
set ( CPACK_RPM_PACKAGE_REQUIRES "${CPACK_RPM_PACKAGE_REQUIRES} qscintilla" )
endif()
Expand Down Expand Up @@ -268,7 +268,7 @@ if ( ENABLE_CPACK )
"libmuparser0debian1,"
"ipython-qtconsole (>= 1.1),python-matplotlib,python-scipy,"
"libpocofoundation9,libpocoutil9,libpoconet9,libpoconetssl9,libpococrypto9,libpocoxml9")
elseif( "${UNIX_CODENAME}" STREQUAL "trusty" )
elseif( "${UNIX_CODENAME}" STREQUAL "trusty" OR "${UNIX_CODENAME}" STREQUAL "utopic" OR "${UNIX_CODENAME}" STREQUAL "vivid")
list ( APPEND DEPENDS_LIST ",libqscintilla2-11,"
"liboce-foundation8,liboce-modeling8,"
"libmuparser2,"
Expand Down
18 changes: 17 additions & 1 deletion Code/Mantid/Framework/API/test/WorkspaceHistoryIOTest.h
Expand Up @@ -152,11 +152,15 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
testHistory.addHistory(boost::make_shared<AlgorithmHistory>(algHist));
}

// clang-format off
auto savehandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
// clang-format on
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
savehandle->close();

// clang-format off
auto loadhandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
// clang-format on
std::string rootstring = "/process/";
for (int i = 1; i < 5; i++)
{
Expand All @@ -181,11 +185,15 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
algHist.addChildHistory(boost::make_shared<AlgorithmHistory>(childHist));
testHistory.addHistory(boost::make_shared<AlgorithmHistory>(algHist));

// clang-format off
auto savehandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
// clang-format on
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
savehandle->close();

// clang-format off
auto loadhandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
// clang-format on
std::string rootstring = "/process/";
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidAlgorithm_1/"));
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidAlgorithm_1/author"));
Expand All @@ -205,11 +213,15 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
{
WorkspaceHistory testHistory;

// clang-format off
auto savehandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs",NXACC_CREATE5);
// clang-format on
TS_ASSERT_THROWS_NOTHING(testHistory.saveNexus(savehandle.get()));
savehandle->close();

// clang-format off
auto loadhandle = boost::make_shared< ::NeXus::File >("WorkspaceHistoryTest_test_SaveNexus.nxs");
// clang-format on
std::string rootstring = "/process/";
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring));
TS_ASSERT_THROWS_NOTHING(loadhandle->openPath(rootstring + "MantidEnvironment"));
Expand All @@ -222,7 +234,9 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
void test_LoadNexus()
{
std::string filename = FileFinder::Instance().getFullPath("GEM38370_Focussed_Legacy.nxs");
// clang-format off
auto loadhandle = boost::make_shared< ::NeXus::File >(filename);
// clang-format on
loadhandle->openPath("/mantid_workspace_1");

WorkspaceHistory emptyHistory;
Expand All @@ -243,7 +257,9 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
void test_LoadNexus_NestedHistory()
{
std::string filename = FileFinder::Instance().getFullPath("HistoryTest_CreateTransmissionAuto.nxs");
// clang-format off
auto loadhandle = boost::make_shared< ::NeXus::File >(filename);
// clang-format on
loadhandle->openPath("/mantid_workspace_1");

WorkspaceHistory wsHistory;
Expand Down Expand Up @@ -368,4 +384,4 @@ class WorkspaceHistoryIOTest : public CxxTest::TestSuite
}
};

#endif
#endif
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/Algorithms/CMakeLists.txt
Expand Up @@ -52,6 +52,7 @@ set ( SRC_FILES
src/ConvertToMatrixWorkspace.cpp
src/ConvertToPointData.cpp
src/ConvertUnits.cpp
src/ConvertUnitsUsingDetectorTable.cpp
src/CopyDetectorMapping.cpp
src/CopyInstrumentParameters.cpp
src/CopyLogs.cpp
Expand Down Expand Up @@ -311,6 +312,7 @@ set ( INC_FILES
inc/MantidAlgorithms/ConvertToMatrixWorkspace.h
inc/MantidAlgorithms/ConvertToPointData.h
inc/MantidAlgorithms/ConvertUnits.h
inc/MantidAlgorithms/ConvertUnitsUsingDetectorTable.h
inc/MantidAlgorithms/CopyDetectorMapping.h
inc/MantidAlgorithms/CopyInstrumentParameters.h
inc/MantidAlgorithms/CopyLogs.h
Expand Down Expand Up @@ -581,6 +583,7 @@ set ( TEST_FILES
ConvertToMatrixWorkspaceTest.h
ConvertToPointDataTest.h
ConvertUnitsTest.h
ConvertUnitsUsingDetectorTableTest.h
CopyDetectorMappingTest.h
CopyInstrumentParametersTest.h
CopyLogsTest.h
Expand Down
@@ -0,0 +1,83 @@
#ifndef MANTID_ALGORITHMS_CONVERTUNITSUSINGDETECTORTABLE_H_
#define MANTID_ALGORITHMS_CONVERTUNITSUSINGDETECTORTABLE_H_

#include "MantidKernel/System.h"
#include "MantidAPI/Algorithm.h"

namespace Mantid
{
namespace Algorithms
{

/** ConvertUnitsUsingDetectorTable : Converts the units in which a workspace is represented.
Copyright &copy; 2015 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport ConvertUnitsUsingDetectorTable : public API::Algorithm
{
public:
ConvertUnitsUsingDetectorTable();
virtual ~ConvertUnitsUsingDetectorTable();

virtual const std::string name() const;
virtual int version() const;
virtual const std::string category() const;
virtual const std::string summary() const;

private:
void init();
void exec();

void setupMemberVariables(const API::MatrixWorkspace_const_sptr inputWS);
API::MatrixWorkspace_sptr setupOutputWorkspace(const API::MatrixWorkspace_const_sptr inputWS);
void fillOutputHist(const API::MatrixWorkspace_const_sptr inputWS, const API::MatrixWorkspace_sptr outputWS);

void putBackBinWidth(const API::MatrixWorkspace_sptr outputWS);


/// Convert the workspace units according to a simple output = a * (input^b) relationship
void convertQuickly(API::MatrixWorkspace_sptr outputWS, const double& factor, const double& power);
/// Convert the workspace units using TOF as an intermediate step in the conversion
void convertViaTOF(Kernel::Unit_const_sptr fromUnit, API::MatrixWorkspace_sptr outputWS);

// Calls Rebin as a Child Algorithm to align the bins of the output workspace
API::MatrixWorkspace_sptr alignBins(const API::MatrixWorkspace_sptr workspace);
const std::vector<double> calculateRebinParams(const API::MatrixWorkspace_const_sptr workspace) const;

/// Reverses the workspace if X values are in descending order
void reverse(API::MatrixWorkspace_sptr workspace);

/// For conversions to energy transfer, removes bins corresponding to inaccessible values
API::MatrixWorkspace_sptr removeUnphysicalBins(const API::MatrixWorkspace_const_sptr workspace);

std::size_t m_numberOfSpectra; ///< The number of spectra in the input workspace
bool m_distribution; ///< Whether input is a distribution. Only applies to histogram workspaces.
bool m_inputEvents; ///< Flag indicating whether input workspace is an EventWorkspace
Kernel::Unit_const_sptr m_inputUnit; ///< The unit of the input workspace
Kernel::Unit_sptr m_outputUnit; ///< The unit we're going to

};


} // namespace Algorithms
} // namespace Mantid

#endif /* MANTID_ALGORITHMS_CONVERTUNITSUSINGDETECTORTABLE_H_ */
Expand Up @@ -84,8 +84,6 @@ class DLLExport PlotAsymmetryByLogValue : public API::Algorithm {
void doAnalysis (API::Workspace_sptr loadedWs, int64_t index);
// Parse run names
void parseRunNames (std::string& firstFN, std::string& lastFN, std::string& fnBase, std::string& fnExt, int& fnZeros);
// Resize vectors
void resizeVectors (size_t size);
// Load dead-time corrections from specified file
void loadCorrectionsFromFile (API::Workspace_sptr &customDeadTimes, std::string deadTimeFile );
// Apply dead-time corrections
Expand All @@ -102,40 +100,60 @@ class DLLExport PlotAsymmetryByLogValue : public API::Algorithm {
double getLogValue(API::MatrixWorkspace &ws);
/// Populate output workspace with results
void populateOutputWorkspace (API::MatrixWorkspace_sptr &outWS, int nplots);
/// Check input properties
void checkProperties (size_t &is, size_t &ie);
/// Clear previous results
void clearResultsFromTo (size_t is, size_t ie);

/// Stores base name shared by all runs
std::string m_filenameBase;
static std::string g_filenameBase;
/// Stores extension shared by all runs
std::string m_filenameExt;
static std::string g_filenameExt;
/// Sotres number of zeros in run name
int m_filenameZeros;
static int g_filenameZeros;
/// Stores property "Int"
bool m_int;
/// Store forward spectra
std::vector<int> m_forward_list;
static std::vector<int> g_forward_list;
/// Store backward spectra
std::vector<int> m_backward_list;
static std::vector<int> g_backward_list;
/// If true call LoadMuonNexus with Autogroup on
bool m_autogroup;
/// Store type of dead time corrections
std::string m_dtcType;
static std::string g_dtcType;
/// File to read corrections from
static std::string g_dtcFile;
/// Store red period
int m_red;
static int g_red;
/// Store green period
int m_green;
static int g_green;
// Mantid vectors to store results
// Red mantid vectors
MantidVec m_redX, m_redY, m_redE;
static std::map<int64_t, double> g_redX;
static std::map<int64_t, double> g_redY;
static std::map<int64_t, double> g_redE;
// Green mantid vectors
MantidVec m_greenX, m_greenY, m_greenE;
static std::map<int64_t, double> g_greenX;
static std::map<int64_t, double> g_greenY;
static std::map<int64_t, double> g_greenE;
// Mantid vectors to store Red + Green
MantidVec m_sumX, m_sumY, m_sumE;
static std::map<int64_t, double> g_sumX;
static std::map<int64_t, double> g_sumY;
static std::map<int64_t, double> g_sumE;
// Mantid vectors to store Red - Green
MantidVec m_diffX, m_diffY, m_diffE;
static std::map<int64_t, double> g_diffX;
static std::map<int64_t, double> g_diffY;
static std::map<int64_t, double> g_diffE;
// LogValue name
std::string m_logName;
static std::string g_logName;
// LogValue function
std::string m_logFunc;
static std::string g_logFunc;
// Type of computation: integral or differential
static std::string g_stype;
// Minimum time for the analysis
static double g_minTime;
// Maximum time for the analysis
static double g_maxTime;
};

} // namespace Algorithm
Expand Down

0 comments on commit 349d1bd

Please sign in to comment.