Skip to content

Commit

Permalink
Merge branch 'master' into feature/10855_rewrite_indirect_diffraction…
Browse files Browse the repository at this point in the history
…_reduction

Refs #10855
  • Loading branch information
DanNixon committed Feb 20, 2015
2 parents 4344b3f + a2f3876 commit c8a3e55
Show file tree
Hide file tree
Showing 423 changed files with 13,948 additions and 7,141 deletions.
4 changes: 4 additions & 0 deletions Code/Mantid/Build/CMake/LinuxPackageScripts.cmake
Expand Up @@ -22,6 +22,10 @@ endif()

set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${LIB_DIR};${CMAKE_INSTALL_PREFIX}/${PLUGINS_DIR};${CMAKE_INSTALL_PREFIX}/${PVPLUGINS_DIR} )

# Tell rpm that this package does not own /opt /usr/share/{applications,pixmaps}
# Required for Fedora >= 18 and RHEL >= 7
set ( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /opt /usr/share/applications /usr/share/pixmaps )

###########################################################################
# LD_PRELOAD TCMalloc
###########################################################################
Expand Down
4 changes: 3 additions & 1 deletion Code/Mantid/Build/Jenkins/jenkins-slave.sh
Expand Up @@ -7,7 +7,9 @@
# The settings at the top must be filled in for each slave.
#####################################################################
# Crontab setting should be something like
# 0,30 * * * * /home/builder/jenkins-linode nodename secret
# 0,30 * * * * /home/builder/jenkins-linode/jenkins-slave.sh nodename secret
# or (on mac)
# 0,30 * * * * /Users/builder/jenkins-linode/jenkins-slave.sh nodename secret
#####################################################################
# User configuration
#####################################################################
Expand Down
Expand Up @@ -3,7 +3,7 @@ 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
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, python-sphinx-bootstrap-theme
Installed-Size: 0
Maintainer: Mantid Project <mantid-help@mantidproject.org>
Description: Installs all packages required for a Mantid developer
Expand Down
Expand Up @@ -3,7 +3,7 @@ Version: 1.2.4
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, graphviz
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, python-sphinx-bootstrap-theme, graphviz
Installed-Size: 0
Maintainer: Mantid Project <mantid-help@mantidproject.org>
Description: Installs all packages required for a Mantid developer
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/CMakeLists.txt
Expand Up @@ -93,6 +93,7 @@ set ( SRC_FILES
src/ParamFunction.cpp
src/ParameterReference.cpp
src/ParameterTie.cpp
src/PeakFunctionIntegrator.cpp
src/PeakTransform.cpp
src/PeakTransformHKL.cpp
src/PeakTransformQLab.cpp
Expand Down Expand Up @@ -252,6 +253,7 @@ set ( INC_FILES
inc/MantidAPI/ParamFunction.h
inc/MantidAPI/ParameterReference.h
inc/MantidAPI/ParameterTie.h
inc/MantidAPI/PeakFunctionIntegrator.h
inc/MantidAPI/PeakTransform.h
inc/MantidAPI/PeakTransformFactory.h
inc/MantidAPI/PeakTransformHKL.h
Expand Down Expand Up @@ -348,6 +350,7 @@ set ( TEST_FILES
ParamFunctionAttributeHolderTest.h
ParameterReferenceTest.h
ParameterTieTest.h
PeakFunctionIntegratorTest.h
PeakTransformHKLTest.h
PeakTransformQLabTest.h
PeakTransformQSampleTest.h
Expand Down
5 changes: 3 additions & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeak.h
Expand Up @@ -7,6 +7,7 @@
#include "MantidKernel/Matrix.h"
#include "MantidKernel/V3D.h"
#include "MantidKernel/PhysicalConstants.h"
#include <boost/optional.hpp>

namespace Mantid {
namespace API {
Expand Down Expand Up @@ -50,9 +51,9 @@ class MANTID_API_DLL IPeak {
virtual bool findDetector() = 0;

virtual void setQSampleFrame(Mantid::Kernel::V3D QSampleFrame,
double detectorDistance = 1.0) = 0;
boost::optional<double> detectorDistance) = 0;
virtual void setQLabFrame(Mantid::Kernel::V3D QLabFrame,
double detectorDistance = 1.0) = 0;
boost::optional<double> detectorDistance) = 0;

virtual void setWavelength(double wavelength) = 0;
virtual double getWavelength() const = 0;
Expand Down
6 changes: 6 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeakFunction.h
Expand Up @@ -49,6 +49,12 @@ class MANTID_API_DLL IPeakFunction : public IFunctionWithLocation {
/// Sets the parameters such that FWHM = w
virtual void setFwhm(const double w) = 0;

/// Returns the integral intensity of the peak
virtual double intensity() const;

/// Sets the integral intensity of the peak
virtual void setIntensity(const double newIntensity);

/// General implementation of the method for all peaks.
void function1D(double *out, const double *xValues, const size_t nData) const;
/// General implementation of the method for all peaks.
Expand Down
15 changes: 12 additions & 3 deletions Code/Mantid/Framework/API/inc/MantidAPI/IPeaksWorkspace.h
Expand Up @@ -7,6 +7,7 @@
#include "MantidAPI/ITableWorkspace.h"
#include "MantidAPI/ExperimentInfo.h"
#include "MantidKernel/SpecialCoordinateSystem.h"
#include <boost/optional.hpp>

namespace Mantid {

Expand Down Expand Up @@ -98,12 +99,20 @@ class MANTID_API_DLL IPeaksWorkspace : public ITableWorkspace,

//---------------------------------------------------------------------------------------------
/** Create an instance of a Peak
* @param QLabFrame :: Q of the center of the peak, in reciprocal space
* @param detectorDistance :: distance between the sample and the detector.
* @param QLabFrame :: Q of the center of the peak in the lab frame, in reciprocal space
* @param detectorDistance :: Optional distance between the sample and the detector. Calculated if not provided.
* @return a pointer to a new Peak object.
*/
virtual IPeak *createPeak(Mantid::Kernel::V3D QLabFrame,
double detectorDistance = 1.0) const = 0;
boost::optional<double> detectorDistance) const = 0;


/**
* Create an instance of a peak using a V3D
* @param HKL V3D
* @return a pointer to a new Peak object.
*/
virtual IPeak *createPeakHKL(Mantid::Kernel::V3D HKL) const = 0;

//---------------------------------------------------------------------------------------------
/** Determine if the workspace has been integrated using a peaks integration
Expand Down
@@ -1,22 +1,25 @@
#ifndef PEAKFUNCTIONINTEGRATOR_H
#define PEAKFUNCTIONINTEGRATOR_H

#include "MantidSINQ/DllConfig.h"
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/IPeakFunction.h"
#include "gsl/gsl_integration.h"

namespace Mantid {
namespace Poldi {
namespace API {

/** PeakFunctionIntegrator :
*
General integration of peaks (in the form of IPeakFunction) by wrapping the
corresponding GSL-functions. Integration with infinity limits is supported.
PeakFunctionIntegrator allocates a GSL integration workspace on construction
and frees the memory when it's destroyed.
@author Michael Wedel, Paul Scherrer Institut - SINQ
@date 24/04/2014
Copyright © 2014 PSI-MSS
Copyright © 2014,2015 PSI-MSS
This file is part of Mantid.
Expand All @@ -37,7 +40,7 @@ namespace Poldi {
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/

struct MANTID_SINQ_DLL IntegrationResult {
struct MANTID_API_DLL IntegrationResult {
double result;
double error;
size_t intervals;
Expand All @@ -46,7 +49,7 @@ struct MANTID_SINQ_DLL IntegrationResult {
bool success;
};

class MANTID_SINQ_DLL PeakFunctionIntegrator {
class MANTID_API_DLL PeakFunctionIntegrator {
public:
PeakFunctionIntegrator(double requiredRelativePrecision = 1e-8);
virtual ~PeakFunctionIntegrator();
Expand All @@ -55,27 +58,26 @@ class MANTID_SINQ_DLL PeakFunctionIntegrator {
double requiredRelativePrecision() const;

IntegrationResult
integrateInfinity(API::IPeakFunction_const_sptr peakFunction) const;
integrateInfinity(const IPeakFunction &peakFunction) const;
IntegrationResult
integratePositiveInfinity(API::IPeakFunction_const_sptr peakFunction,
integratePositiveInfinity(const IPeakFunction &peakFunction,
double lowerLimit) const;
IntegrationResult
integrateNegativeInfinity(API::IPeakFunction_const_sptr peakFunction,
integrateNegativeInfinity(const IPeakFunction &peakFunction,
double upperLimit) const;

IntegrationResult integrate(API::IPeakFunction_const_sptr peakFunction,
IntegrationResult integrate(const IPeakFunction &peakFunction,
double lowerLimit, double upperLimit) const;

protected:
gsl_function getGSLFunction(API::IPeakFunction_const_sptr peakFunction) const;
void throwIfInvalid(API::IPeakFunction_const_sptr peakFunction) const;
gsl_function getGSLFunction(const IPeakFunction &peakFunction) const;

gsl_integration_workspace *m_integrationWorkspace;

double m_relativePrecision;
};

double MANTID_SINQ_DLL gsl_peak_wrapper(double x, void *parameters);
double MANTID_API_DLL gsl_peak_wrapper(double x, void *parameters);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/src/Algorithm.cpp
Expand Up @@ -1164,7 +1164,7 @@ bool Algorithm::checkGroups() {
// Workspace groups are NOT returned by IWP->getWorkspace() most of the time
// because WorkspaceProperty is templated by <MatrixWorkspace>
// and WorkspaceGroup does not subclass <MatrixWorkspace>
if (!wsGroup && !prop->value().empty()) {
if (!wsGroup && prop && !prop->value().empty()) {
// So try to use the name in the AnalysisDataService
try {
wsGroup = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(
Expand Down
39 changes: 39 additions & 0 deletions Code/Mantid/Framework/API/src/IPeakFunction.cpp
Expand Up @@ -3,6 +3,7 @@
//----------------------------------------------------------------------
#include "MantidAPI/IPeakFunction.h"
#include "MantidAPI/Jacobian.h"
#include "MantidAPI/PeakFunctionIntegrator.h"
#include "MantidKernel/Exception.h"
#include "MantidKernel/ConfigService.h"

Expand Down Expand Up @@ -130,5 +131,43 @@ void IPeakFunction::setPeakRadius(const int &r) {
}
}

/// Returns the integral intensity of the peak function, using the peak radius
/// to determine integration borders.
double IPeakFunction::intensity() const {
double x0 = centre();
double dx = fabs(s_peakRadius * fwhm());

PeakFunctionIntegrator integrator;
IntegrationResult result = integrator.integrate(*this, x0 - dx, x0 + dx);

if (!result.success) {
return 0.0;
}

return result.result;
}

/// Sets the integral intensity of the peak by adjusting the height.
void IPeakFunction::setIntensity(const double newIntensity) {
double currentHeight = height();
double currentIntensity = intensity();

if (currentIntensity == 0.0) {
// Try to set a different height first.
setHeight(2.0);

currentHeight = height();
currentIntensity = intensity();

// If the current intensity is still 0, there's nothing left to do.
if (currentIntensity == 0.0) {
throw std::invalid_argument(
"Cannot set new intensity, not enough information available.");
}
}

setHeight(newIntensity / currentIntensity * currentHeight);
}

} // namespace API
} // namespace Mantid

0 comments on commit c8a3e55

Please sign in to comment.