From 8e075905205ee93ca2bfc86b155e676a574b0e46 Mon Sep 17 00:00:00 2001 From: tremblap Date: Fri, 23 Feb 2024 16:17:59 +0000 Subject: [PATCH] fixing fluid.normalize json reloading issue (#262) * a simple line... * proper initialisation * remove the change of scaling post fitting (as it was in the RT version in SC) --- include/algorithms/public/Normalization.hpp | 3 +++ include/clients/nrt/NormalizeClient.hpp | 6 ------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/algorithms/public/Normalization.hpp b/include/algorithms/public/Normalization.hpp index 0c6e126fb..3847c9d79 100644 --- a/include/algorithms/public/Normalization.hpp +++ b/include/algorithms/public/Normalization.hpp @@ -49,6 +49,8 @@ class Normalization using namespace _impl; mMin = min; mMax = max; + mRange = mMax - mMin; + handleZerosInScale(mRange); mDataMin = asEigen(dataMin); mDataMax = asEigen(dataMax); mDataRange = mDataMax - mDataMin; @@ -132,6 +134,7 @@ class Normalization { mMin = 0; mMax = 1.0; + mRange = 1.0; mDataMin.setZero(); mDataMax.setZero(); mDataRange.setZero(); diff --git a/include/clients/nrt/NormalizeClient.hpp b/include/clients/nrt/NormalizeClient.hpp index bb218686c..b34f54162 100644 --- a/include/clients/nrt/NormalizeClient.hpp +++ b/include/clients/nrt/NormalizeClient.hpp @@ -139,8 +139,6 @@ class NormalizeClient : public FluidBaseClient, StringVector ids{srcDataSet.getIds()}; RealMatrix data(srcDataSet.size(), srcDataSet.pointSize()); if (!mAlgorithm.initialized()) return Error(NoDataFitted); - mAlgorithm.setMin(get()); - mAlgorithm.setMax(get()); mAlgorithm.process(srcDataSet.getData(), data, invert); FluidDataSet result(ids, data); destPtr->setDataSet(result); @@ -166,8 +164,6 @@ class NormalizeClient : public FluidBaseClient, RealVector src(mAlgorithm.dims()); RealVector dest(mAlgorithm.dims()); src <<= BufferAdaptor::ReadAccess(in.get()).samps(0, mAlgorithm.dims(), 0); - mAlgorithm.setMin(get()); - mAlgorithm.setMax(get()); mAlgorithm.processFrame(src, dest, invert); outBuf.samps(0, mAlgorithm.dims(), 0) <<= dest; return OK(); @@ -239,8 +235,6 @@ class NormalizeQuery : public FluidBaseClient, ControlIn, ControlOut RealVector dest(algorithm.dims()); src <<= BufferAdaptor::ReadAccess(get().get()) .samps(0, algorithm.dims(), 0); -// algorithm.setMin(get()); -// algorithm.setMax(get()); algorithm.processFrame(src, dest, get() == 1); outBuf.samps(0, algorithm.dims(), 0) <<= dest; }