diff --git a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h index f38e04f9a9aa56b45c2b40cfe2403584fb55a524..dcd8861aa81d9b8fded5001476fb96d5cc0f096f 100644 --- a/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h +++ b/Code/Mantid/Framework/Algorithms/inc/MantidAlgorithms/GenerateEventsFilter.h @@ -91,8 +91,8 @@ namespace Algorithms void processSingleValueFilter(double minvalue, double maxvalue, bool filterincrease, bool filterdecrease); - void processMultipleValueFilters(double minvalue, double maxvalue, - bool filterincrease, bool filterdecrease); + void processMultipleValueFilters(double minvalue, double valueinterval, double maxvalue, + bool filterincrease, bool filterdecrease); void makeFilterByValue(Kernel::TimeSplitterType& split, double min, double max, double TimeTolerance, bool centre, bool filterIncrease, bool filterDecrease, Kernel::DateAndTime startTime, Kernel::DateAndTime stopTime, diff --git a/Code/Mantid/Framework/Algorithms/src/GenerateEventsFilter.cpp b/Code/Mantid/Framework/Algorithms/src/GenerateEventsFilter.cpp index 8c749c849b28c92c496d7a8d7c577f253293a8ea..596f90961ce9ca4172d0c91c2ce07e4773298a8b 100644 --- a/Code/Mantid/Framework/Algorithms/src/GenerateEventsFilter.cpp +++ b/Code/Mantid/Framework/Algorithms/src/GenerateEventsFilter.cpp @@ -67,6 +67,7 @@ and thus the first splitter will start from the first log time. #include "MantidAPI/WorkspaceFactory.h" #include "MantidAPI/WorkspaceProperty.h" #include "MantidAPI/Column.h" +#include "MantidKernel/VisibleWhenProperty.h" using namespace Mantid; using namespace Mantid::Kernel; @@ -127,8 +128,10 @@ namespace Algorithms "Events at or after this time are filtered out."); // Split by time (only) in steps - declareProperty("TimeInterval", -1.0, - "Length of the time splices if filtered in time only."); + declareProperty("TimeInterval", EMPTY_DBL(), + "Length of the time splices if filtered in time only."); + setPropertySettings("TimeInterval", + new VisibleWhenProperty("LogName", IS_EQUAL_TO, "")); std::vector<std::string> timeoptions; timeoptions.push_back("Seconds"); @@ -145,12 +148,18 @@ namespace Algorithms "For example, the pulse charge is recorded in 'ProtonCharge'."); declareProperty("MinimumLogValue", EMPTY_DBL(), "Minimum log value for which to keep events."); + setPropertySettings("MinimumLogValue", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("MaximumLogValue", EMPTY_DBL(), "Maximum log value for which to keep events."); + setPropertySettings("MaximumLogValue", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("LogValueInterval", EMPTY_DBL(), "Delta of log value to be sliced into from min log value and max log value.\n" "If not given, then only value "); + setPropertySettings("LogValueInterval", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); std::vector<std::string> filteroptions; filteroptions.push_back("Both"); @@ -159,10 +168,14 @@ namespace Algorithms declareProperty("FilterLogValueByChangingDirection", "Both", boost::make_shared<Kernel::StringListValidator>(filteroptions), "d(log value)/dt can be positive and negative. They can be put to different splitters."); + setPropertySettings("FilterLogValueByChangingDirection", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("TimeTolerance", 0.0, "Tolerance in time for the event times to keep. " "It is used in the case to filter by single value."); + setPropertySettings("TimeTolerance", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); vector<string> logboundoptions; logboundoptions.push_back("Centre"); @@ -171,12 +184,13 @@ namespace Algorithms auto logvalidator = boost::make_shared<StringListValidator>(logboundoptions); declareProperty("LogBoundary", "Centre", logvalidator, "How to treat log values as being measured in the centre of time."); + setPropertySettings("LogBoundary", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); declareProperty("LogValueTolerance", EMPTY_DBL(), "Tolerance of the log value to be included in filter. It is used in the case to filter by multiple values."); - - declareProperty("LogValueTimeSections", 1, - "In one log value interval, it can be further divided into sections in even time slice."); + setPropertySettings("LogValueTolerance", + new VisibleWhenProperty("LogName", IS_NOT_EQUAL_TO, "")); // Output workspaces' title and name declareProperty("TitleOfSplitters", "", @@ -421,20 +435,26 @@ namespace Algorithms { double timeinterval = this->getProperty("TimeInterval"); + bool singleslot = false; + if (timeinterval == EMPTY_DBL()) singleslot = true; + // Progress int64_t totaltime = m_stopTime.totalNanoseconds()-m_startTime.totalNanoseconds(); - int64_t timeslot = 0; - if (timeinterval <= 0.0) + if (singleslot) { int wsindex = 0; + // Default and thus just one interval std::stringstream ss; ss << "Time Interval From " << m_startTime << " to " << m_stopTime; + addNewTimeFilterSplitter(m_startTime, m_stopTime, wsindex, ss.str()); } else { + int64_t timeslot = 0; + // Explicitly N time intervals int64_t deltatime_ns = static_cast<int64_t>(timeinterval*m_timeUnitConvertFactorToNS); @@ -571,7 +591,7 @@ namespace Algorithms else { // Generate filters for a series of log value - processMultipleValueFilters(minvalue, maxvalue, filterIncrease, filterDecrease); + processMultipleValueFilters(minvalue, deltaValue, maxvalue, filterIncrease, filterDecrease); } } else @@ -676,16 +696,16 @@ namespace Algorithms //---------------------------------------------------------------------------------------------- /** Generate filters from multiple values * @param minvalue :: minimum value of the allowed log value; + * @param valueinterval :: step of the log value for a series of filter * @param maxvalue :: maximum value of the allowed log value; * @param filterincrease :: if true, log value in the increasing curve should be included; * @param filterdecrease :: if true, log value in the decreasing curve should be included; */ - void GenerateEventsFilter::processMultipleValueFilters(double minvalue, double maxvalue, + void GenerateEventsFilter::processMultipleValueFilters(double minvalue, double valueinterval, double maxvalue, bool filterincrease, bool filterdecrease) { // Read more input - double valueinterval = this->getProperty("LogValueInterval"); if (valueinterval <= 0) throw std::invalid_argument("Multiple values filter must have LogValueInterval larger than ZERO."); double valuetolerance = this->getProperty("LogValueTolerance");