In [12]:
import binning
import pysal as ps
import time
Examining shape per bin settings: US counties
In [14]:
sf = ps.examples.get_path("nat.shp")
w = binning.bin_shapefile(sf, shapeDensity=4) # for consistency check
for density in range(1,201):
t1 = time.time()
wd = bin_shapefile(sf, shapeDensity = density)
t2 = time.time()
if wd['potential_neighbors'] != w['potential_neighbors']:
print 'Error: ', wd
results[density] = t2 - t1
In [15]:
density = results.keys()
seconds = results.values()
plot(density, seconds)
ylabel('Seconds')
xlabel('shape density')
title('US counties')
Out[15]:
In [16]:
density[0:5]
Out[16]:
In [17]:
seconds[0:5]
Out[17]:
Artificial Lattice 1000x10
In [18]:
sf = "1000x10.shp"
w = binning.bin_shapefile(sf, shapeDensity=4) # for consistency check
for density in range(1,101):
t1 = time.time()
wd = bin_shapefile(sf, shapeDensity = density)
t2 = time.time()
if wd['potential_neighbors'] != w['potential_neighbors']:
print 'Error: ', wd
results[density] = t2 - t1
In [19]:
density = results.keys()
seconds = results.values()
plot(density, seconds)
ylabel('Seconds')
xlabel('shape density')
title('Regular Lattice 1000x10')
Out[19]:
In [ ]: