mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 00:12:55 +03:00
work on getting the udistrict to run better. add options to handle
outliers in the heatmap
This commit is contained in:
parent
ca33695431
commit
1c3073d0e2
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2904,7 +2904,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
[[package]]
|
||||
name = "seattle_traffic_signals"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/dabreegster/seattle_traffic_signals#e405c128568e6170469678f6ee405d5050adb86a"
|
||||
source = "git+https://github.com/dabreegster/seattle_traffic_signals#864bff01764076fdce455ba34b302a05259f1219"
|
||||
dependencies = [
|
||||
"include_dir 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.106 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -12,7 +12,7 @@ data/input/raw_maps/intl_district.bin,c0a42eb729033bfe8d099d4c8037dc24,https://w
|
||||
data/input/raw_maps/lakeslice.bin,f2c18735bdec05e32af4d420bcc91b31,https://www.dropbox.com/s/4nmdtw0mgqe7tyg/lakeslice.bin.zip?dl=0
|
||||
data/input/raw_maps/montlake.bin,e8a42be882a9dbbf4b06c5d7d47e62d5,https://www.dropbox.com/s/qk8rhwr6vdm79vz/montlake.bin.zip?dl=0
|
||||
data/input/raw_maps/mt_baker.bin,dc0185fd8e335fc103ccd1eb9dc2e66e,https://www.dropbox.com/s/nr18iu83lrcyg8e/mt_baker.bin.zip?dl=0
|
||||
data/input/raw_maps/udistrict.bin,2ab86343fec0846ab3e4eb3518cbf04a,https://www.dropbox.com/s/o1gtavxtw8n3bhy/udistrict.bin.zip?dl=0
|
||||
data/input/raw_maps/udistrict.bin,87afc0ebc87ec1bc1749f6c7f9f688ec,https://www.dropbox.com/s/o1gtavxtw8n3bhy/udistrict.bin.zip?dl=0
|
||||
data/input/raw_maps/west_seattle.bin,5ba6df05c4f80055c389c443586671ad,https://www.dropbox.com/s/112ym2cwg643c9n/west_seattle.bin.zip?dl=0
|
||||
data/input/screenshots/lakeslice/01x01_i325.gif,40b1e76bb29e46823fa52186c891578b,https://www.dropbox.com/s/uiodmxawv8sheb1/01x01_i325.gif.zip?dl=0
|
||||
data/input/screenshots/lakeslice/01x02_i163.gif,bbe0f33acd8fa1cf8fe5028bea8cc9a2,https://www.dropbox.com/s/6zebcdhbeirab49/01x02_i163.gif.zip?dl=0
|
||||
@ -194,7 +194,7 @@ data/system/maps/intl_district.bin,6a69f040ff8e8f767ad2d9582bb2b80b,https://www.
|
||||
data/system/maps/lakeslice.bin,89a8d89d0ac59c6472130f5777e6dd11,https://www.dropbox.com/s/99zi0gcbyvqrkud/lakeslice.bin.zip?dl=0
|
||||
data/system/maps/montlake.bin,9c98456991458bc92394e4cc89b325e7,https://www.dropbox.com/s/zvhm2j5lavixxcr/montlake.bin.zip?dl=0
|
||||
data/system/maps/mt_baker.bin,adf0a19a0ab9732333b30c3af8de273c,https://www.dropbox.com/s/cetje663p04cbgp/mt_baker.bin.zip?dl=0
|
||||
data/system/maps/udistrict.bin,fc01bce2955ffbe00d692e76cbcffdd8,https://www.dropbox.com/s/zqt2je8fadssz5j/udistrict.bin.zip?dl=0
|
||||
data/system/maps/udistrict.bin,bd3bf4d116b8c27965d6a49263dd61b6,https://www.dropbox.com/s/zqt2je8fadssz5j/udistrict.bin.zip?dl=0
|
||||
data/system/maps/west_seattle.bin,bc898001e7c8eeb807457b06df614f43,https://www.dropbox.com/s/5pp1ik9l40yj3wh/west_seattle.bin.zip?dl=0
|
||||
data/system/prebaked_results/lakeslice/weekday.bin,7cdb2e30502595fa4fb5aa51a2a6353c,https://www.dropbox.com/s/1c1sohvy50263wg/weekday.bin.zip?dl=0
|
||||
data/system/prebaked_results/montlake/car vs bike contention.bin,6585d89d8bf8086150e1dc3545459e0e,https://www.dropbox.com/s/jefg0ikjy9dsrdd/car%20vs%20bike%20contention.bin.zip?dl=0
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::common::ColorLegend;
|
||||
use ezgui::{Checkbox, Choice, Color, Composite, EventCtx, GeomBatch, Spinner, TextExt, Widget};
|
||||
use geom::{Bounds, Histogram, Polygon, Pt2D};
|
||||
use geom::{Bounds, Histogram, Polygon, Pt2D, Statistic};
|
||||
|
||||
const NEIGHBORS: [[isize; 2]; 9] = [
|
||||
[0, 0],
|
||||
@ -20,6 +20,7 @@ pub struct HeatmapOptions {
|
||||
resolution: usize,
|
||||
radius: usize,
|
||||
smoothing: bool,
|
||||
outliers: bool,
|
||||
color_scheme: String,
|
||||
}
|
||||
|
||||
@ -29,6 +30,7 @@ impl HeatmapOptions {
|
||||
resolution: 10,
|
||||
radius: 3,
|
||||
smoothing: true,
|
||||
outliers: true,
|
||||
color_scheme: "Turbo".to_string(),
|
||||
}
|
||||
}
|
||||
@ -58,6 +60,7 @@ impl HeatmapOptions {
|
||||
]));
|
||||
|
||||
col.push(Checkbox::text(ctx, "smoothing", None, self.smoothing));
|
||||
col.push(Checkbox::text(ctx, "handle outliers", None, self.outliers));
|
||||
|
||||
col.push(Widget::row(vec![
|
||||
"Color scheme".draw_text(ctx).margin(5),
|
||||
@ -89,6 +92,7 @@ impl HeatmapOptions {
|
||||
resolution: c.spinner("resolution"),
|
||||
radius: c.spinner("radius"),
|
||||
smoothing: c.is_checked("smoothing"),
|
||||
outliers: c.is_checked("handle outliers"),
|
||||
color_scheme: c.dropdown_value("Color scheme"),
|
||||
}
|
||||
} else {
|
||||
@ -200,9 +204,12 @@ pub fn make_heatmap(
|
||||
|
||||
let max_count_per_bucket: Vec<(f64, Color)> = (1..=num_colors)
|
||||
.map(|i| {
|
||||
distrib
|
||||
.percentile(100.0 * (i as f64) / (num_colors as f64))
|
||||
.unwrap() as f64
|
||||
let pct = (i as f64) / (num_colors as f64);
|
||||
if opts.outliers {
|
||||
distrib.percentile(100.0 * pct).unwrap() as f64
|
||||
} else {
|
||||
(pct * (distrib.select(Statistic::Max) as f64)).round()
|
||||
}
|
||||
})
|
||||
.zip(colors.clone().into_iter())
|
||||
.collect();
|
||||
|
@ -53,7 +53,7 @@ pub fn osm_to_raw(name: &str) {
|
||||
"../data/input/seattle/offstreet_parking.bin".to_string(),
|
||||
),
|
||||
private_offstreet_parking: convert_osm::PrivateOffstreetParking::FixedPerBldg(
|
||||
if name == "udistrict" { 3 } else { 1 },
|
||||
if name == "udistrict" { 5 } else { 1 },
|
||||
),
|
||||
// TODO These're buggy.
|
||||
sidewalks: None,
|
||||
|
@ -628,7 +628,11 @@ fn allow_block_the_box(osm_node_id: i64) -> bool {
|
||||
// Rainier and Dearborn
|
||||
osm_node_id == 4607162574 ||
|
||||
// WA 509 and WA 99
|
||||
osm_node_id == 31327525
|
||||
osm_node_id == 31327525 ||
|
||||
// 45th and Union Bay
|
||||
osm_node_id == 31192107 || osm_node_id == 4272330879 || osm_node_id == 53120147 ||
|
||||
// 45th and Montlake
|
||||
osm_node_id == 31430639 || osm_node_id == 29977895 || osm_node_id == 3391705317 || osm_node_id == 29977897
|
||||
}
|
||||
|
||||
// TODO Various problems (bad geometry, multi-intersection turn restrictions) cause
|
||||
|
Loading…
Reference in New Issue
Block a user