Skip to content

Commit

Permalink
continued bug fixes and graph visualizations
Browse files Browse the repository at this point in the history
  • Loading branch information
pbnjam-es committed Jan 28, 2023
1 parent 37164e6 commit 9128c9a
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 70 deletions.
Binary file added 2010_california_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2010_florida_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2010_illinois_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2010_kentucky_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2010_maine_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 2010_maryland_geodata.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed before_connected_2010_vermont_geodata.png
Binary file not shown.
6 changes: 6 additions & 0 deletions graph_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def visualize_graph(graph, output_path, coords, colors=None, edge_colors=None, s
modified_coords = modify_coords(
[coords(node) for node in graph_nodes], [2000, 2000]
)

print("Coordinates modified")

if colors is not None:
node_colors = [colors(node) for node in graph_nodes]
Expand Down Expand Up @@ -140,13 +142,17 @@ def visualize_graph(graph, output_path, coords, colors=None, edge_colors=None, s
width=1
)

print("Edges drawn")

for center, node, color, r in zip(modified_coords, graph_nodes,
node_colors, node_sizes):
draw.ellipse(
[(center[0] - r, center[1] - r),
(center[0] + r, center[1] + r)],
fill=color
)

print("Nodes drawn")
# y_coords = [42.72685, 42.848564, 43.022452, 43.213817, 43.354144, 43.533341, 43.607655, 43.750837, 43.873348, 44.008176, 44.107845, 44.185469, 44.304375, 44.382911, 44.461759, 44.492504, 44.57663, 44.670759, 44.781578, 44.858507]
# y_coords = [shapely.geometry.Point((-73, coord)) for coord in y_coords]
# new_y_coords = modify_coords(y_coords, [2000,2000])
Expand Down
188 changes: 118 additions & 70 deletions serialize.py

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions temp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import geopandas as gpd

x = gpd.read_file("good_target_geometry.json")
post = gpd.read_file("post_target_geometry.json")
x = x.set_index("geoid")
post = post.set_index("geoid")
x_set = set(x.index)
post_set = set(post.index)
diff = post_set.difference(x_set)
geoid = post.loc[diff]
print(geoid)

0 comments on commit 9128c9a

Please sign in to comment.