Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Range queries #167

Merged
merged 13 commits into from
Aug 23, 2022
39 changes: 39 additions & 0 deletions examples/range_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import sys
import time

import pandana

import numpy as np
import pandas as pd
from pympler.asizeof import asizeof

print()
print("Loading data...")
t0 = time.time()
store = pd.HDFStore('examples/data/bayareanetwork.h5', 'r')
nodes, edges = store.nodes, store.edges
print(round(time.time()-t0, 1), ' sec.')

print()
print("Initializing network...")
t0 = time.time()
net = pandana.Network(nodes.x, nodes.y, edges.from_int, edges.to_int, edges[['weight']])
store.close()
print(round(time.time()-t0, 1), ' sec.')

print()
print("Calculating nodes in 100m range...")
t0 = time.time()
r = net.nodes_in_range([53114882, 53107159], 100.0)
print(round(time.time()-t0, 1), ' sec.')

# print(net.node_idx.values)
# print(net.node_idx.index.values)

print(asizeof(r)) # 88.8 million bytes raw

print()

# dataframe.info()
# dataframe.memory_usage(deep=True)
# .set_index(['1','2'], inplace=True)
2 changes: 1 addition & 1 deletion pandana/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .network import Network

version = __version__ = '0.6.1'
version = __version__ = '0.7.dev0'
Loading