diff options
-rwxr-xr-x | gps.py | 11 | ||||
-rwxr-xr-x | gpsprof | 2 |
2 files changed, 10 insertions, 3 deletions
@@ -9,8 +9,15 @@ from math import * # PEP 75 (http://python.fyxm.net/peps/pep-0754.html). # This includes at least versions up to 2.3.4. PosInf = 1e300000 -NaN = PosInf/PosInf -def isnan(x): return x == NaN +# NaN = PosInf/PosInf +# IEEE754 says NaN == NaN is always false! +# so this is wrong: +# def isnan(x): return x == NaN + +# so let's use PosInf as a proxy +# this is not mathmetically correct but good enough for altitude +NaN = PosInf +def isnan(x): return x > 1e300000 ONLINE_SET = 0x00000001 TIME_SET = 0x00000002 @@ -121,7 +121,7 @@ class spaceplot: 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 != NaN ? $5 - %f : Inf) 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 : Inf) axes x1y2 with points ls 2 title " %d Altitude fixes, Average = %f" \n' % (lon_max +1, alt_avg, alt_num, alt_avg) else: fmt += "\n" fmt += self.header(session) |