summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2010-04-22 01:11:04 -0700
committerGary E. Miller <gem@rellim.com>2010-04-22 01:11:04 -0700
commit2d9f2f9258145e5b33aa0c2801b0d0cf0f0fa396 (patch)
tree7848ece0add3a5befe9f35a461cc4e085a874873 /gpsprof
parent182754f0e068dc4cf1f2bd2e0f3fbefe28d58886 (diff)
downloadgpsd-2d9f2f9258145e5b33aa0c2801b0d0cf0f0fa396.tar.gz
Revert last patch on layering of plot data.
Add EP (50%) of altitude data. My Python is pathetic, feel free to improve.
Diffstat (limited to 'gpsprof')
-rwxr-xr-xgpsprof12
1 files changed, 9 insertions, 3 deletions
diff --git a/gpsprof b/gpsprof
index b14204d4..e88936b7 100755
--- a/gpsprof
+++ b/gpsprof
@@ -78,19 +78,25 @@ class spaceplot:
cep_meters = gps.EarthDistance(self.centroid[:2], self.fixes[len(self.fixes)/2][:2])
alt_sum = 0
alt_num = 0
+ alt_fixes = []
lon_max = -9999
for i in range(len(self.recentered)):
(lat, lon) = self.recentered[i][:2]
(raw1, raw2, alt) = self.fixes[i]
if not gps.isnan(alt):
alt_sum += alt
+ alt_fixes.append( alt)
alt_num += 1
if lon > lon_max :
lon_max = lon
if alt_num == 0:
alt_avg = gps.NaN
+ alt_ep = gps.NaN
else:
alt_avg = alt_sum / alt_num
+ # Sort fixes by distance from average altitude
+ alt_fixes.sort(lambda x, y: cmp(abs(alt_avg - x), abs(alt_avg - y)))
+ alt_ep = abs( alt_fixes[ len(alt_fixes)/2 ] - alt_avg)
if self.centroid[0] < 0:
latstring = "%fS" % -self.centroid[0]
elif self.centroid[0] == 0:
@@ -124,10 +130,10 @@ class spaceplot:
fmt += 'chlen = cep/20\n'
fmt += "set arrow from -chlen,0 to chlen,0 nohead\n"
fmt += "set arrow from 0,-chlen to 0,chlen nohead\n"
- fmt += 'plot using 1:2 with points ls 3 title "%d GPS fixes" ' % (len(self.fixes))
- fmt += ' "-" cx(t, cep),cy(t, cep) title "CEP (50%%) = %f meters", ' % (cep_meters)
+ fmt += 'plot cx(t, cep),cy(t, cep) title "CEP (50%%) = %f meters", ' % (cep_meters)
+ fmt += ' "-" using 1:2 with points ls 3 title "%d GPS fixes" ' % (len(self.fixes))
if not gps.isnan(alt_avg):
- fmt += ', "-" using ( %f ):($5 < 100000 ? $5 - %f : 1/0) axes x1y2 with points ls 2 title " %d Altitude fixes, Average = %f" \n' % (lon_max +1, alt_avg, alt_num, alt_avg)
+ fmt += ', "-" using ( %f ):($5 < 100000 ? $5 - %f : 1/0) axes x1y2 with points ls 2 title " %d Altitude fixes, Average = %f, EP (50%%) = %f" \n' % (lon_max +1, alt_avg, alt_num, alt_avg, alt_ep)
else:
fmt += "\n"
fmt += self.header(session)