Skip to content

Commit

Permalink
Solving conflicts. Refs #10945
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/master' into feature/10945_pylintwarnings

Conflicts:
	Code/Mantid/scripts/Inelastic/Direct/DirectEnergyConversion.py
	Code/Mantid/scripts/Inelastic/Direct/ReductionHelpers.py
	Code/Mantid/scripts/Inelastic/Direct/ReductionWrapper.py
	Code/Mantid/scripts/Inelastic/Direct/dgreduce.py
	Code/Mantid/scripts/Inelastic/DirectPropertyManager.py
	Code/Mantid/scripts/Inelastic/DirectReductionProperties.py
  • Loading branch information
AndreiSavici committed Jan 26, 2015
2 parents 78607de + c7e45c9 commit 1ce8449
Show file tree
Hide file tree
Showing 94 changed files with 4,922 additions and 3,517 deletions.
49 changes: 28 additions & 21 deletions Code/Mantid/Build/Jenkins/buildscript
Expand Up @@ -15,28 +15,35 @@
cmake --version
echo "SHA1=${sha1}"

if [[ ${JOB_NAME} == *clang* ]]; then
# Assuming we are using the clang compiler
echo "Using clang/llvm compiler."
clang --version
export CC=clang
export CXX=clang++
COMPILERFILEPATH=`grep 'CMAKE_CXX_COMPILER:FILEPATH' $WORKSPACE/build/CMakeCache.txt`
if [[ $COMPILERFILEPATH != *clang++* ]]; then
# Removing the build directory entirely guarantees clang is used.
rm -rf $WORKSPACE/build
fi
fi

###############################################################################
# OS X setup steps
###############################################################################
if [[ $(uname) == 'Darwin' ]]; then
if [[ ${JOB_NAME} == *clang* ]]; then
# Assuming we are using the clang compiler
echo "Using clang/llvm compiler."
clang --version
else
# Assuming we are using the Intel compiler
cd $WORKSPACE/Code
./fetch_Third_Party.sh
cd $WORKSPACE
# Setup environment variables
source /opt/intel/bin/iccvars.sh intel64
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$WORKSPACE/Code/Third_Party/lib/mac64:/Library/Frameworks
# Make sure we pick up the Intel compiler
export CC=icc
export CXX=icpc
echo "Using Intel compiler."
icpc --version
fi
# OS X 10.8 setup steps
###############################################################################
if [[ $(uname) == 'Darwin' ]] && [[ ${JOB_NAME} != *clang* ]]; then
# Assuming we are using the Intel compiler
cd $WORKSPACE/Code
./fetch_Third_Party.sh
cd $WORKSPACE
# Setup environment variables
source /opt/intel/bin/iccvars.sh intel64
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$WORKSPACE/Code/Third_Party/lib/mac64:/Library/Frameworks
# Make sure we pick up the Intel compiler
export CC=icc
export CXX=icpc
echo "Using Intel compiler."
icpc --version
fi

