Repository navigation
Feat/line lttb fpcs - #27
Merged
Merged
Conversation
Add downsample="lttb". It is MinMaxLTTB: the ungrouped minmax pass runs with a fixed 4x budget, then a pure-Python Largest-Triangle- Three-Buckets pass thins the prefetch to exactly n_points, fewer when x gaps leave buckets empty. The kernel serves resident frames and the streaming plan serves scans, so both source kinds give the same points. Grouped lttb raises until grouped lines get an x-width grid. Rework fpcs on the same two-stage shape. Stage 1 is a new Rust kernel, minmax_pairs_line, that keeps one (x_min, y_min, x_max, y_max) row per bucket, or a pair-emitting streaming plan on scans. Stage 2 is the compensation walk ported to Python. The walk reads only the pair endpoints, so the port matches the old kernel index for index on row-count buckets. Ungrouped fpcs now buckets by x width like minmax and streams on scans instead of materializing the column. Grouped fpcs keeps row-count buckets. The Rust fpcs kernels and the flexviz.fpcs namespace method are deleted. Both stages drop null and NaN rows before they run, so an all-NaN bucket no longer leaks a point. lttb takes a temporal y through its physical representation. Move the line contract onto the trace and make the engine its one authority. LinePlot owns buckets_by_x_width and check_schema, which rejects a missing y and a non-arithmetic y for lttb. The engine checks every line trace against the current source before domain resolution, once per x column, so two lines sharing x pay one sortedness collect. Figure.add_line only records assume_sorted_x. The schema gate folds into LFQueryBuilder.check_line_x. An unknown downsample value now raises at construction instead of running as nth. Stage 2 cost on an M5, best of 5: the LTTB pass 1.1 ms at n_points 1000 and 28 ms at the 25000 cap; the fpcs walk 0.2 ms and 5.2 ms. Full request on 2M rows, n_points 1000: lttb 18 ms resident and 21 ms scan against minmax 15 and 19; fpcs 13 and 19.
Add the lttb bullet to the downsampling guide and Architecture, with the fixed 4x prefetch, the exact-n_points rule, and its limits: no grouping, no cube. Correct the fpcs entries: x-width buckets when ungrouped, row-count when grouped, output up to about 2 * n_points and fewer on gappy x, and a different point set from the scan plan on an exact y plateau. Replace the deleted fpcs kernel entries with minmax_pairs_line. Describe the contract seam: the trace declares its rules, the builder verifies the data and keeps the sorted memo, and the engine checks every line on every request before domain resolution. A bad x or y now fails on the first request, not at add_line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.