From 8cd29c2bee61daa10ada741f80f8464509355abb Mon Sep 17 00:00:00 2001 From: Antonin Portelli Date: Sun, 26 Dec 2021 22:21:03 +0100 Subject: [PATCH] XYStatData fixes --- lib/Statistics/XYStatData.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Statistics/XYStatData.cpp b/lib/Statistics/XYStatData.cpp index 2a88072..7407998 100644 --- a/lib/Statistics/XYStatData.cpp +++ b/lib/Statistics/XYStatData.cpp @@ -216,7 +216,7 @@ DVec XYStatData::getXError(const Index i) const DVec XYStatData::getYError(const Index j) const { - checkXDim(j); + checkYDim(j); return yyVar_(j, j).diagonal().cwiseSqrt(); } @@ -385,12 +385,15 @@ XYStatData XYStatData::getNormalisedResiduals(const FitResult &fit) for (Index j = 0; j < getNYDim(); ++j) { - const DoubleFunction &f = fit.getModel(j); + const DoubleFunction &f = fit.getModel(j); + const DVec err = getYError(j); + Index row = 0; for (auto &p: yData_[j]) { res.y(p.first, j) -= f(x(p.first)); - res.y(p.first, j) /= sqrt(getYYVar(j, j)(p.first, p.first)); + res.y(p.first, j) /= err(row); + row++; } }