gpx_reduce.py
changeset 1 5467c893d121
parent 0 8f4668cd868b
child 2 f93786d4f68e
--- a/gpx_reduce.py	Sun Aug 20 21:58:37 2017 +0200
+++ b/gpx_reduce.py	Sun Aug 20 21:59:58 2017 +0200
@@ -31,8 +31,7 @@
 import datetime
 import sys
 import time
-import pylab as pl
-import scipy as sc
+import numpy as sc
 import numpy.linalg as la
 from math import *
 from lxml import etree
@@ -101,7 +100,7 @@
         return la.norm(vm)
     linem = line / linel
     
-    position = pl.dot(vm, linem) / linel
+    position = sc.dot(vm, linem) / linel
     if position < 0.0:
         return la.norm(vm)
     elif position > 1.0:
@@ -228,10 +227,10 @@
                     i1_i2_segment_valid = False
                 
                     # check if connection to any further point i1 is impossible
-                    d1 = pl.dot(p1 - p2, p1 - p2)
-                    d2 = pl.dot(pm - p2, pm - p2)
+                    d1 = sc.dot(p1 - p2, p1 - p2)
+                    d2 = sc.dot(pm - p2, pm - p2)
                     dd = options.max_dist ** 2
-                    d1d2 = pl.dot(p1 - p2, pm - p2)
+                    d1d2 = sc.dot(p1 - p2, pm - p2)
                     # formula from cosines of point separation angle and cone-opening angles around points
                     if (d1 > dd and d2 > dd and (d1d2 + dd)**2 < (d2 - dd) * (d1 - dd)):
                         lower_i1_possible = False
@@ -383,6 +382,7 @@
     
     # plot result to screen
     if options.plot:
+        import pylab as pl
         latm, lonm, elesum = xyz_to_latlonele(sumx, sumy, sumz)
 
         for trkseg in tracksegs_old: