Expand description
Polars-first temporal filtering operations for event camera data
This module provides time-based filtering functionality using Polars DataFrames and LazyFrames for maximum performance and memory efficiency. All operations work directly with Polars expressions and avoid unnecessary conversions.
§Philosophy
This implementation follows a strict Polars-first approach:
- Input: LazyFrame (from events_to_dataframe)
- Processing: Polars expressions and transformations
- Output: LazyFrame (convertible to Vec
/numpy only when needed)
§Performance Benefits
- Lazy evaluation: Operations are optimized and executed only when needed
- Vectorized operations: All filtering uses SIMD-optimized Polars operations
- Memory efficiency: No intermediate Vec
allocations - Query optimization: Polars optimizes the entire filtering pipeline
§Example
use polars::prelude::*;
use evlib::ev_filtering::temporal::*;
// Convert events to LazyFrame once
let events_df = events_to_dataframe(&events)?.lazy();
// Apply temporal filtering with Polars expressions
let filtered = apply_temporal_filter(events_df, &TemporalFilter::time_window(1.0, 5.0))?;
Structs§
- Temporal
Filter - Temporal filtering configuration optimized for Polars operations
Constants§
- COL_
POLARITY - COL_T
- COL_X
- Polars column names for event data
- COL_Y
Functions§
- apply_
temporal_ filter - Apply temporal filtering using Polars expressions
- calculate_
event_ rates - Calculate event rates over time windows using Polars
- filter_
by_ time_ df - Filter events by time window - DataFrame-native version (recommended)
- filter_
time_ window - Filter events by time window using Polars expressions
- get_
temporal_ statistics - Get temporal statistics using Polars aggregations