Skip to content

Commit

Permalink
Merge 'origin/master' into feature/8538_icat_publish_dois. Refs #8538.
Browse files Browse the repository at this point in the history
Conflicts:

- Code/Mantid/Framework/ICat/src/ICat4/ICat4Catalog.cpp
  • Loading branch information
jawrainey committed May 6, 2014
2 parents 0f951ee + d49a5d4 commit 4b1e897
Show file tree
Hide file tree
Showing 178 changed files with 8,675 additions and 2,610 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The [developer documentation](http://www.mantidproject.org/Category:Development) has information on how to participate in the mantid project as a developer. This document is meant to outline the steps for contributing to mantid without becomming a developer.

1. Fork the repository.
1. [Fork](https://help.github.com/articles/fork-a-repo) the repository.
2. Make changes as you see fit. Please still follow the guidelines for [running the unit tests](http://www.mantidproject.org/Running_the_unit_tests) and the [build servers](http://www.mantidproject.org/The_automated_build_process).
3. Before submitting pull requests email mantid-help@mantidproject.org, and a developer will set up a branch that you can submit pull requests to.
4. Submit a [pull request](https://help.github.com/articles/using-pull-requests) to this branch.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: mantid-developer
Version: 1.3
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Meta Package to install dependencies for Mantid Development

Group: Development/Tools
Expand Down Expand Up @@ -40,6 +40,9 @@ Requires: sip-devel
Requires: git
Requires: openssl-devel
Requires: texlive-latex
Requires: texlive-latex-bin
Requires: texlive-was
Requires: tex-preview
Requires: dvipng
Requires: qt-devel
Requires: qt-assistant
Expand All @@ -66,6 +69,9 @@ required for Mantid development.
%files

%changelog
* Fri Apr 25 2014 Michael Reuter <reuterma@ornl.gov>
- Added texlive-latex-bin, texlive-was, tex-preview

* Thu Apr 10 2014 Peter Peterson <petersonpf@ornl.gov>
- Added qtwebkit-devel

Expand Down
24 changes: 17 additions & 7 deletions Code/Mantid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,28 @@ if ( ENABLE_CPACK )
endif ( ${UNIX_DIST} MATCHES "RedHatEnterprise" )

if( ${UNIX_DIST} STREQUAL "Ubuntu" )
# common packages
set ( DEPENDS_LIST "libboost-date-time${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-regex${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libboost-python${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION},"
"libpocofoundation9,libpocoutil9,libpoconet9,libpoconetssl9,libpococrypto9,libpocoxml9,"
"libnexus0 (>= 4.3),libgsl0ldbl,libqtcore4 (>= 4.2),libqtgui4 (>= 4.2),libqt4-opengl (>= 4.2),"
"libqt4-xml (>= 4.2),libqt4-svg (>= 4.2),libqt4-qt3support (>= 4.2),qt4-dev-tools,"
"libqwt5-qt4,libqwtplot3d-qt4-0,python-numpy,python-sip,python-qt4" )
if( ${UNIX_CODENAME} STREQUAL "lucid" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-date-time1.40.0,libboost-regex1.40.0,libpocofoundation9,libpocoutil9,libpoconet9,libpoconetssl9,libpococrypto9,libpocoxml9,libnexus0 (>= 4.3),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" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libopencascade-foundation-6.3.0 (>= 6.3.0),libopencascade-modeling-6.3.0 (>= 6.3.0),libmuparser0,python-numpy,python-sip,python-qt4,libboost-python${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" )
list ( APPEND DEPENDS_LIST ",libqscintilla2-5,"
"libopencascade-foundation-6.3.0 (>= 6.3.0),libopencascade-modeling-6.3.0 (>= 6.3.0),"
"libmuparser0" )
elseif( ${UNIX_CODENAME} STREQUAL "precise" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-date-time1.46.1,libboost-regex1.46.1,libpocofoundation9,libpocoutil9,libpoconet9,libpoconetssl9,libpococrypto9,libpocoxml9,libnexus0 (>= 4.3),python-nxs (>= 4.3),libgsl0ldbl,libqtcore4 (>= 4.2),libqtgui4 (>= 4.2),libqt4-opengl (>= 4.2),libqt4-xml (>= 4.2),libqt4-svg (>= 4.2),libqt4-qt3support (>= 4.2),libqscintilla2-8,libqwt5-qt4,libqwtplot3d-qt4-0" )
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},libopencascade-foundation-6.5.0 (>= 6.5.0),libopencascade-modeling-6.5.0 (>= 6.5.0),libmuparser0debian1,python-numpy,python-sip,python-qt4,libboost-python${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" )
# scipy, matplotlib & ipython
set ( CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS},ipython-qtconsole (>= 1.1),python-matplotlib,python-scipy" )
list ( APPEND DEPENDS_LIST ",libqscintilla2-8,"
"libopencascade-foundation-6.5.0 (>= 6.5.0),libopencascade-modeling-6.5.0 (>= 6.5.0),"
"libmuparser0debian1,"
"ipython-qtconsole (>= 1.1),python-matplotlib,python-scipy" )
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
# parse list to string required for deb package
string ( REPLACE ";" "" CPACK_DEBIAN_PACKAGE_DEPENDS ${DEPENDS_LIST} )
endif()
# soft requirement of tcmalloc - if built with it, then require it
IF ( USE_TCMALLOC AND TCMALLOC_FOUND )
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ set ( INC_FILES
inc/MantidAPI/IFunction1D.h
inc/MantidAPI/IFunctionMD.h
inc/MantidAPI/IFunctionMW.h
inc/MantidAPI/IFunctionValues.h
inc/MantidAPI/IFunctionWithLocation.h
inc/MantidAPI/ILiveListener.h
inc/MantidAPI/IMDEventWorkspace.h
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/Axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ class MANTID_API_DLL Axis
/// @param index :: The index
/// @param value :: The new value
virtual void setValue(const std::size_t& index, const double& value) = 0;
/// Find the index of the given double value
virtual size_t indexOfValue(const double value) const = 0;

/// Get the spectrum index
virtual specid_t spectraNo(const std::size_t& index) const;

Expand Down
3 changes: 1 addition & 2 deletions Code/Mantid/Framework/API/inc/MantidAPI/FunctionValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
//----------------------------------------------------------------------
#include "MantidAPI/DllConfig.h"
#include "MantidAPI/FunctionDomain.h"
#include "MantidAPI/IFunctionValues.h"

#include <vector>

Expand Down Expand Up @@ -40,7 +39,7 @@ namespace API
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class MANTID_API_DLL FunctionValues: public IFunctionValues
class MANTID_API_DLL FunctionValues
{
public:
/// Default constructor.
Expand Down
7 changes: 3 additions & 4 deletions Code/Mantid/Framework/API/inc/MantidAPI/IDomainCreator.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace Mantid
namespace API
{
class FunctionDomain;
class IFunctionValues;
class FunctionValues;
class Workspace;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ namespace Mantid
/// for the data from index i0 to the end of the container.
virtual void createDomain(
boost::shared_ptr<API::FunctionDomain>& domain,
boost::shared_ptr<API::IFunctionValues>& values,
boost::shared_ptr<API::FunctionValues>& values,
size_t i0 = 0) = 0;

/// Create an output workspace filled with data simulated with the fitting function.
Expand All @@ -97,14 +97,13 @@ namespace Mantid
const std::string& baseName,
API::IFunction_sptr function,
boost::shared_ptr<API::FunctionDomain> domain,
boost::shared_ptr<API::IFunctionValues> values,
boost::shared_ptr<API::FunctionValues> values,
const std::string& outputWorkspacePropertyName = "OutputWorkspace"
)
{
UNUSED_ARG(baseName);UNUSED_ARG(function);UNUSED_ARG(domain);UNUSED_ARG(values);UNUSED_ARG(outputWorkspacePropertyName);
throw std::logic_error("Method createOutputWorkspace() isn't implemented");
}

/// Initialize the function
/// @param function :: A function to initialize.
virtual void initFunction(API::IFunction_sptr function);
Expand Down
14 changes: 13 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/IFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class MANTID_API_DLL IFunction
//---------------------------------------------------------//

/// Constructor
IFunction():m_isParallel(false),m_handler(NULL), m_progReporter(NULL) {}
IFunction():m_isParallel(false),m_handler(NULL), m_progReporter(NULL), m_chiSquared(0.0) {}
/// Virtual destructor
virtual ~IFunction();

Expand Down Expand Up @@ -433,6 +433,14 @@ class MANTID_API_DLL IFunction

/// Calculate numerical derivatives
void calNumericalDeriv(const FunctionDomain& domain, Jacobian& out);
/// Set the covariance matrix
void setCovarianceMatrix(boost::shared_ptr<Kernel::Matrix<double>> covar);
/// Get the covariance matrix
boost::shared_ptr<const Kernel::Matrix<double>> getCovarianceMatrix()const{return m_covar;}
/// Set the chi^2
void setChiSquared(double chi2) {m_chiSquared = chi2;}
/// Get the chi^2
double getChiSquared() const {return m_chiSquared;}

/// Set the parallel hint
void setParallel(bool on) {m_isParallel = on;}
Expand Down Expand Up @@ -488,6 +496,10 @@ class MANTID_API_DLL IFunction
private:
/// The declared attributes
std::map<std::string, API::IFunction::Attribute> m_attrs;
/// The covariance matrix of the fitting parameters
boost::shared_ptr<Kernel::Matrix<double>> m_covar;
/// The chi-squared of the last fit
double m_chiSquared;
};

///shared pointer to the function base class
Expand Down
74 changes: 0 additions & 74 deletions Code/Mantid/Framework/API/inc/MantidAPI/IFunctionValues.h

This file was deleted.

1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/NumericAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class MANTID_API_DLL NumericAxis: public Axis
virtual double operator()(const std::size_t& index, const std::size_t& verticalIndex = 0) const;
/// Set the value at a specific index
virtual void setValue(const std::size_t& index, const double& value);
size_t indexOfValue(const double value) const;
virtual bool operator==(const Axis&) const;
std::string label(const std::size_t& index)const;
/// Create bin boundaries from the point values
Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/SpectraAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MANTID_API_DLL SpectraAxis: public Axis
virtual bool isSpectra() const{return true;}
virtual double operator()(const std::size_t& index, const std::size_t& verticalIndex = 0) const;
virtual void setValue(const std::size_t& index, const double& value);
size_t indexOfValue(const double value) const;
virtual bool operator==(const Axis&) const;
std::string label(const std::size_t& index)const;

Expand Down
2 changes: 2 additions & 0 deletions Code/Mantid/Framework/API/inc/MantidAPI/TextAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class MANTID_API_DLL TextAxis: public Axis
virtual double operator()(const std::size_t& index, const std::size_t& verticalIndex = 0) const;
/// Set the value at the specified index
virtual void setValue(const std::size_t& index, const double& value);
size_t indexOfValue(const double value) const;

virtual bool operator==(const Axis&) const;
/// Get the label at the specified index
std::string label(const std::size_t& index)const;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/Framework/API/src/Axis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ double Axis::getValue(const std::size_t& index, const std::size_t& verticalIndex
specid_t Axis::spectraNo(const std::size_t& index) const
{
UNUSED_ARG(index)
throw std::domain_error("Cannot call spectraNo() on a non-spectra axis.");
throw std::domain_error("Cannot call spectraNo() on a non-spectra axis.");
}

} // namespace API
Expand Down
20 changes: 20 additions & 0 deletions Code/Mantid/Framework/API/src/IFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,26 @@ void IFunction::storeAttributeValue(const std::string& name, const API::IFunctio
}
}

/**
* Set the covariance matrix. Algorithm Fit sets this matrix to the top-level function
* after fitting. If the function is composite the matrix isn't set to its members.
* The matrix must be square and its size equal to the number of parameters of this function.
* @param covar :: A matrix to set.
*/
void IFunction::setCovarianceMatrix(boost::shared_ptr<Kernel::Matrix<double>> covar)
{
// the matrix shouldn't be empty
if (!covar)
{
throw std::invalid_argument("IFunction: Cannot set an empty covariance matrix");
}
// the matrix should relate to this function
if (covar->numRows() != nParams() || covar->numCols() != nParams())
{
throw std::invalid_argument("IFunction: Covariance matrix has a wrong size");
}
m_covar = covar;
}

} // namespace API
} // namespace Mantid
Expand Down
46 changes: 22 additions & 24 deletions Code/Mantid/Framework/API/src/MatrixWorkspace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1416,34 +1416,35 @@ namespace Mantid
*/
signal_t MatrixWorkspace::getSignalAtCoord(const coord_t * coords, const Mantid::API::MDNormalization & normalization) const
{
if (this->axes() != 2)
throw std::invalid_argument("MatrixWorkspace::getSignalAtCoord() - Workspace can only have 2 axes, found " +\
boost::lexical_cast<std::string>(this->axes()));

coord_t x = coords[0];
coord_t y = coords[1];

// First, find the workspace index
NumericAxis * ax1 = dynamic_cast<NumericAxis*>(this->getAxis(1));
Axis * ax1 = this->getAxis(1);
size_t wi(-1);
try
{
wi = ax1->indexOfValue(y);
}
catch(std::out_of_range &)
{
return std::numeric_limits<double>::quiet_NaN();
}

// If a spectra/text axis, just use the Y coord as the workspace index
size_t wi = size_t(y);
double yBinSize = 1.0;
if (ax1)
const auto & yVals = this->readY(wi);
double yBinSize(1.0); // only applies for volume normalization & numeric axis
if (normalization == VolumeNormalization && ax1->isNumeric())
{
const MantidVec & yVals = ax1->getValues();
MantidVec::const_iterator it = std::lower_bound(yVals.begin(), yVals.end(), y);
if (it == yVals.end())
if (wi + 1 == this->getNumberHistograms() && this->getNumberHistograms() > 1)
{
// Out of range
return std::numeric_limits<double>::quiet_NaN();
yBinSize = yVals[wi] - yVals[wi-1];
}
// The workspace index is the point in the vector that we found
wi = it - yVals.begin();

// Find the size of the bin in Y, if needed
if (normalization == VolumeNormalization)
else
{
if ((it+1) == yVals.end() && (yVals.size() > 1))
yBinSize = *it - *(it-1);
else
yBinSize = *(it+1) - *it;
yBinSize = yVals[wi+1] - yVals[wi];
}
}

Expand All @@ -1461,7 +1462,7 @@ namespace Mantid
size_t i = (it - X.begin());
if (i > 0)
{
double y = this->readY(wi)[i-1];
double y = yVals[i-1];
// What is our normalization factor?
switch (normalization)
{
Expand All @@ -1487,9 +1488,6 @@ namespace Mantid
}





//--------------------------------------------------------------------------------------------
/** Save the spectra detector map to an open NeXus file.
* @param file :: open NeXus file
Expand Down

0 comments on commit 4b1e897

Please sign in to comment.