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

New time panel density graph #1557

Merged
merged 45 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a39f6f4
Refactor: move the data density graph to its own file
emilk Mar 9, 2023
a907ade
Cleanup: use TimeRange
emilk Mar 9, 2023
f3306b4
Refactor: simplify further
emilk Mar 9, 2023
adc5eb7
Replace ball scatterer with density graph
emilk Mar 9, 2023
a7d14b3
Tweak
emilk Mar 9, 2023
cbd7327
bug fix
emilk Mar 9, 2023
e914bfd
Small refactor
emilk Mar 9, 2023
0ed27f4
Create time_range_from_x_range helper
emilk Mar 9, 2023
6f7fddf
Allow-list clippy::manual_range_contains
emilk Mar 9, 2023
91b6d3e
objectron-rs fix: only log the base objects once
emilk Mar 9, 2023
4feab7f
Normalize the density graphs
emilk Mar 9, 2023
314c904
Smooth normalization, and selection color
emilk Mar 9, 2023
75ffa77
Highlight on hover
emilk Mar 9, 2023
0104145
Better hover effect
emilk Mar 9, 2023
128d51b
Better naming: `Item` is called `item`
emilk Mar 9, 2023
e5ea8ca
Add a consistent line behind the density graph
emilk Mar 9, 2023
1331a7b
Remove dead code
emilk Mar 9, 2023
ea08f7e
Integrate re_int_histogram
emilk Mar 9, 2023
a71f80a
Remove static_assert that trips up rust-analyzer
emilk Mar 9, 2023
71c6361
Cleanup
emilk Mar 9, 2023
cfbc6c0
Use saturating functions when casting TimeReal -> TimeInt
emilk Mar 9, 2023
385b4e0
Add some TODO:s
emilk Mar 9, 2023
7f520ab
Fix wrong x-range
emilk Mar 9, 2023
a2daee5
Fix typo
emilk Mar 9, 2023
a1325c2
Fix potential integer overflow
emilk Mar 9, 2023
852fbb8
Fix a TODO
emilk Mar 9, 2023
9c5adb3
tweaks
emilk Mar 9, 2023
b0456fe
Tweak colors
emilk Mar 10, 2023
4cdebcf
Add some tests
emilk Mar 10, 2023
5b6b52c
re_int_histogram: make `range` return tight ranges
emilk Mar 10, 2023
d97f01d
Faster data density graph
emilk Mar 10, 2023
46dd17a
Switch to the faster re_int_histogram
emilk Mar 10, 2023
25f13d2
Smoother density graph using box filter
emilk Mar 10, 2023
65bcb90
Code cleanup
emilk Mar 10, 2023
0ad8057
Make TimeAxis run in logarithmic time
emilk Mar 10, 2023
9e3b72e
Fix typos
emilk Mar 10, 2023
b87c180
Tweak the normalization speed
emilk Mar 10, 2023
42f4e60
Self-review cleanup
emilk Mar 11, 2023
19e8db1
Add feathering anti-aliasing to the density graph painter
emilk Mar 11, 2023
2a8cea8
use `mod` instead of comments
emilk Mar 13, 2023
40cefdc
Remove dead static_assertions
emilk Mar 13, 2023
5e20df9
typo
emilk Mar 13, 2023
296680c
nits
emilk Mar 13, 2023
f2ba31f
Merge branch 'main' into emilk/refactor-data-density-graph
emilk Mar 13, 2023
2fdab8a
fix docstring link
emilk Mar 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ re_build_web_viewer = { path = "crates/re_build_web_viewer", version = "0.3.0" }
re_data_store = { path = "crates/re_data_store", version = "0.3.0" }
re_error = { path = "crates/re_error", version = "0.3.0" }
re_format = { path = "crates/re_format", version = "0.3.0" }
re_int_histogram = { path = "crates/re_int_histogram", version = "0.3.0" }
re_log = { path = "crates/re_log", version = "0.3.0" }
re_log_types = { path = "crates/re_log_types", version = "0.3.0" }
re_memory = { path = "crates/re_memory", version = "0.3.0" }
Expand Down
4 changes: 3 additions & 1 deletion Cranky.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ warn = [
]

