Skip to content

Commit

Permalink
Merge branch 'feature/8585_EISF_output_from_fitting' of github.com:ma…
Browse files Browse the repository at this point in the history
…ntidproject/mantid into feature/8585_EISF_output_from_fitting
  • Loading branch information
Samuel Jackson committed Jan 23, 2014
2 parents 010fea1 + 67986c3 commit 31a34c2
Show file tree
Hide file tree
Showing 156 changed files with 5,460 additions and 2,327 deletions.
@@ -0,0 +1,105 @@
Name: mantid-developer
Version: 1.3
Release: 3%{?dist}
Summary: Meta Package to install dependencies for Mantid Development

Group: Development/Tools
License: GPL

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Requires: rpmfusion-nonfree-release
Requires: cmake-gui >= 2.8.5
Requires: boost-devel
Requires: gperftools-devel
Requires: gperftools-libs
Requires: gcc-c++
Requires: git-all
Requires: gsl-devel
Requires: hdf-devel
Requires: hdf5-devel
Requires: muParser-devel
Requires: mxml-devel
Requires: nexus >= 4.2
Requires: nexus-devel >= 4.2
Requires: numpy
Requires: OCE-devel
Requires: poco-devel
Requires: PyQt4-devel
Requires: python-devel
Requires: python-sphinx
Requires: qscintilla-devel
Requires: qt-devel >= 4.6
Requires: qwt5-qt4-devel
Requires: qwtplot3d-qt4-devel
Requires: redhat-lsb
Requires: rpmdevtools
Requires: sip-devel
Requires: git
Requires: openssl-devel
Requires: texlive-latex
Requires: dvipng
Requires: qt-devel
Requires: qt-assistant

BuildArch: noarch

%description
A virtual package which requires all the dependencies and tools that are
required for Mantid development.

%prep

%build

%install

%clean

%post
# Remove myself once I have installed all the required packages.
#rpm -e %{name}

%files

%changelog
* Fri Dec 20 2013 Stuart Campbell <campbellsi@ornl.gov>
- Added python-sphinx

* Thu Dec 19 2013 Stuart Campbell <campbellsi@ornl.gov>
- Changed to use OCE rather than OpenCASCADE.

* Tue Aug 20 2013 Peter Peterson <petersonpf@ornl.gov>
- Removed things not necessary for fedora 19.

* Tue May 07 2013 Stuart Campbell <campbellsi@ornl.gov>
- Added dvipng and latex for qt-assistant stuff
- Added software collection dependencies

* Thu Jun 7 2012 Russell Taylor <taylorrj@ornl.gov>
- Remove gmock & gtest now that we include them in our repo
- Remove subversion dependency now that we use git

* Mon Mar 19 2012 Stuart Campbell <campbellsi@ornl.gov>
- Updated for google-perftools -> gperftools package rename.

* Wed Feb 22 2012 Stuart Campbell <campbellsi@ornl.gov>
- Added nexus as it is not required by it's devel package.

* Wed Feb 22 2012 Stuart Campbell <campbellsi@ornl.gov>
- Added git as a dependency
- Added openssl-devel dependency

* Mon Feb 20 2012 Stuart Campbell <campbellsi@ornl.gov>
- Added dependency on NeXus development after nexus rpm split.
- Updated CMake dependency to 2.8.5 following 'the virus'!
- Added Google Mock and GTest.

* Fri Jun 3 2011 Stuart Campbell <campbellsi@ornl.gov>
- Added rpmdevtools and lsb dependencies

* Fri Jun 3 2011 Stuart Campbell <campbellsi@ornl.gov>
- Added versions for some packages

* Fri Jun 3 2011 Stuart Campbell <campbellsi@ornl.gov>
- Initial release
38 changes: 28 additions & 10 deletions Code/Mantid/Framework/API/inc/MantidAPI/FunctionFactory.h
Expand Up @@ -8,9 +8,11 @@
#include "MantidAPI/DllConfig.h"
#include "MantidKernel/DynamicFactory.h"
#include "MantidKernel/SingletonHolder.h"
#include "MantidKernel/MultiThreaded.h"

#include <boost/shared_ptr.hpp>


namespace Mantid
{

Expand Down Expand Up @@ -76,7 +78,13 @@ namespace API

/// Query available functions based on the template type
template<typename FunctionType>
std::vector<std::string> getFunctionNames() const;
const std::vector<std::string>& getFunctionNames() const;

using Kernel::DynamicFactory<IFunction>::subscribe;
void subscribe(const std::string& className, AbstractFactory* pAbstractFactory,
Kernel::DynamicFactory<IFunction>::SubscribeAction replace=ErrorIfExists);

void unsubscribe(const std::string& className);

private:
friend struct Mantid::Kernel::CreateUsingNew<FunctionFactoryImpl>;
Expand Down Expand Up @@ -116,9 +124,11 @@ namespace API
/// Add a tie to the created function
void addTie(boost::shared_ptr<IFunction> fun,const Expression& expr)const;

///static reference to the logger class
/// Reference to the logger class
Kernel::Logger& g_log;

mutable std::map<std::string,std::vector<std::string>> m_cachedFunctionNames;
mutable Kernel::Mutex m_mutex;
};

