Skip to content

Commit

Permalink
Merge pull request #167 from ljwolf/range-queries
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer committed Aug 23, 2022
2 parents 3e3d35c + 5760c15 commit b5b62f4
Show file tree
Hide file tree
Showing 8 changed files with 442 additions and 216 deletions.
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

0 comments on commit b5b62f4

Please sign in to comment.