# Grab the first noisy points data set and the true points data set (the fourth
# set) to be used in the plotting example
pings = open("data/pings", "r")
reader = csv.reader(pings, delimiter='|')
xNpos = map(lambda x: float(x), reader.next())
yNpos = map(lambda x: float(x), reader.next())
for i in range (0, 4): reader.next()
xpos = reader.next()
ypos = reader.next()
pings.close()

# Set up curve with guidepoints estimated from first noisy data set
n = 20
xEpos, yEpos = genBezierPlot(rt.x, rt.y, [est_x0pl[0]], [est_y0pl[0]], \
                             [0, est_x1mi[0]], [0, est_y1mi[0]], n)

# Plot noisy pings, estimated flight path, true flight path
plt.figure(1, facecolor='white');
plt.clf();
plt.plot(xpos, ypos, '-', linewidth=1.0, \
         color='g', label='Actual Flight Path')
plt.plot(xEpos, yEpos, '-', linewidth=1.0, \
         color='r', label = 'Estimated Flight Path')
plt.plot(xNpos, yNpos, '.', linewidth=1.0, \
         color='k', label = 'Noisy Data Points')
plt.xlabel('Longitude')
plt.ylabel('Latitude')
plt.legend(loc='lower right')
if input1 == "1":
    plt.title("Los Angeles to New York")
Example #2
0
                        "...Leaving blank will default to n.\n",\
                     "^[yn]$", "n")

if input1 == "1":
    rt = pre.la_ny
elif input1 == "2":
    rt = pre.rm_pa
else:
    rt = pre.ct_tk


# Generate list of coordinates on Bezier curve polynomial, n is number of
# coordinates
n = 20
xpos, ypos = \
        genBezierPlot(rt.x, rt.y, rt.xPlus, rt.yPlus, rt.xMinus, rt.yMinus, n)

# Generate new coordinate lists with noise - keep the
# take-off/landing coordinates the same, since those are known. These are
# saved to be used later in data/pings. The first noisy coordinate list pair
# generated is stored for use in the plot, it will be plotted again in another
# script for comparison
xNpos = [None]*n
yNpos = [None]*n
pings = open("data/pings", "wb")
writer = csv.writer(pings, delimiter='|')
for i in range (0,3):
    xNpos[0]   = xpos[0]
    xNpos[n-1] = xpos[n-1]
    yNpos[0]   = ypos[0]
    yNpos[n-1] = ypos[n-1]