/**
Expand All @@ -127,13 +137,20 @@ namespace API
* @returns A vector of the names of the functions matching the template type
*/
template<typename FunctionType>
std::vector<std::string> FunctionFactoryImpl::getFunctionNames() const
const std::vector<std::string>& FunctionFactoryImpl::getFunctionNames() const
{
Kernel::Mutex::ScopedLock _lock(m_mutex);

const std::string soughtType(typeid(FunctionType).name());
if ( m_cachedFunctionNames.find( soughtType ) != m_cachedFunctionNames.end() )
{
return m_cachedFunctionNames[soughtType];
}

// Create the entry in the cache and work with it directly
std::vector<std::string>& typeNames = m_cachedFunctionNames[soughtType];
const std::vector<std::string> names = this->getKeys();
std::vector<std::string> typeNames;
typeNames.reserve(names.size());
for( std::vector<std::string>::const_iterator it = names.begin();
it != names.end(); ++it )
for( auto it = names.begin(); it != names.end(); ++it )
{
boost::shared_ptr<IFunction> func = this->createFunction(*it);
if ( func && dynamic_cast<FunctionType*>(func.get()) )
Expand All @@ -143,12 +160,13 @@ namespace API
}
return typeNames;
}
///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it.

///Forward declaration of a specialisation of SingletonHolder for AlgorithmFactoryImpl (needed for dllexport/dllimport) and a typedef for it.
#ifdef _WIN32
// this breaks new namespace declaraion rules; need to find a better fix
template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<FunctionFactoryImpl>;
template class MANTID_API_DLL Mantid::Kernel::SingletonHolder<FunctionFactoryImpl>;
#endif /* _WIN32 */
typedef MANTID_API_DLL Mantid::Kernel::SingletonHolder<FunctionFactoryImpl> FunctionFactory;
typedef MANTID_API_DLL Mantid::Kernel::SingletonHolder<FunctionFactoryImpl> FunctionFactory;

/// Convenient typedef for an UpdateNotification
typedef FunctionFactoryImpl::UpdateNotification FunctionFactoryUpdateNotification;
Expand Down
1 change: 0 additions & 1 deletion Code/Mantid/Framework/API/inc/MantidAPI/FunctionProperty.h
Expand Up @@ -12,7 +12,6 @@

#include <boost/shared_ptr.hpp>

#include <iostream>
#include <string>

namespace Mantid
Expand Down
Expand Up @@ -12,7 +12,6 @@
#include "MantidKernel/Exception.h"
#include "MantidAPI/WorkspaceGroup.h"

#include <iostream>
#include <string>

namespace Mantid
Expand Down
14 changes: 14 additions & 0 deletions Code/Mantid/Framework/API/src/FunctionFactory.cpp
Expand Up @@ -335,6 +335,20 @@ namespace Mantid
}
}

void FunctionFactoryImpl::subscribe(const std::string& className, AbstractFactory* pAbstractFactory,
Kernel::DynamicFactory<IFunction>::SubscribeAction replace)
{
// Clear the cache, then do all the work in the base class method
m_cachedFunctionNames.clear();
Kernel::DynamicFactory<IFunction>::subscribe(className,pAbstractFactory,replace);
}

void FunctionFactoryImpl::unsubscribe(const std::string& className)
{
// Clear the cache, then do all the work in the base class method
m_cachedFunctionNames.clear();
Kernel::DynamicFactory<IFunction>::unsubscribe(className);
}

} // namespace API
} // namespace Mantid
76 changes: 30 additions & 46 deletions Code/Mantid/Framework/API/src/LogManager.cpp
Expand Up @@ -87,47 +87,30 @@ Kernel::Logger& LogManager::g_log = Kernel::Logger::get("LogManager");
const Kernel::DateAndTime LogManager::startTime() const
{
const std::string start_prop("start_time");
const std::string run_start_prop("run_start");
if (this->hasProperty(start_prop))
if ( hasProperty(start_prop) )
{
std::string start = this->getProperty(start_prop)->value();
if (DateAndTime(start) != DateAndTimeHelpers::GPS_EPOCH)
{
return DateAndTime(start);
}
else if (this->hasProperty(run_start_prop))
{
std::string start = this->getProperty(run_start_prop)->value();
if (DateAndTime(start) != DateAndTimeHelpers::GPS_EPOCH)
try {
DateAndTime start_time(getProperty(start_prop)->value());
if (start_time != DateAndTimeHelpers::GPS_EPOCH)
{
return DateAndTime(start);
return start_time;
}
else
{
throw std::runtime_error("Run::startTime() - No start time has been set for this run.");
}
}
else
{
throw std::runtime_error("Run::startTime() - No start time has been set for this run.");
}
}
else if (this->hasProperty(run_start_prop))
{
std::string start = this->getProperty(run_start_prop)->value();
if (DateAndTime(start) != DateAndTimeHelpers::GPS_EPOCH)
{
return DateAndTime(start);
}
else
{
throw std::runtime_error("Run::startTime() - No start time has been set for this run.");
}
} catch (std::invalid_argument&) { /*Swallow and move on*/ }
}
else

const std::string run_start_prop("run_start");
if ( hasProperty(run_start_prop) )
{
throw std::runtime_error("Run::startTime() - No start time has been set for this run.");
try {
DateAndTime start_time(getProperty(run_start_prop)->value());
if (start_time != DateAndTimeHelpers::GPS_EPOCH)
{
return start_time;
}
} catch (std::invalid_argument&) { /*Swallow and move on*/ }
}

throw std::runtime_error("No valid start time has been set for this run.");
}

