Module temporal

Module temporal 

Source
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§

TemporalFilter
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