Skip to main content

CorePlotting::NormalizationHelpers

CorePlotting::NormalizationHelpers

Functions

Name
LayoutTransform forZScore(float mean, float std_dev)
Z-score normalization where output = (value - mean) / std_dev.
LayoutTransform forPeakToPeak(float data_min, float data_max, float target_min =-1.0f, float target_max =1.0f)
Map [data_min, data_max] → [target_min, target_max].
LayoutTransform forStdDevRange(float mean, float std_dev, float num_std_devs =3.0f)
±N standard deviations from mean map to ±1
LayoutTransform forUnitRange(float target_min =-1.0f, float target_max =1.0f)
Map [0, 1] input range to arbitrary output range.
LayoutTransform forPercentileRange(float low_value, float high_value, float target_min =-1.0f, float target_max =1.0f)
Percentile-based normalization.
LayoutTransform forCentered(float center, float gain =1.0f)
Center data at specified value, with optional gain.
LayoutTransform manual(float gain, float offset)
Manual gain and offset specification.

Functions Documentation

function forZScore

inline LayoutTransform forZScore(
    float mean,
    float std_dev
)

Z-score normalization where output = (value - mean) / std_dev.

Parameters:

  • mean Data mean value
  • std_dev Data standard deviation

Return: Transform that applies z-score normalization

Centers data at 0, scales so ±1 = ±1 standard deviation. Useful for comparing signals with different baselines and amplitudes.

function forPeakToPeak

inline LayoutTransform forPeakToPeak(
    float data_min,
    float data_max,
    float target_min =-1.0f,
    float target_max =1.0f
)

Map [data_min, data_max] → [target_min, target_max].

Parameters:

  • data_min Minimum value in data
  • data_max Maximum value in data
  • target_min Desired minimum output (default: -1)
  • target_max Desired maximum output (default: 1)

Return: Transform that maps data range to target range

Peak-to-peak normalization for fitting data into a known range. Default maps to [-1, 1].

function forStdDevRange

inline LayoutTransform forStdDevRange(
    float mean,
    float std_dev,
    float num_std_devs =3.0f
)

±N standard deviations from mean map to ±1

Parameters:

  • mean Data mean value
  • std_dev Data standard deviation
  • num_std_devs Number of standard deviations that map to ±1 (default: 3)

Return: Transform that maps ±N std_devs to ±1

Common for neural data visualization where 3 std_devs → full display range. Data at mean maps to 0, data at mean ± N*std_dev maps to ±1.

function forUnitRange

inline LayoutTransform forUnitRange(
    float target_min =-1.0f,
    float target_max =1.0f
)

Map [0, 1] input range to arbitrary output range.

Parameters:

  • target_min Desired minimum output (default: -1)
  • target_max Desired maximum output (default: 1)

Return: Transform that maps [0,1] to [target_min, target_max]

For data that’s already normalized to [0, 1].

function forPercentileRange

inline LayoutTransform forPercentileRange(
    float low_value,
    float high_value,
    float target_min =-1.0f,
    float target_max =1.0f
)

Percentile-based normalization.

Parameters:

  • low_value Value at low percentile (e.g., 5th percentile)
  • high_value Value at high percentile (e.g., 95th percentile)
  • target_min Desired minimum output (default: -1)
  • target_max Desired maximum output (default: 1)

Return: Transform that maps percentile range to target range

Maps [low_percentile_value, high_percentile_value] to [-1, 1]. Useful for robust normalization that ignores outliers.

function forCentered

inline LayoutTransform forCentered(
    float center,
    float gain =1.0f
)

Center data at specified value, with optional gain.

Parameters:

  • center Value that maps to 0
  • gain Scale factor (default: 1)

Return: Transform that centers at specified value

Output = (value - center) * gain

function manual

inline LayoutTransform manual(
    float gain,
    float offset
)

Manual gain and offset specification.

Parameters:

  • gain Scale factor
  • offset Translation

Return: Transform with specified gain and offset

For full user control: output = value * gain + offset


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