377 outfile.close() |
377 outfile.close() |
378 print 'modified copy written to', ofname |
378 print 'modified copy written to', ofname |
379 |
379 |
380 # plot result to screen |
380 # plot result to screen |
381 if options.plot: |
381 if options.plot: |
382 import pylab as pl |
382 from subprocess import Popen, PIPE |
|
383 |
383 latm, lonm, elesum = xyz_to_latlonele(sumx, sumy, sumz) |
384 latm, lonm, elesum = xyz_to_latlonele(sumx, sumy, sumz) |
384 |
385 |
385 for trkseg in tracksegs_old: |
386 for trkseg in tracksegs_old: |
386 y_old = [] |
387 data_old = [] |
387 x_old = [] |
|
388 for trkpt in trkseg: |
388 for trkpt in trkseg: |
389 xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) |
389 xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) |
390 x_old.append(xy[0]) |
390 data_old.append (xy) |
391 y_old.append(xy[1]) |
|
392 pl.plot(x_old, y_old, 'r.-') |
|
393 |
391 |
394 for trkseg in tracksegs_new: |
392 for trkseg in tracksegs_new: |
395 y_new = [] |
393 data = [] |
396 x_new = [] |
|
397 for trkpt in trkseg: |
394 for trkpt in trkseg: |
398 xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) |
395 xy = project_to_meters(trkpt[0], trkpt[1], latm, lonm) |
399 x_new.append(xy[0]) |
396 data.append (xy) |
400 y_new.append(xy[1]) |
397 |
401 pl.plot(x_new, y_new, 'b.-') |
398 #~ gnuPlotCmd = ['gnuplot', '-persist'] |
402 pl.grid() |
399 gnuPlotCmd = ['gnuplot'] |
403 pl.gca().set_aspect('equal') |
400 plot = Popen (gnuPlotCmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) |
404 pl.xlabel('x [m]') |
401 plot.stdin.write (b"plot '-' with linespoints lc rgb 'red' pt 4, '-' with linespoints pt 6\n") |
405 pl.ylabel('y [m]') |
402 plot.stdin.write ("\n".join ('%f %f' % d for d in data).encode ()) |
406 pl.show() |
403 plot.stdin.write (b'\ne\n') |
|
404 plot.stdin.write ("\n".join ('%f %f' % d for d in data_old).encode ()) |
|
405 plot.stdin.write (b'\ne\n') |
|
406 plot.stdin.flush () |
|
407 #~ raw_input ('druk') |
|
408 while 1: time.sleep (1) |