Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…-act into main
  • Loading branch information
formularin committed Mar 6, 2023
2 parents 4058c79 + b28825a commit 79bd9a7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ examples/*.png
NC_ensemble_10000

debug.py

maryland
new_hampshire
4 changes: 3 additions & 1 deletion rba/district_quantification.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ def quantify_districts(graph_file, district_file, difference_file, verbose=False
with open(graph_file, "r") as f:
graph_json = json.load(f)
graph = nx.readwrite.json_graph.adjacency_graph(graph_json)
districts = load_districts(graph, district_file)
# districts = load_districts(graph, district_file)
with open(district_file, "r") as f:
districts = json.load(f)

with open(difference_file, "r") as f:
supercommunity_output = json.load(f) # Contains strings as keys.
Expand Down
3 changes: 1 addition & 2 deletions rba/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ def ensemble_analysis(graph_file, difference_file, vra_config_file, num_steps, n

if optimize_vis:
output_dir = vis_dir

# Save a histogram of statewide scores.
plt.hist(scores_df["state_gerry_score"], bins=30)
plt.axvline(scores_df["state_gerry_score"].mean(), color='k', linestyle='dashed', linewidth=1)
Expand All @@ -466,7 +465,7 @@ def get_z_score(precinct, metric):
districts_assignment[node] = district
districts_partition = Partition(graph, assignment=districts_assignment)

_, ax = plt.subplots(figsize=(60, 30))
_, ax = plt.subplots(figsize=(12.8, 9.6))
visualize_gradient_geopandas(
sorted_node_names,
get_value=partial(get_z_score, metric="score"),
Expand Down

0 comments on commit 79bd9a7

Please sign in to comment.