Skip to content

Commit

Permalink
Merge branch 'master' into feature/8802_convolve_option_for_conv_fit
Browse files Browse the repository at this point in the history
Conflicts:
	Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataAnalysis.ui

Refs #8802
  • Loading branch information
DanNixon committed Oct 14, 2014
2 parents 43fd204 + 1ed36d9 commit fbc160f
Show file tree
Hide file tree
Showing 195 changed files with 13,954 additions and 8,629 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -162,4 +162,8 @@ Desktop.ini
# Mac OS X Finder
.DS_Store

# Ctags index files
.tags
.tags_sorted_by_file

Code/Mantid/Vates/VatesSimpleGui/ViewWidgets/inc/MantidVatesSimpleGuiViewWidgets/LibHelper.h
7 changes: 7 additions & 0 deletions Code/Mantid/Build/CMake/DarwinSetup.cmake
Expand Up @@ -81,6 +81,13 @@ endif ()
###########################################################################
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++0x" )
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x" )

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register" )
set ( CMAKE_XCODE_ATTRIBUTE_OTHER_CPLUSPLUSFLAGS "-Wno-deprecated-register")
set ( CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++" )
endif()

if( ${CMAKE_C_COMPILER} MATCHES "icc.*$" )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -no-intel-extensions" )
Expand Down
13 changes: 4 additions & 9 deletions Code/Mantid/Build/CMake/GNUSetup.cmake
Expand Up @@ -6,16 +6,12 @@
# project settings should be included in the relevant CMakeLists.txt file
# for that project.

# Get the GCC version
EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version | cut -d \" \" -f 3 OUTPUT_VARIABLE _compiler_output)
STRING(REGEX REPLACE ".*([0-9]\\.[0-9]\\.[0-9]).*" "\\1" GCC_COMPILER_VERSION ${_compiler_output})
MESSAGE(STATUS "gcc version: ${GCC_COMPILER_VERSION}")

# Export the GCC compiler version globally
set(GCC_COMPILER_VERSION ${GCC_COMPILER_VERSION} CACHE INTERNAL "")
# Set our own compiler version flag from the cmake one and export it globally
set( GCC_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION} CACHE INTERNAL "")
message( STATUS "gcc version: ${GCC_COMPILER_VERSION}" )

# Global warning flags.
set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -fno-common" )
set( GNUFLAGS "-Wall -Wextra -Wconversion -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -fno-common" )
# Disable some warnings about deprecated headers and type conversions that
# we can't do anything about
# -Wno-deprecated: Do not warn about use of deprecated headers.
Expand All @@ -38,4 +34,3 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GNUFLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GNUFLAGS} -Woverloaded-virtual -fno-operator-names -std=c++0x" )
# Cleanup
set ( GNUFLAGS )

1 change: 1 addition & 0 deletions Code/Mantid/Build/Jenkins/buildscript.bat
Expand Up @@ -8,6 +8,7 @@
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

"C:\Program Files (x86)\CMake 2.8\bin\cmake.exe" --version
echo %sha1%

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Check the required build configuration
Expand Down
12 changes: 8 additions & 4 deletions Code/Mantid/Framework/API/inc/MantidAPI/Algorithm.h
Expand Up @@ -338,6 +338,11 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
/// Pointer to the parent history object (if set)
boost::shared_ptr<AlgorithmHistory> m_parentHistory;

/// One vector of workspaces for each input workspace property
std::vector<WorkspaceVector> m_groups;
/// Size of the group(s) being processed
size_t m_groupSize;

private:
/// Private Copy constructor: NO COPY ALLOWED
Algorithm(const Algorithm&);
Expand All @@ -354,6 +359,9 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag

bool executeAsyncImpl(const Poco::Void & i);

// Report that the algorithm has completed.
void reportCompleted(const double& duration, const bool groupProcessing = false);

// --------------------- Private Members -----------------------------------
/// Poco::ActiveMethod used to implement asynchronous execution.
Poco::ActiveMethod<bool, Poco::Void, Algorithm, Poco::ActiveStarter<Algorithm>> *m_executeAsync;
Expand Down Expand Up @@ -387,14 +395,10 @@ class MANTID_API_DLL Algorithm : public IAlgorithm, public Kernel::PropertyManag
/// All the WorkspaceProperties that are Output (not inOut). Set in execute()
std::vector<IWorkspaceProperty *> m_pureOutputWorkspaceProps;

/// One vector of workspaces for each input workspace property
std::vector<WorkspaceVector> m_groups;
/// Pointer to the WorkspaceGroup (if any) for each input workspace property
std::vector<boost::shared_ptr<WorkspaceGroup> > m_groupWorkspaces;
/// If only one input is a group, this is its index. -1 if they are all groups
int m_singleGroup;
/// Size of the group(s) being processed
size_t m_groupSize;
/// All the groups have similar names (group_1, group_2 etc.)
bool m_groupsHaveSimilarNames;
/// A non-recursive mutex for thread-safety
Expand Down
83 changes: 59 additions & 24 deletions Code/Mantid/Framework/API/src/Algorithm.cpp
Expand Up @@ -78,13 +78,13 @@ namespace Mantid
Algorithm::Algorithm() :
PropertyManagerOwner(),
m_cancel(false),m_parallelException(false), m_log("Algorithm"), g_log(m_log),
m_groupSize(0),
m_executeAsync(NULL),
m_notificationCenter(NULL),
m_progressObserver(NULL),
m_isInitialized(false), m_isExecuted(false),m_isChildAlgorithm(false), m_recordHistoryForChild(false),
m_alwaysStoreInADS(false),m_runningAsync(false),
m_running(false),m_rethrow(false),m_algorithmID(this),
m_singleGroup(-1), m_groupSize(0), m_groupsHaveSimilarNames(false)
m_running(false), m_rethrow(false), m_algorithmID(this), m_singleGroup(-1), m_groupsHaveSimilarNames(false)
{
}

Expand Down Expand Up @@ -550,6 +550,18 @@ namespace Mantid
}
}

if(trackingHistory())
{
// count used for defining the algorithm execution order
// If history is being recorded we need to count this as a separate algorithm
// as the history compares histories by their execution number
++Algorithm::g_execCount;

//populate history record before execution so we can record child algorithms in it
AlgorithmHistory algHist;
m_history = boost::make_shared<AlgorithmHistory>(algHist);
}

// ----- Check for processing groups -------------
// default true so that it has the right value at the check below the catch block should checkGroups throw
bool callProcessGroups = true;
Expand All @@ -560,7 +572,22 @@ namespace Mantid
if (callProcessGroups)
{
// This calls this->execute() again on each member of the group.
return processGroups();
start_time = Mantid::Kernel::DateAndTime::getCurrentTime();
// Start a timer
Timer timer;
// Call the concrete algorithm's exec method
const bool completed = processGroups();
// Check for a cancellation request in case the concrete algorithm doesn't
interruption_point();
// Get how long this algorithm took to run
const float duration = timer.elapsed();

if(completed)
{
// Log that execution has completed.
reportCompleted(duration, true/*indicat that this is for group processing*/);
}
return completed;
}
}
catch(std::exception& ex)
Expand Down Expand Up @@ -593,19 +620,6 @@ namespace Mantid
Poco::FastMutex::ScopedLock _lock(m_mutex);
m_running = true;
}


if(trackingHistory())
{
// count used for defining the algorithm execution order
// If history is being recorded we need to count this as a separate algorithm
// as the history compares histories by their execution number
++Algorithm::g_execCount;

//populate history record before execution so we can record child algorithms in it
AlgorithmHistory algHist;
m_history = boost::make_shared<AlgorithmHistory>(algHist);
}

start_time = Mantid::Kernel::DateAndTime::getCurrentTime();
// Start a timer
Expand All @@ -631,14 +645,9 @@ namespace Mantid

// RJT, 19/3/08: Moved this up from below the catch blocks
setExecuted(true);
if (!m_isChildAlgorithm || m_alwaysStoreInADS)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << std::endl;
}
else
getLogger().debug() << name() << " finished with isChild = " << isChild() << std::endl;
m_running = false;