allow = [
# TODO(emilk): enable more lints
"clippy::manual_range_contains", # this one is just worse imho

# TODO(emilk): enable more of these lints:
"clippy::cloned_instead_of_copied",
"clippy::missing_errors_doc",
"trivial_casts",
Expand Down
1 change: 1 addition & 0 deletions crates/re_data_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ serde = ["dep:serde", "re_log_types/serde"]

[dependencies]
re_arrow_store.workspace = true
re_int_histogram.workspace = true
re_log_types.workspace = true
re_log.workspace = true
re_smart_channel.workspace = true
Expand Down
33 changes: 15 additions & 18 deletions crates/re_data_store/src/entity_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,31 @@ use re_log_types::{

// ----------------------------------------------------------------------------

/// Number of messages per time
pub type TimeHistogram = re_int_histogram::Int64Histogram;

/// Number of messages per time per timeline
#[derive(Default)]
pub struct TimeHistogramPerTimeline(BTreeMap<Timeline, BTreeMap<TimeInt, usize>>);
pub struct TimeHistogramPerTimeline(BTreeMap<Timeline, TimeHistogram>);

impl TimeHistogramPerTimeline {
pub fn timelines(&self) -> impl ExactSizeIterator<Item = &Timeline> {
self.0.keys()
}

pub fn get(&self, timeline: &Timeline) -> Option<&BTreeMap<TimeInt, usize>> {
pub fn get(&self, timeline: &Timeline) -> Option<&TimeHistogram> {
self.0.get(timeline)
}

pub fn has_timeline(&self, timeline: &Timeline) -> bool {
self.0.contains_key(timeline)
}

pub fn iter(&self) -> impl ExactSizeIterator<Item = (&Timeline, &BTreeMap<TimeInt, usize>)> {
pub fn iter(&self) -> impl ExactSizeIterator<Item = (&Timeline, &TimeHistogram)> {
self.0.iter()
}

pub fn iter_mut(
&mut self,
) -> impl ExactSizeIterator<Item = (&Timeline, &mut BTreeMap<TimeInt, usize>)> {
pub fn iter_mut(&mut self) -> impl ExactSizeIterator<Item = (&Timeline, &mut TimeHistogram)> {
self.0.iter_mut()
}
}
Expand Down Expand Up @@ -239,13 +240,11 @@ impl EntityTree {
self.num_timeless_messages += 1;
} else {
for (timeline, time_value) in time_point.iter() {
*self
.prefix_times
self.prefix_times
.0
.entry(*timeline)
.or_default()
.entry(*time_value)
.or_default() += 1;
.increment(time_value.as_i64(), 1);
}
}

Expand Down Expand Up @@ -293,10 +292,10 @@ impl EntityTree {
components: fields,
} = self;

for (timeline, map) in &mut prefix_times.0 {
for (timeline, histogram) in &mut prefix_times.0 {
crate::profile_scope!("prefix_times");
if let Some(cutoff_time) = cutoff_times.get(timeline) {
map.retain(|time_int, _count| cutoff_time.is_timeless() || cutoff_time <= time_int);
histogram.remove(..cutoff_time.as_i64());
}
}
{
Expand Down Expand Up @@ -349,13 +348,11 @@ impl ComponentStats {
self.num_timeless_messages += 1;
} else {
for (timeline, time_value) in time_point.iter() {
*self
.times
self.times
.0
.entry(*timeline)
.or_default()
.entry(*time_value)
.or_default() += 1;
.increment(time_value.as_i64(), 1);
}
}
}
Expand All @@ -366,9 +363,9 @@ impl ComponentStats {
num_timeless_messages: _,
} = self;

for (timeline, time_counts) in &mut times.0 {
for (timeline, histogram) in &mut times.0 {
if let Some(cutoff_time) = cutoff_times.get(timeline) {
time_counts.retain(|time_int, _count| cutoff_time <= time_int);
histogram.remove(..cutoff_time.as_i64());
}
}
}
Expand Down
Loading