[PATCH 2 of 2] (issue1529) Be more tolerant in the fitting

Wald Commits scm-commit at wald.intevation.org
Fri Oct 11 18:40:37 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1381509633 -7200
# Node ID 83bb52fa0c32165685766872f41846b42286c7a5
# Parent  cde863b2dae37626d3dfd91e62e3822f34d23a0d
(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

diff -r cde863b2dae3 -r 83bb52fa0c32 artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/Fitting.java
--- 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;
             }
 
diff -r cde863b2dae3 -r 83bb52fa0c32 artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixCalculation.java
--- 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;


More information about the Dive4elements-commits mailing list