// Log that execution has completed.
reportCompleted(duration);
}
catch(std::runtime_error& ex)
{
Expand Down Expand Up @@ -1614,6 +1623,32 @@ namespace Mantid
if (m_cancel) throw CancelException();
}

/**
Report that the algorithm has completed.
@param duration : Algorithm duration
@param groupProcessing : We have been processing via processGroups if true.
*/
void Algorithm::reportCompleted(const double& duration, const bool groupProcessing)
{
std::string optionalMessage;
if(groupProcessing)
{
optionalMessage = ". Processed as a workspace group";
}

if (!m_isChildAlgorithm || m_alwaysStoreInADS)
{
getLogger().notice() << name() << " successful, Duration "
<< std::fixed << std::setprecision(2) << duration << " seconds" << optionalMessage << std::endl;
}

else
{
getLogger().debug() << name() << " finished with isChild = " << isChild() << std::endl;
}
m_running = false;
}



} // namespace API
Expand Down
Expand Up @@ -203,6 +203,8 @@ class DLLExport FindPeaks : public API::Algorithm

/// Minimum peak height
double m_minHeight;
/// Minimum value of peak's observed maximum Y value
double m_leastMaxObsY;

/// Start values
bool m_useObsCentre;
Expand Down
Expand Up @@ -150,9 +150,10 @@ class DLLExport GetDetOffsetsMultiPeaks: public API::Algorithm
std::string m_backType;
/// Peak profile type
std::string m_peakType;
/// Criterias for fitting peak
double m_maxChiSq;
double m_minPeakHeight;

double m_leastMaxObsY;
double m_maxOffset;

std::vector<double> m_peakPositions;
Expand Down
32 changes: 14 additions & 18 deletions Code/Mantid/Framework/Algorithms/src/CheckWorkspacesMatch.cpp
Expand Up @@ -488,7 +488,6 @@ bool CheckWorkspacesMatch::compareEventWorkspaces(DataObjects::EventWorkspace_co
}
else
{
result = "Success!";
wsmatch = true;
}

Expand Down Expand Up @@ -836,27 +835,24 @@ bool CheckWorkspacesMatch::checkRunProperties(const API::Run& run1, const API::R
}

// Now loop over the individual logs
for ( size_t i = 0; i < ws1logs.size(); ++i )
bool matched(true);
int64_t length(static_cast<int64_t>(ws1logs.size()));
PARALLEL_FOR_IF(true)
for ( int64_t i = 0; i < length; ++i )
{
// Check the log name
if ( ws1logs[i]->name() != ws2logs[i]->name() )
{
g_log.debug() << "WS1 log " << i << " name: " << ws1logs[i]->name() << "\n";
g_log.debug() << "WS2 log " << i << " name: " << ws2logs[i]->name() << "\n";
result = "Log name mismatch";
return false;
}

// Now check the log entry itself, using the method that gives it back as a string
if ( ws1logs[i]->value() != ws2logs[i]->value() )
PARALLEL_START_INTERUPT_REGION
if (matched)
{
g_log.debug() << "WS1 log " << ws1logs[i]->name() << ": " << ws1logs[i]->value() << "\n";
g_log.debug() << "WS2 log " << ws2logs[i]->name() << ": " << ws2logs[i]->value() << "\n";
result = "Log value mismatch";
return false;
if ( *(ws1logs[i]) != *(ws2logs[i]))
{
matched = false;
result = "Log mismatch";
}
}
PARALLEL_END_INTERUPT_REGION
}
return true;
PARALLEL_CHECK_INTERUPT_REGION
return matched;
}

//------------------------------------------------------------------------------------------------
Expand Down
23 changes: 23 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp
Expand Up @@ -123,6 +123,10 @@ namespace Algorithms

declareProperty("MinimumPeakHeight", DBL_MIN, "Minimum allowed peak height. ");

declareProperty("MinimumPeakHeightObs", 0.0, "Least value of the maximum observed Y value of a peak within "
"specified region. If any peak's maximum observed Y value is smaller, then "
"this peak will not be fit. It is designed for EventWorkspace with integer counts.");

std::vector<std::string> costFuncOptions;
costFuncOptions.push_back("Chi-Square");
costFuncOptions.push_back("Rwp");
Expand Down Expand Up @@ -255,6 +259,8 @@ namespace Algorithms

