changeset 7300:83bb52fa0c32

(issue1529) Be more tolerant in the fitting. The invalid value warning is removed because invalid data is expected there when datapoints are not valid for this KM
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 11 Oct 2013 18:40:33 +0200
parents cde863b2dae3
children 4eea35874943
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixCalculation.java
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java	Fri Oct 11 17:11:15 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java	Fri Oct 11 18:40:33 2013 +0200
@@ -148,9 +148,6 @@
                 xs.add(qs[i]);
                 ys.add(ws[i]);
             }
-            else {
-                log.warn("remove invalid value " + qs[i] + " " + ws[i]);
-            }
         }
 
         if (xs.size() < 2) {
@@ -166,7 +163,7 @@
 
         for (;;) {
             parameters = null;
-            for (double tolerance = 1e-10; tolerance < 1e-3; tolerance *= 10d) {
+            for (double tolerance = 1e-10; tolerance < 1e-1; tolerance *= 10d) {
 
                 lmo = new LevenbergMarquardtOptimizer();
                 lmo.setCostRelativeTolerance(tolerance);
@@ -190,6 +187,11 @@
                 }
             }
             if (parameters == null) {
+                /*
+                log.debug("Parameters is null");
+                for (int i = 0, N = xs.size(); i < N; ++i) {
+                    log.debug("DATA: " + xs.getQuick(i) + " " + ys.getQuick(i));
+                }*/
                 return false;
             }
 
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixCalculation.java	Fri Oct 11 17:11:15 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixCalculation.java	Fri Oct 11 18:40:33 2013 +0200
@@ -363,6 +363,7 @@
             fitting.reset();
 
             if (!fitting.fit(qs, ws)) {
+                log.debug("Fitting for km: " + km + " failed");
                 ++numFailed;
                 addProblem(km, "fix.fitting.failed");
                 continue;

http://dive4elements.wald.intevation.org