/** Return the run end time as given by the 'end_time' or 'run_end' property.
Expand All @@ -138,21 +121,22 @@ Kernel::Logger& LogManager::g_log = Kernel::Logger::get("LogManager");
const Kernel::DateAndTime LogManager::endTime() const
{
const std::string end_prop("end_time");
const std::string run_end_prop("run_end");
if (this->hasProperty(end_prop))
{
std::string end = this->getProperty(end_prop)->value();
return DateAndTime(end);
}
else if (this->hasProperty(run_end_prop))
if ( hasProperty(end_prop) )
{
std::string end = this->getProperty(run_end_prop)->value();
return DateAndTime(end);
try {
return DateAndTime(getProperty(end_prop)->value());
} catch (std::invalid_argument&) { /*Swallow and move on*/ }
}
else

const std::string run_end_prop("run_end");
if (hasProperty(run_end_prop))
{
throw std::runtime_error("Run::endTime() - No end time has been set for this run.");
try {
return DateAndTime(getProperty(run_end_prop)->value());
} catch (std::invalid_argument&) { /*Swallow and move on*/ }
}

throw std::runtime_error("No valid end time has been set for this run.");
}


Expand Down
51 changes: 51 additions & 0 deletions Code/Mantid/Framework/API/src/Run.cpp
Expand Up @@ -32,6 +32,9 @@ namespace
const char * GONIOMETER_LOG_NAME = "goniometer";
/// Name of the stored histogram bins log when saved to NeXus
const char * HISTO_BINS_LOG_NAME = "processed_histogram_bins";
const char * PEAK_RADIUS_GROUP = "peak_radius";
const char * INNER_BKG_RADIUS_GROUP = "inner_bkg_radius";
const char * OUTER_BKG_RADIUS_GROUP = "outer_bkg_radius";
}
// Get a reference to the logger
Kernel::Logger& Run::g_log = Kernel::Logger::get("Run");
Expand Down Expand Up @@ -358,7 +361,31 @@ Kernel::Logger& Run::g_log = Kernel::Logger::get("Run");
file->writeData("value", m_histoBins);
file->closeGroup();
}
if( this->hasProperty("PeakRadius") )
{
const std::vector<double> & values =
this->getPropertyValueAsType<std::vector<double> >("PeakRadius");

file->makeGroup(PEAK_RADIUS_GROUP, "NXdata", 1);
file->writeData("value", values);
file->closeGroup();
}
if( this->hasProperty("BackgroundInnerRadius") )
{
file->makeGroup(INNER_BKG_RADIUS_GROUP, "NXdata", 1);
const std::vector<double> & values =
this->getPropertyValueAsType<std::vector<double> >("BackgroundInnerRadius");
file->writeData("value", values);
file->closeGroup();
}
if( this->hasProperty("BackgroundOuterRadius") )
{
file->makeGroup(OUTER_BKG_RADIUS_GROUP, "NXdata", 1);
const std::vector<double> & values =
this->getPropertyValueAsType<std::vector<double> >("BackgroundOuterRadius");
file->writeData("value", values);
file->closeGroup();
}
if(!keepOpen)file->closeGroup();
}

Expand Down Expand Up @@ -392,6 +419,30 @@ Kernel::Logger& Run::g_log = Kernel::Logger::get("Run");
file->readData("value",m_histoBins);
file->closeGroup();
}
else if(name_class.first == PEAK_RADIUS_GROUP)
{
file->openGroup(name_class.first, "NXdata");
std::vector<double> values;
file->readData("value",values);
file->closeGroup();
this->addProperty("PeakRadius",values, true);
}
else if(name_class.first == INNER_BKG_RADIUS_GROUP)
{
file->openGroup(name_class.first, "NXdata");
std::vector<double> values;
file->readData("value",values);
file->closeGroup();
this->addProperty("BackgroundInnerRadius",values, true);
}
else if(name_class.first == OUTER_BKG_RADIUS_GROUP)
{
file->openGroup(name_class.first, "NXdata");
std::vector<double> values;
file->readData("value",values);
file->closeGroup();
this->addProperty("BackgroundOuterRadius",values, true);
}
else if (name_class.first == "proton_charge" && !this->hasProperty("proton_charge"))
{
// Old files may have a proton_charge field, single value (not even NXlog)
Expand Down

0 comments on commit 31a34c2

Please sign in to comment.