normalizeTS: Normalize a long time-series table to unit amplitude per...

View source: R/normalizeTS.R

normalizeTSR Documentation

Normalize a long time-series table to unit amplitude per channel.

Description

Divides the signal column s by the peak amplitude of a reference quantity (norm) for every ⁠(metadata, OCID)⁠ group. The same scale factor is applied to all ID values within each group so that the physical relationship between AT, VT, and DT is preserved.

The default norm = "PGA" scales by 1 / max(abs(s)) computed from ID == "AT" rows, making max(abs(AT)) = 1 for every channel. The same SF is then applied to the corresponding VT and DT rows.

Modifies .x in place; returns .x[].

Usage

normalizeTS(.x, norm = "PGA")

Arguments

.x

Canonical TSL data.table with columns t, s, ID, and OCID, plus optional metadata columns.

norm

character. Reference quantity used to derive the scale factor. "PGA" (default) uses max(abs(AT)), "PPV" uses max(abs(VT)), "PGD" uses max(abs(DT)).

Value

.x with s scaled in place.

See Also

VT2TS(), mapComponents()

Examples

t <- seq(0, 1, by = 0.01)
tsl <- data.table::rbindlist(list(
  data.table::data.table(t = t, s = 2 * sin(2 * pi * t),
                         ID = "AT", OCID = "H1"),
  data.table::data.table(t = t, s = cos(2 * pi * t),
                         ID = "VT", OCID = "H1"),
  data.table::data.table(t = t, s = sin(pi * t),
                         ID = "DT", OCID = "H1")
))
normalizeTS(tsl)
max(abs(tsl[ID == "AT", s]))


gmsp documentation built on July 18, 2026, 5:07 p.m.