diff --git a/Device/Data/DataUtil.cpp b/Device/Data/DataUtil.cpp index 95ca3e89b27b51f69719d17f5993d0eb8fd81315..43c20ea62ddf5ccaba77c5ec697e2d3e79754f6b 100644 --- a/Device/Data/DataUtil.cpp +++ b/Device/Data/DataUtil.cpp @@ -41,26 +41,6 @@ DataUtil::flatten2D(const std::vector<std::vector<double>>& vec) return {nrows, ncols, outvec}; } -std::unique_ptr<Datafield> DataUtil::createPField2D(const std::vector<std::vector<double>>& vec, - const std::vector<std::vector<double>>& stdv) -{ - const auto [nrows, ncols, outvec] = flatten2D(vec); - ASSERT(nrows > 0); - ASSERT(ncols > 0); - - std::vector<const Scale*> axes{newEquiDivision("axis0", ncols, 0.0, (double)ncols), - newEquiDivision("axis1", nrows, 0.0, (double)nrows)}; - - if (stdv.empty()) - return std::make_unique<Datafield>(std::move(axes), outvec); - - const auto [nrows2, ncols2, outvec2] = flatten2D(stdv); - ASSERT(nrows2 == nrows); - ASSERT(ncols2 == ncols); - - return std::make_unique<Datafield>(std::move(axes), outvec, outvec2); -} - std::vector<std::vector<double>> DataUtil::createVector2D(const Datafield& data) { std::vector<std::vector<double>> result; diff --git a/Device/Data/DataUtil.h b/Device/Data/DataUtil.h index 570d47cdf707b100487cc3158a04268c5f79d089..107b8d62f9233fbf3ecc218fef7c7a7ea60bc178 100644 --- a/Device/Data/DataUtil.h +++ b/Device/Data/DataUtil.h @@ -28,9 +28,6 @@ namespace DataUtil { std::tuple<size_t, size_t, std::vector<double>> flatten2D(const std::vector<std::vector<double>>&); -std::unique_ptr<Datafield> createPField2D(const std::vector<std::vector<double>>& vec, - const std::vector<std::vector<double>>& stdv = {}); - //! Returns new object with input data rotated by //! n*90 deg counterclockwise (n > 0) or clockwise (n < 0) //! Axes are swapped if the data is effectively rotated by 90 or 270 degrees diff --git a/Device/IO/ReadWrite2DTable.cpp b/Device/IO/ReadWrite2DTable.cpp index 4d1bcfe8b7f28e4bf7822fcae7d657f3f896933f..a38997edc887d718a1bf1d63716fff6b9196d7d6 100644 --- a/Device/IO/ReadWrite2DTable.cpp +++ b/Device/IO/ReadWrite2DTable.cpp @@ -104,7 +104,14 @@ Datafield* Util::RW::read2DTable(std::istream& input_stream) return new Datafield(std::move(axes), vector1d); } - return DataUtil::createPField2D(data).release(); + std::vector<const Scale*> axes{newEquiDivision("axis0", ncols, 0.0, (double)ncols), + newEquiDivision("axis1", nrows, 0.0, (double)nrows)}; + + const auto [nrows2, ncols2, outvec] = DataUtil::flatten2D(data); + ASSERT(nrows2 == nrows); + ASSERT(ncols2 == ncols); + + return new Datafield(std::move(axes), outvec); } void Util::RW::write2DTable(const Datafield& data, std::ostream& output_stream)