Skip to main content

CorePlotting::RasterMapper

CorePlotting::RasterMapper

Mapper for raster plots (PSTH/spike raster style visualization). More…

Classes

Name
struct CorePlotting::RasterMapper::TrialConfig
Configuration for multi-trial raster mapping.

Functions

Name
auto mapEventsRelative(DigitalEventSeries const & series, SeriesLayout const & layout, TimeFrame const & time_frame, int ref_abs_time)
Map events to relative time positions (single row/trial).
auto mapEventsInWindow(DigitalEventSeries const & series, SeriesLayout const & layout, TimeFrame const & time_frame, int ref_abs_time, int window_before, int window_after)
Map events in a time window around reference.
std::vector< MappedElement > mapTrials(std::vector< TrialConfig > const & trials, TimeFrame const & time_frame)
Map multiple trials to a combined MappedElement vector.
std::vector< MappedElement > mapTrialsInWindow(std::vector< TrialConfig > const & trials, TimeFrame const & time_frame, int window_before, int window_after)
Map trials with window filtering.
float computeRowYCenter(int row_index, int total_rows, float y_min =-1.0f, float y_max =1.0f)
Compute Y position for a specific row in a raster plot.
SeriesLayout makeRowLayout(int row_index, int total_rows, std::string series_id, float y_min =-1.0f, float y_max =1.0f)
Create SeriesLayout for a raster row.
std::vector< MappedElement > mapEventsRelativeToVector(DigitalEventSeries const & series, SeriesLayout const & layout, TimeFrame const & time_frame, int ref_abs_time)
Map events relative to reference and return as vector.

Detailed Description

Mapper for raster plots (PSTH/spike raster style visualization).

Transforms event data with relative time positioning. Unlike TimeSeriesMapper which uses absolute time for X coordinates, RasterMapper computes X as the relative offset from a reference event.

This mapper is used for:

  • PSTH raster plots: events aligned to stimulus/behavior
  • Multi-trial visualizations: each trial in a separate row
  • Event-centered analysis: spikes aligned to action potentials

Key difference from TimeSeriesMapper:

  • X = (event_time - reference_time), not absolute time
  • Y = row_index (from RowLayoutStrategy), not stacked position

Functions Documentation

function mapEventsRelative

inline auto mapEventsRelative(
    DigitalEventSeries const & series,
    SeriesLayout const & layout,
    TimeFrame const & time_frame,
    int ref_abs_time
)

Map events to relative time positions (single row/trial).

Parameters:

  • series Event series to map
  • layout Layout allocation for Y positioning (from RowLayoutStrategy)
  • time_frame TimeFrame for index→time conversion
  • ref_abs_time Reference time in absolute time units (e.g., stimulus onset)

Return: Range of MappedElement

Transforms events into (x, y, entity_id) where:

  • X = event_time - reference_time (relative offset)
  • Y = layout.y_transform.offset (row center)

function mapEventsInWindow

inline auto mapEventsInWindow(
    DigitalEventSeries const & series,
    SeriesLayout const & layout,
    TimeFrame const & time_frame,
    int ref_abs_time,
    int window_before,
    int window_after
)

Map events in a time window around reference.

Parameters:

  • series Event series to map
  • layout Layout allocation for Y positioning
  • time_frame TimeFrame for conversion
  • ref_abs_time Reference time in absolute time units (center of window)
  • window_before Time units before reference to include
  • window_after Time units after reference to include

Return: Range of MappedElement for events in window

Only includes events within [reference - window_before, reference + window_after].

function mapTrials

inline std::vector< MappedElement > mapTrials(
    std::vector< TrialConfig > const & trials,
    TimeFrame const & time_frame
)

Map multiple trials to a combined MappedElement vector.

Parameters:

  • trials Vector of trial configurations
  • time_frame TimeFrame for index→time conversion

Return: Vector of MappedElement (all trials combined)

Each trial has its own reference time and Y position. All events from all trials are combined into a single output suitable for building a glyph batch.

function mapTrialsInWindow

inline std::vector< MappedElement > mapTrialsInWindow(
    std::vector< TrialConfig > const & trials,
    TimeFrame const & time_frame,
    int window_before,
    int window_after
)

Map trials with window filtering.

Parameters:

  • trials Vector of trial configurations
  • time_frame TimeFrame for conversion
  • window_before Time units before reference
  • window_after Time units after reference

Return: Vector of MappedElement (filtered by window)

Only includes events within the specified window around each trial’s reference time.

function computeRowYCenter

inline float computeRowYCenter(
    int row_index,
    int total_rows,
    float y_min =-1.0f,
    float y_max =1.0f
)

Compute Y position for a specific row in a raster plot.

Parameters:

  • row_index Index of the row (0-based)
  • total_rows Total number of rows
  • y_min Minimum Y coordinate
  • y_max Maximum Y coordinate

Return: Y center position for this row

Utility for manual row positioning without full LayoutEngine.

function makeRowLayout

inline SeriesLayout makeRowLayout(
    int row_index,
    int total_rows,
    std::string series_id,
    float y_min =-1.0f,
    float y_max =1.0f
)

Create SeriesLayout for a raster row.

Parameters:

  • row_index Index of the row (0-based)
  • total_rows Total number of rows
  • series_id Series identifier
  • y_min Minimum Y coordinate
  • y_max Maximum Y coordinate

Return: SeriesLayout configured for this row

function mapEventsRelativeToVector

inline std::vector< MappedElement > mapEventsRelativeToVector(
    DigitalEventSeries const & series,
    SeriesLayout const & layout,
    TimeFrame const & time_frame,
    int ref_abs_time
)

Map events relative to reference and return as vector.

Parameters:

  • series Event series
  • layout Layout allocation
  • time_frame TimeFrame for conversion
  • ref_abs_time Reference time in absolute time units

Return: Vector of MappedElement


Updated on 2026-11-13 at 20:25:42 +0000