###############################################################################
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Build/dev-packages/deb/mantid-developer/README
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.2"
* A file called mantid-developer-1.2.2.deb will appear in the current directory.
* Run "dpkg --build mantid-developer-1.2.3"
* A file called mantid-developer-1.2.3.deb will appear in the current directory.
@@ -0,0 +1,13 @@
Package: mantid-developer
Version: 1.2.3
Section: main
Priority: optional
Architecture: all
Depends: git, clang, 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
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/Algorithms/CMakeLists.txt
Expand Up @@ -203,6 +203,7 @@ set ( SRC_FILES
src/ResetNegatives.cpp
src/ResizeRectangularDetector.cpp
src/RingProfile.cpp
src/RRFMuon.cpp
src/SANSDirectBeamScaling.cpp
src/SassenaFFT.cpp
src/SaveGSASInstrumentFile.cpp
Expand Down Expand Up @@ -456,6 +457,7 @@ set ( INC_FILES
inc/MantidAlgorithms/ResetNegatives.h
inc/MantidAlgorithms/ResizeRectangularDetector.h
inc/MantidAlgorithms/RingProfile.h
inc/MantidAlgorithms/RRFMuon.h
inc/MantidAlgorithms/SANSDirectBeamScaling.h
inc/MantidAlgorithms/SassenaFFT.h
inc/MantidAlgorithms/SaveGSASInstrumentFile.h
Expand Down Expand Up @@ -703,6 +705,7 @@ set ( TEST_FILES
ResetNegativesTest.h
ResizeRectangularDetectorTest.h
RingProfileTest.h
RRFMuonTest.h
SassenaFFTTest.h
SaveGSASInstrumentFileTest.h
ScaleTest.h
Expand Down
77 changes: 77 additions & 0 deletions Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/RRFMuon.h
@@ -0,0 +1,77 @@
#ifndef MANTID_ALGORITHM_RRFMUON_H_
#define MANTID_ALGORITHM_RRFMUON_H_

//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAPI/Algorithm.h"
#include <gsl/gsl_errno.h>
#include <gsl/gsl_fft_complex.h>

namespace Mantid
{
namespace Algorithms
{
/**Algorithm for calculating Muon decay envelope.
@author Raquel Alvarez, ISIS, RAL
@date 5/12/2014
Copyright &copy; 2014-12 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
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 RRFMuon : public API::Algorithm
{
public:
/// Default constructor
RRFMuon() {};
/// Destructor
virtual ~RRFMuon() {};
/// Algorithm's name for identification overriding a virtual method
virtual const std::string name() const { return "RRFMuon";}
///Summary of algorithm's purpose
virtual const std::string summary() const {return "Calculate Muon polarization in the rotating reference frame (RRF).";}

/// Algorithm's version for identification overriding a virtual method
virtual int version() const { return 1;}
/// Algorithm's category for identification overriding a virtual method
virtual const std::string category() const { return "Muon";}

private:

/// Initialise the properties
void init();
/// Run the algorithm
void exec();

/// Frequency of the oscillations
double m_freq;
/// Phase accounting for any misalignment of the counters
double m_phase;
/// Number of data points per histogram
size_t m_nData;
/// Number of histograms
size_t m_nHisto;
};

} // namespace Algorithms
} // namespace Mantid

#endif /*MANTID_ALGORITHM_RRFMUON_H_*/
96 changes: 96 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/RRFMuon.cpp
@@ -0,0 +1,96 @@
//----------------------------------------------------------------------
// Includes
//----------------------------------------------------------------------
#include "MantidAlgorithms/RRFMuon.h"
#include "MantidKernel/ArrayProperty.h"
#include <boost/shared_array.hpp>

#define REAL(z,i) ((z)[2*(i)])
#define IMAG(z,i) ((z)[2*(i)+1])

namespace Mantid
{
namespace Algorithms
{

using namespace Kernel;
using API::Progress;

// Register the class into the algorithm factory
DECLARE_ALGORITHM(RRFMuon)

/** Initialisation method. Declares properties to be used in algorithm.
*
*/
void RRFMuon::init()
{

declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("InputWorkspace", "", Direction::Input),
"Name of the input workspace containing the spectra in the lab frame");

declareProperty(new API::WorkspaceProperty<API::MatrixWorkspace>("OutputWorkspace", "", Direction::Output),
"Name of the output workspace containing the spectra in the RRF" );

declareProperty(new PropertyWithValue<double>("Frequency", 0, Direction::Input),
"Frequency of the oscillations");

declareProperty(new PropertyWithValue<double>("Phase", 0, Direction::Input),
"Phase accounting for any misalignment of the counters");

}

/** Executes the algorithm
*
*/
void RRFMuon::exec()
{
// Get input workspace containing polarization in the lab-frame
API::MatrixWorkspace_sptr inputWs = getProperty("InputWorkspace");
// Get frequency
m_freq = getProperty("Frequency");
// Get phase
m_phase = getProperty("Phase");
// Get number of histograms
m_nHisto = inputWs->getNumberHistograms();
if ( m_nHisto != 2 )
{
throw std::runtime_error("Invalid number of spectra in input workspace");
}
// Set number of data points
m_nData = inputWs->blocksize();

// Compute the RRF polarization
const double twoPiFreq = 2. * M_PI * m_freq;
MantidVec time = inputWs->readX(0); // X axis: time
MantidVec labRe = inputWs->readY(0); // Lab-frame polarization (real part)
MantidVec labIm = inputWs->readY(1); // Lab-frame polarization (imaginary part)
MantidVec rrfRe(m_nData), rrfIm(m_nData); // Rotating Reference frame (RRF) polarizations
for (size_t t=0; t<m_nData; t++)
{
rrfRe [t] = labRe [t] * cos(twoPiFreq * time[t] + m_phase) + labIm [t] * sin(twoPiFreq * time[t] + m_phase);
rrfIm [t] = -labRe [t] * sin(twoPiFreq * time[t] + m_phase) + labIm [t] * cos(twoPiFreq * time[t] + m_phase);
}

// Create output workspace to put results into
API::MatrixWorkspace_sptr outputWs = boost::dynamic_pointer_cast<API::MatrixWorkspace>(
API::WorkspaceFactory::Instance().create("Workspace2D", m_nHisto, m_nData+1, m_nData));
outputWs->getAxis(0)->unit() = inputWs->getAxis(0)->unit();

// Put results into output workspace
// Real RRF polarization
outputWs->getSpectrum(0)->setSpectrumNo(1);
outputWs->dataX(0) = inputWs->readX(0);
outputWs->dataY(0) = rrfRe;
// Imaginary RRF polarization
outputWs->getSpectrum(1)->setSpectrumNo(2);
outputWs->dataX(1) = inputWs->readX(1);
outputWs->dataY(1) = rrfIm;

// Set output workspace
setProperty("OutputWorkspace", outputWs);

}


}
}

0 comments on commit 1ce8449

Please sign in to comment.