コード例 #1
0
pool.close()
pool.join()
t1 = datetime.datetime.now()
print t1 - t0

paths = GEODESIC.combine_paths(paths)
paths = GEODESIC.remove_zeros(paths)

lons, lats = paths[:, 0], paths[:, 1]

if show:
    plt.figure()
    plt.scatter(lons, lats)
    plt.show()

DENSITY = Density(paths=paths)

H, xedges, yedges = DENSITY.hist2d(paths=paths)

H = np.rot90(H)
H = np.flipud(H)
H = np.ma.masked_where(H == 0, H)

H_avg = np.average(H)
H_std = np.std(H)

print "The point density distribution average for {} is: {} ".format(
    region_name, H_avg)
print "The point density distribution standard deviation for {} is: {} ".format(
    region_name, H_std)
コード例 #2
0
ファイル: network_stats.py プロジェクト: boland1992/SeisSuite
pool.close()
pool.join()
t1 = datetime.datetime.now()
print t1-t0

paths = GEODESIC.combine_paths(paths)
paths = GEODESIC.remove_zeros(paths)

lons, lats = paths[:,0], paths[:,1]

if show:
    plt.figure()
    plt.scatter(lons, lats)
    plt.show()
    
DENSITY = Density(paths=paths)

H, xedges, yedges = DENSITY.hist2d(paths=paths)

H = np.rot90(H)
H = np.flipud(H)
H = np.ma.masked_where(H==0,H)  

H_avg = np.average(H)
H_std = np.std(H)

print "The point density distribution average for {} is: {} ".format(region_name, H_avg)
print "The point density distribution standard deviation for {} is: {} ".format(region_name, H_std)


コード例 #3
0
    paths = pool.map(spread_paths, coord_set)
    pool.close()
    pool.join()
    t1 = datetime.datetime.now()
    print "time to generate new paths", t1-t0
    
    # Append new set of paths now that old set has been deleted.
    
    #create a flattened numpy array of size 2xN from the paths created! 
    paths1 = GEODESIC.combine_paths(paths)

    paths = list(paths)

    paths1 = GEODESIC.remove_zeros(paths1)

    DENSITY = Density(paths=paths1)

    H, xedges, yedges = DENSITY.hist2d(paths=paths1)
    grad = DENSITY.hgrad(H=H)
    
    H_avg1 = np.average(H)
    grad_check1 = np.std(grad)
    
    H_masked = DENSITY.transform_h(H=H)
    grad = DENSITY.transform_grad(grad=grad)

    
    #search = np.where(H<0.1*np.average(H))
    #Hmaxx, Hmaxy =  search[1], search[0]    
    #Hmaxx = (lonmax-lonmin)/(nbins) * Hmaxx + lonmin
    #Hmaxy = (latmax-latmin)/(nbins) * Hmaxy + latmin
コード例 #4
0
        #    GEODESIC.fast_paths(path)

        total_points.append(path)

total_points = list(it.chain(*total_points))
total_points = np.array(total_points)

total_points = np.asarray(INPOLY.points_in(total_points, poly=poly, IN=True))

plt.figure()
plt.scatter(total_points[:, 0], total_points[:, 1])
plt.scatter(coords[:, 0], coords[:, 1], c='orange')

plt.show()

DENSITY = Density(paths=total_points, nbins=nbins)

H, xedges, yedges = DENSITY.hist2d(paths=total_points)

#histogram_GIS = np.column_stack((H, xedges, yedges))

print H.shape, xedges.shape, yedges.shape

coords = np.array([[x, y] for x in xedges[:-1] for y in yedges[:-1]])

H = np.rot90(H)
H = np.flipud(H)
#H = np.rot90(H)
#H = np.rot90(H)

#plt.figure()