##// END OF EJS Templates
Handles data holes in AMDA parser
Alexandre Leroux -
r953:abcca7c3ef28
parent child
Show More
@@ -75,6 +75,8 public:
75 void readResultLine(const QString &line) override;
75 void readResultLine(const QString &line) override;
76
76
77 private:
77 private:
78 void handleDataHoles();
79
78 Properties m_Properties{};
80 Properties m_Properties{};
79 std::vector<double> m_XAxisData{};
81 std::vector<double> m_XAxisData{};
80 std::vector<double> m_YAxisData{};
82 std::vector<double> m_YAxisData{};
@@ -3,6 +3,7
3 #include <Common/DateUtils.h>
3 #include <Common/DateUtils.h>
4 #include <Common/SortUtils.h>
4 #include <Common/SortUtils.h>
5
5
6 #include <Data/DataSeriesUtils.h>
6 #include <Data/ScalarSeries.h>
7 #include <Data/ScalarSeries.h>
7 #include <Data/SpectrogramSeries.h>
8 #include <Data/SpectrogramSeries.h>
8 #include <Data/Unit.h>
9 #include <Data/Unit.h>
@@ -283,13 +284,14 bool SpectrogramParserHelper::checkProperties()
283 // Sets fill value
284 // Sets fill value
284 m_FillValue = m_Properties.value(FILL_VALUE_PROPERTY).value<double>();
285 m_FillValue = m_Properties.value(FILL_VALUE_PROPERTY).value<double>();
285
286
286 /// @todo: handle min/max samplings?
287
288 return true;
287 return true;
289 }
288 }
290
289
291 std::shared_ptr<IDataSeries> SpectrogramParserHelper::createSeries()
290 std::shared_ptr<IDataSeries> SpectrogramParserHelper::createSeries()
292 {
291 {
292 // Before creating the series, we handle its data holes
293 handleDataHoles();
294
293 return std::make_shared<SpectrogramSeries>(
295 return std::make_shared<SpectrogramSeries>(
294 std::move(m_XAxisData), std::move(m_YAxisData), std::move(m_ValuesData),
296 std::move(m_XAxisData), std::move(m_YAxisData), std::move(m_ValuesData),
295 Unit{"t", true}, // x-axis unit is always a time unit
297 Unit{"t", true}, // x-axis unit is always a time unit
@@ -352,6 +354,15 void SpectrogramParserHelper::readResultLine(const QString &line)
352 tryReadResult(m_XAxisData, m_ValuesData, line, m_ValuesIndexes, m_FillValue);
354 tryReadResult(m_XAxisData, m_ValuesData, line, m_ValuesIndexes, m_FillValue);
353 }
355 }
354
356
357 void SpectrogramParserHelper::handleDataHoles()
358 {
359 // Fills data holes according to the max resolution found in the AMDA file
360 auto resolution = m_Properties.value(MAX_SAMPLING_PROPERTY).value<double>();
361 auto fillValue = m_Properties.value(FILL_VALUE_PROPERTY).value<double>();
362
363 DataSeriesUtils::fillDataHoles(m_XAxisData, m_ValuesData, resolution, fillValue);
364 }
365
355 // ////////////////// //
366 // ////////////////// //
356 // VectorParserHelper //
367 // VectorParserHelper //
357 // ////////////////// //
368 // ////////////////// //
General Comments 0
You need to be logged in to leave comments. Login now