Beispiel #1
0
def plotDensity():
    traf = Traffic(trafPath)
    pop = Population(popPath, longitudeRange, latitudeRange)
    nSample = 50
    X = np.linspace(120.85, 121.98, nSample)
    Y = np.linspace(30.67, 31.51, nSample)
    gX, gY = np.meshgrid(X, Y)
    Z = np.ndarray((nSample, nSample))
    for i in range(nSample):
        for j in range(nSample):
            trafDen = traf.estimateDensity([X[i], Y[j]], 8e-3) / 350
            popDen = pop.estimateDensity([X[i], Y[j]]) / 4.8e4
            den = trafDen * popDen
            if den != 0:
                den /= (trafDen + popDen)
            Z[i, j] = den
    fig = plt.figure()
    ax = Axes3D(fig)
    ax.plot_surface(gX, gY, Z, rstride=1, cstride=1, cmap=plt.cm.Blues)
    plt.show()
Beispiel #2
0
pop = Population(popPath, longitudeRange, latitudeRange)

sheet = get_sheet()

#get des_p , des_in_which_route
des_in_which_route = [0 for i in range(50)]
p = [0 for i in range(50)]
num_ = 0
for i in range(6):
    bo = 0
    for j in sheet[i].values:
        if bo == 0:
            bo = 1
        else:
            trafDen = traf.estimateDensity([j[0], j[1]], 8e-3) / 350
            popDen = pop.estimateDensity([j[0], j[1]]) / 4.8e4
            den = trafDen * popDen
            if den != 0:
                den /= (trafDen + popDen)
            p[num_] = den
            des_in_which_route[num_] = i
            num_ += 1

#get route_time
route_time = [0 for i in range(6)]
d = [0 for i in range(50)]
max_routetime = 60
num_ = 0
for i in range(6):
    bo = 0
    for j in sheet[i].values: