@@ -319,7 +319,7 public: | |||||
319 | std::make_unique<dataseries_detail::IteratorValue<Dim, true> >(*this, false)}}; |
|
319 | std::make_unique<dataseries_detail::IteratorValue<Dim, true> >(*this, false)}}; | |
320 | } |
|
320 | } | |
321 |
|
321 | |||
322 | void erase(DataSeriesIterator first, DataSeriesIterator last) |
|
322 | virtual void erase(DataSeriesIterator first, DataSeriesIterator last) | |
323 | { |
|
323 | { | |
324 | auto firstImpl |
|
324 | auto firstImpl | |
325 | = dynamic_cast<dataseries_detail::IteratorValue<Dim, false> *>(first->impl()); |
|
325 | = dynamic_cast<dataseries_detail::IteratorValue<Dim, false> *>(first->impl()); | |
@@ -331,7 +331,7 public: | |||||
331 | } |
|
331 | } | |
332 | } |
|
332 | } | |
333 |
|
333 | |||
334 | void insert(DataSeriesIterator first, DataSeriesIterator last, bool prepend = false) |
|
334 | virtual void insert(DataSeriesIterator first, DataSeriesIterator last, bool prepend = false) | |
335 | { |
|
335 | { | |
336 | auto firstImpl = dynamic_cast<dataseries_detail::IteratorValue<Dim, true> *>(first->impl()); |
|
336 | auto firstImpl = dynamic_cast<dataseries_detail::IteratorValue<Dim, true> *>(first->impl()); | |
337 | auto lastImpl = dynamic_cast<dataseries_detail::IteratorValue<Dim, true> *>(last->impl()); |
|
337 | auto lastImpl = dynamic_cast<dataseries_detail::IteratorValue<Dim, true> *>(last->impl()); |
@@ -33,7 +33,26 public: | |||||
33 |
|
33 | |||
34 | inline double xResolution() const noexcept { return m_XResolution; } |
|
34 | inline double xResolution() const noexcept { return m_XResolution; } | |
35 |
|
35 | |||
|
36 | void erase(DataSeriesIterator first, DataSeriesIterator last) override | |||
|
37 | { | |||
|
38 | DataSeries<2>::erase(first,last); | |||
|
39 | updateResolution(); | |||
|
40 | } | |||
|
41 | ||||
|
42 | void insert(DataSeriesIterator first, DataSeriesIterator last, bool prepend = false) override | |||
|
43 | { | |||
|
44 | DataSeries<2>::insert(first,last, prepend); | |||
|
45 | updateResolution(); | |||
|
46 | } | |||
|
47 | ||||
|
48 | void merge(IDataSeries *dataSeries) override | |||
|
49 | { | |||
|
50 | DataSeries<2>::merge(dataSeries); | |||
|
51 | updateResolution(); | |||
|
52 | } | |||
|
53 | ||||
36 | private: |
|
54 | private: | |
|
55 | void updateResolution(); | |||
37 | double m_XResolution; ///< Resolution used on x-axis to build the spectrogram |
|
56 | double m_XResolution; ///< Resolution used on x-axis to build the spectrogram | |
38 | }; |
|
57 | }; | |
39 |
|
58 |
@@ -25,7 +25,7 SpectrogramSeries::SpectrogramSeries(std::shared_ptr<ArrayData<1> > xAxisData, | |||||
25 | { |
|
25 | { | |
26 | if(std::isnan(m_XResolution)) |
|
26 | if(std::isnan(m_XResolution)) | |
27 | { |
|
27 | { | |
28 | //m_XResolution = DataSeriesUtils::resolution(xAxisData->begin(), xAxisData->end()).m_Val; |
|
28 | updateResolution(); | |
29 | } |
|
29 | } | |
30 | } |
|
30 | } | |
31 |
|
31 | |||
@@ -53,3 +53,9 std::shared_ptr<IDataSeries> SpectrogramSeries::subDataSeries(const DateTimeRang | |||||
53 | std::make_shared<ArrayData<2> >(subValuesData.toStdVector(), yAxis.size()), |
|
53 | std::make_shared<ArrayData<2> >(subValuesData.toStdVector(), yAxis.size()), | |
54 | this->valuesUnit(), std::move(yAxis)); |
|
54 | this->valuesUnit(), std::move(yAxis)); | |
55 | } |
|
55 | } | |
|
56 | ||||
|
57 | void SpectrogramSeries::updateResolution() | |||
|
58 | { | |||
|
59 | auto xAxisData = this->xAxisData()->cdata(); | |||
|
60 | m_XResolution = DataSeriesUtils::resolution(xAxisData.begin(), xAxisData.end()).m_Val; | |||
|
61 | } |
@@ -90,6 +90,9 PYBIND11_MODULE(pysciqlopcore,m){ | |||||
90 | }, py::keep_alive<0, 1>()) |
|
90 | }, py::keep_alive<0, 1>()) | |
91 | .def("__repr__",__repr__<IDataSeries>); |
|
91 | .def("__repr__",__repr__<IDataSeries>); | |
92 |
|
92 | |||
|
93 | py::class_<ArrayData<1>, std::shared_ptr<ArrayData<1>> >(m,"ArrayData1d") | |||
|
94 | .def("cdata", [](ArrayData<1>& array) {return array.cdata();}); | |||
|
95 | ||||
93 | py::class_<ScalarSeries, std::shared_ptr<ScalarSeries>, IDataSeries>(m, "ScalarSeries") |
|
96 | py::class_<ScalarSeries, std::shared_ptr<ScalarSeries>, IDataSeries>(m, "ScalarSeries") | |
94 | .def("nbPoints", &ScalarSeries::nbPoints); |
|
97 | .def("nbPoints", &ScalarSeries::nbPoints); | |
95 |
|
98 | |||
@@ -97,10 +100,12 PYBIND11_MODULE(pysciqlopcore,m){ | |||||
97 | .def("nbPoints", &VectorSeries::nbPoints); |
|
100 | .def("nbPoints", &VectorSeries::nbPoints); | |
98 |
|
101 | |||
99 | py::class_<DataSeries<2>, std::shared_ptr<DataSeries<2>>, IDataSeries>(m,"DataSeries2d") |
|
102 | py::class_<DataSeries<2>, std::shared_ptr<DataSeries<2>>, IDataSeries>(m,"DataSeries2d") | |
|
103 | .def_property_readonly("xAxis", py::overload_cast<>(&DataSeries<2>::xAxisData, py::const_)) | |||
100 | .def_property_readonly("yAxis", py::overload_cast<>(&DataSeries<2>::yAxis, py::const_)); |
|
104 | .def_property_readonly("yAxis", py::overload_cast<>(&DataSeries<2>::yAxis, py::const_)); | |
101 |
|
105 | |||
102 | py::class_<SpectrogramSeries, std::shared_ptr<SpectrogramSeries>, DataSeries<2>>(m, "SpectrogramSeries") |
|
106 | py::class_<SpectrogramSeries, std::shared_ptr<SpectrogramSeries>, DataSeries<2>>(m, "SpectrogramSeries") | |
103 |
.def("nbPoints", &SpectrogramSeries::nbPoints) |
|
107 | .def("nbPoints", &SpectrogramSeries::nbPoints) | |
|
108 | .def("xRes", &SpectrogramSeries::xResolution); | |||
104 |
|
109 | |||
105 |
|
110 | |||
106 | py::class_<IDataProvider, std::shared_ptr<IDataProvider>>(m, "IDataProvider"); |
|
111 | py::class_<IDataProvider, std::shared_ptr<IDataProvider>>(m, "IDataProvider"); |
General Comments 0
You need to be logged in to leave comments.
Login now