13#include <boost/python/class.hpp>
14#include <boost/python/implicit.hpp>
15#include <boost/python/init.hpp>
16#include <boost/python/make_function.hpp>
17#include <boost/python/register_ptr_to_python.hpp>
18#include <boost/python/return_value_policy.hpp>
19#include <boost/python/tuple.hpp>
23using Mantid::Types::Core::DateAndTime;
25using boost::python::arg;
37template <
typename TYPE>
51 std::vector<size_t> stringSizes;
54 stringSizes.reserve(self.
size());
57 for (
int i = 0; i < self.
size(); i++) {
60 size_t size = val.size();
61 stringSizes.emplace_back(size);
65 size_t max = *std::max_element(std::begin(stringSizes), std::end(stringSizes));
70 std::string retVal = ss.str();
75#define EXPORT_TIMESERIES_PROP(TYPE, Prefix) \
76 register_ptr_to_python<TimeSeriesProperty<TYPE> *>(); \
78 class_<TimeSeriesProperty<TYPE>, bases<Property>, boost::noncopyable>( \
79 #Prefix "TimeSeriesProperty", init<const std::string &>((arg("self"), arg("value")))) \
80 .add_property("value", make_function(&Mantid::Kernel::TimeSeriesProperty<TYPE>::valuesAsVector, \
81 return_value_policy<VectorToNumpy>())) \
82 .add_property("times", make_function(&Mantid::Kernel::TimeSeriesProperty<TYPE>::timesAsVector, \
83 return_value_policy<VectorToNumpy>())) \
84 .add_property("filtered_value", make_function(&Mantid::Kernel::TimeSeriesProperty<TYPE>::filteredValuesAsVector, \
85 return_value_policy<VectorToNumpy>())) \
86 .add_property("filtered_times", make_function(&Mantid::Kernel::TimeSeriesProperty<TYPE>::filteredTimesAsVector, \
87 return_value_policy<VectorToNumpy>())) \
89 (void (TimeSeriesProperty<TYPE>::*)(const DateAndTime &, const TYPE &)) & \
90 TimeSeriesProperty<TYPE>::addValue, \
91 (arg("self"), arg("time"), arg("value"))) \
93 (void (TimeSeriesProperty<TYPE>::*)(const std::string &, const TYPE &)) & \
94 TimeSeriesProperty<TYPE>::addValue, \
95 (arg("self"), arg("time"), arg("value"))) \
96 .def("addValue", &addPyTimeValue<TYPE>, (arg("self"), arg("time"), arg("value"))) \
97 .def("clear", &TimeSeriesProperty<TYPE>::clear, arg("self")) \
98 .def("valueAsString", &TimeSeriesProperty<TYPE>::value, arg("self")) \
99 .def("size", &TimeSeriesProperty<TYPE>::size, arg("self")) \
100 .def("filterByTime", \
101 (void (TimeSeriesProperty<TYPE>::*)(const DateAndTime &, const DateAndTime &)) & \
102 TimeSeriesProperty<TYPE>::filterByTime, \
103 (arg("self"), arg("start"), arg("stop"))) \
104 .def("firstTime", &TimeSeriesProperty<TYPE>::firstTime, arg("self"), \
105 "returns :class:`mantid.kernel.DateAndTime`") \
106 .def("firstValue", &TimeSeriesProperty<TYPE>::firstValue, arg("self")) \
107 .def("lastTime", &TimeSeriesProperty<TYPE>::lastTime, arg("self"), "returns :class:`mantid.kernel.DateAndTime`") \
108 .def("lastValue", &TimeSeriesProperty<TYPE>::lastValue, arg("self")) \
109 .def("nthValue", &TimeSeriesProperty<TYPE>::nthValue, (arg("self"), arg("index"))) \
110 .def("nthTime", &TimeSeriesProperty<TYPE>::nthTime, (arg("self"), arg("index")), \
111 "returns :class:`mantid.kernel.DateAndTime`") \
112 .def("getStatistics", &TimeSeriesProperty<TYPE>::getStatistics, arg("self"), \
113 "returns :class:`mantid.kernel.TimeSeriesPropertyStatistics`") \
114 .def("timeAverageValue", &TimeSeriesProperty<TYPE>::timeAverageValue, arg("self")) \
115 .def("dtype", &dtype<TYPE>, arg("self"));
130 class_<Mantid::Kernel::TimeSeriesPropertyStatistics>(
"TimeSeriesPropertyStatistics", no_init)
double value
The value of the point.
#define GET_POINTER_SPECIALIZATION(TYPE)
std::string dtype(Mantid::Kernel::PropertyWithValue< HeldType > &self)
void export_TimeSeriesProperty_Int64()
void export_TimeSeriesProperty_Int32()
void export_TimeSeriesPropertyStatistics()
void export_TimeSeriesProperty_String()
void export_TimeSeriesProperty_Double()
void export_TimeSeriesProperty_Bool()
#define EXPORT_TIMESERIES_PROP(TYPE, Prefix)
Base class for properties.
A specialised Property class for holding a series of time-value pairs.
int size() const override
Returns the number of values at UNIQUE time intervals in the time series.
void addValue(const Types::Core::DateAndTime &time, const TYPE &value)
Add a value to the map using a DateAndTime object.
TYPE nthValue(int n) const
Returns n-th value of n-th interval in an incredibly inefficient way.
MANTID_PYTHONINTERFACE_CORE_DLL std::shared_ptr< Types::Core::DateAndTime > to_dateandtime(const boost::python::api::object &value)
std::string dtype(const Container< HeldType > &)
double time_standard_deviation
time weighted standard deviation
double standard_deviation
standard_deviation of the values
double minimum
Minimum value.
double median
Median value.
double time_mean
time weighted average
double duration
Duration in seconds.
double maximum
Maximum value.
Implements a return value policy that returns a numpy array from a function returning a std::vector b...