m_useObsCentre = getProperty("StartFromObservedPeakCentre");

m_leastMaxObsY = getProperty("MinimumPeakHeightObs");

return;
}

Expand Down Expand Up @@ -890,6 +896,23 @@ namespace Algorithms
const MantidVec& vecX = input->readX(spectrum);
const MantidVec& vecY = input->readY(spectrum);

// Exclude peak with peak counts
bool hasHighCounts = false;
for (int i = i_min; i <= i_max; ++i)
if (vecY[i] > m_leastMaxObsY)
{
hasHighCounts = true;
break;
}
if (!hasHighCounts)
{
std::stringstream ess;
ess << "Peak supposed at " << vecY[i_centre] << " does not have enough counts as " << m_leastMaxObsY;
g_log.debug(ess.str());
addNonFitRecord(spectrum);
return;
}

//-------------------------------------------------------------------------
// Estimate peak and background parameters for better fitting
//-------------------------------------------------------------------------
Expand Down
Expand Up @@ -186,6 +186,11 @@ namespace Algorithms
declareProperty("MaxChiSq", 100., "Maximum chisq value for individual peak fit allowed. (Default: 100)");

declareProperty("MinimumPeakHeight", 2.0, "Minimum value allowed for peak height.");

declareProperty("MinimumPeakHeightObs", 0.0, "Least value of the maximum observed Y value of a peak within "
"specified region. If any peak's maximum observed Y value is smaller, then "
"this peak will not be fit. It is designed for EventWorkspace with integer counts.");

//Disable default gsl error handler (which is to call abort!)
gsl_set_error_handler_off();

Expand Down Expand Up @@ -314,6 +319,7 @@ namespace Algorithms
m_maxChiSq = this->getProperty("MaxChiSq");
m_minPeakHeight = this->getProperty("MinimumPeakHeight");
m_maxOffset=getProperty("MaxOffset");
m_leastMaxObsY = getProperty("MinimumPeakHeightObs");

// Create output workspaces
outputW = boost::make_shared<OffsetsWorkspace>(m_inputWS->getInstrument());
Expand Down
4 changes: 2 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/MaskBinsFromTable.cpp
Expand Up @@ -48,7 +48,7 @@ namespace Algorithms
this->declareProperty(new WorkspaceProperty<>("OutputWorkspace","",Direction::Output),
"Output Workspace with bins masked.");
this->declareProperty(new WorkspaceProperty<DataObjects::TableWorkspace>("MaskingInformation", "", Direction::Input),
"Input TableWorkspace containing parameters, SpectraList, XMin and XMax.");
"Input TableWorkspace containing parameters, XMin and XMax and either SprectaList or DetectorIDsList");

return;
}
Expand Down Expand Up @@ -188,7 +188,7 @@ namespace Algorithms
if (id_xmin < 0 || id_xmax < 0 || id_xmin == id_xmax)
throw runtime_error("Either Xmin nor Xmax is not given. ");
if (id_spec == id_dets)
throw runtime_error("Neither SpectraList nor DetectorIDList is not given.");
throw runtime_error("Neither SpectraList nor DetectorIDList is given.");
else if (id_dets >= 0)
m_useDetectorID = true;
else
Expand Down
Expand Up @@ -688,7 +688,7 @@ class CheckWorkspacesMatchTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace2",ws3) );

TS_ASSERT( checker.execute() );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log name mismatch" );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log mismatch" );

Mantid::API::MatrixWorkspace_sptr ws4 = WorkspaceCreationHelper::Create2DWorkspace123(2,2);
ws4->mutableRun().addLogData(new Mantid::Kernel::PropertyWithValue<int>("Prop1",100));
Expand All @@ -697,7 +697,7 @@ class CheckWorkspacesMatchTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( checker.setProperty("Workspace2",ws4) );

TS_ASSERT( checker.execute() );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log value mismatch" );
TS_ASSERT_EQUALS( checker.getPropertyValue("Result"), "Log mismatch" );
}

void test_Input_With_Two_Groups_That_Are_The_Same_Matches()
Expand Down

0 comments on commit fbc160f

Please sign in to comment.