Skip to content

Add uniform series support to TimeseriesGraph for efficient multi-channel timeseries visualization #6

@magland

Description

@magland

Problem

Currently, TimeseriesGraph only supports line, marker, and interval series that require explicit time arrays. For large multi-channel timeseries data with uniform sampling (common in scientific applications), this approach is inefficient because:

  1. Memory overhead: Storing redundant time arrays for each channel
  2. No downsampling: Large datasets can't be efficiently visualized at different zoom levels
  3. Limited multi-channel support: Each channel requires a separate line series

Solution

Add a new add_uniform_series() method to TimeseriesGraph that:

  • Uniform time spacing: Only requires start time and sampling frequency (no explicit time array)
  • Multi-channel support: Single series can contain multiple channels with individual colors and names
  • Efficient storage: Uses downsample pyramid with min/max pairs for fast rendering at any zoom level
  • Dynamic y-limits: Calculates y-axis range from visible data rather than entire dataset
  • Legend integration: Each channel appears as separate legend entry

API Example

# Create multi-channel data (N timepoints × M channels)
data = np.random.randn(1000000, 4)  # 1M timepoints, 4 channels

graph = fp.TimeseriesGraph()
graph.add_uniform_series(
    name="Neural Signals",
    start_time_sec=0.0,
    sampling_frequency_hz=1000.0,
    data=data,
    channel_names=["Ch1", "Ch2", "Ch3", "Ch4"],
    colors=["red", "blue", "green", "orange"],
    width=1.0
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions