Skip to content

crashmetrics.acceleration

acceleration

Acceleration time-history metrics.

Functions:

  • peak: Peak acceleration and the time at which it occurs.
  • clip_3ms: The "3 ms clip": the highest acceleration level that is reached or exceeded for 3 ms, cumulatively or continuously.
  • exceedance_level: The highest level reached or exceeded for any given duration.
  • exceedance_duration: How long a signal is at or above a given level.
  • exceedance_check: Compare a signal's exceedance curve with a level-duration limit (e.g. UN-ECE R94 femur and neck force criteria).

Inputs are normally a filtered resultant in g (see crashmetrics.signals), with time in seconds. The signal is treated as piecewise linear between samples.

PeakResult dataclass

PeakResult(value: float, time: float)

Result of a peak calculation.

value instance-attribute

value: float

Peak value, in the unit of the input acceleration.

time instance-attribute

time: float

Time of the peak in seconds.

time_ms property

time_ms: float

Time of the peak in milliseconds.

ExceedanceCheckResult dataclass

ExceedanceCheckResult(
    peak: float,
    peak_time: float,
    utilisation: float,
    critical_duration_ms: float,
    passed: bool,
    levels: NDArray[float64],
    durations_ms: NDArray[float64],
)

Result of exceedance_check.

peak instance-attribute

peak: float

Peak of the assessed signal (after direction is applied).

peak_time instance-attribute

peak_time: float

Time of the peak, in seconds.

utilisation instance-attribute

utilisation: float

Largest ratio of the exceedance curve to the limit; above 1 the limit is exceeded.

critical_duration_ms instance-attribute

critical_duration_ms: float

Duration (ms) at which the utilisation is largest.

passed instance-attribute

passed: bool

True if utilisation <= 1.

levels instance-attribute

levels: NDArray[float64]

Levels of the exceedance curve, highest first.

durations_ms instance-attribute

durations_ms: NDArray[float64]

Time (ms) the signal is at or above each level.

peak

peak(
    time: ArrayLike,
    acceleration: ArrayLike,
    absolute: bool = False,
) -> PeakResult

Return the peak acceleration and when it occurs.

Parameters:

Name Type Description Default
time ArrayLike

1D time array in seconds.

required
acceleration ArrayLike

1D acceleration, for example a resultant in g.

required
absolute bool

If True, return the largest magnitude, for signed axis components. The reported value keeps its sign.

False

Returns:

Type Description
PeakResult

Peak value (in the unit of acceleration) and its time. If the peak occurs more than once, the first is reported.

clip_3ms

clip_3ms(
    time: ArrayLike,
    acceleration: ArrayLike,
    duration_ms: float = 3.0,
    mode: Literal[
        "cumulative", "continuous"
    ] = "cumulative",
) -> float

Return the 3 ms clip of an acceleration signal.

Parameters:

Name Type Description Default
time ArrayLike

1D time array in seconds.

required
acceleration ArrayLike

1D acceleration, normally a filtered resultant in g.

required
duration_ms float

Exceedance duration in milliseconds. Defaults to 3 ms.

3.0
mode Literal['cumulative', 'continuous']

"cumulative" (default): the highest level that the signal reaches or exceeds for duration_ms in total, possibly over several separate intervals.

"continuous": the highest level that the signal reaches or exceeds throughout a single interval of duration_ms.

Check which definition your assessment protocol requires.

'cumulative'

Returns:

Type Description
float

Clip level, in the unit of acceleration.

Notes

The signal is linearly interpolated between samples. The cumulative value is computed exactly for that interpolation; the continuous value is found by bisection to floating-point precision. The continuous value is never higher than the cumulative value.

exceedance_level

exceedance_level(
    time: ArrayLike,
    signal: ArrayLike,
    duration_ms: float,
    mode: Literal[
        "cumulative", "continuous"
    ] = "cumulative",
) -> float

Return the highest level reached or exceeded for duration_ms.

This generalises clip_3ms to any duration and any signal, for example a femur force. A duration of 0 returns the maximum.

Parameters:

Name Type Description Default
time ArrayLike

1D time array in seconds.

required
signal ArrayLike

1D signal.

required
duration_ms float

Exceedance duration in milliseconds, zero or more.

required
mode Literal['cumulative', 'continuous']

"cumulative" (total time, possibly over several intervals) or "continuous" (a single interval).

'cumulative'

Returns:

Type Description
float

Level, in the unit of signal.

exceedance_duration

exceedance_duration(
    time: ArrayLike,
    signal: ArrayLike,
    level: float,
    mode: Literal[
        "cumulative", "continuous"
    ] = "cumulative",
) -> float

Return how long the signal is at or above level, in ms.

Parameters:

Name Type Description Default
time ArrayLike

1D time array in seconds.

required
signal ArrayLike

1D signal, linearly interpolated between samples.

required
level float

Threshold, in the unit of signal.

required
mode Literal['cumulative', 'continuous']

"cumulative": total time at or above level. "continuous": the longest single interval at or above it.

'cumulative'

Returns:

Type Description
float

Duration in milliseconds.

exceedance_check

exceedance_check(
    time: ArrayLike,
    signal: ArrayLike,
    limit: Sequence[tuple[float, float]],
    mode: Literal[
        "cumulative", "continuous"
    ] = "cumulative",
    direction: Literal[
        "positive", "negative", "absolute"
    ] = "positive",
) -> ExceedanceCheckResult

Check a signal against a level-duration (exceedance) limit.

Parameters:

Name Type Description Default
time ArrayLike

1D time array in s.

required
signal ArrayLike

1D signal, e.g. a force in N.

required
limit Sequence[tuple[float, float]]

(duration in ms, level) points starting at 0 ms, with increasing duration and non-increasing level. The limit is linear between points and constant after the last one.

required
mode Literal['cumulative', 'continuous']

"cumulative" (total time above a level, possibly over several intervals) or "continuous" (a single interval).

'cumulative'
direction Literal['positive', 'negative', 'absolute']

Which part of the signal is assessed: "positive" values, "negative" values (as magnitudes, e.g. compression stored as negative force) or "absolute" values.

'positive'
Notes

For each level L, let D(L) be the time the assessed signal is at or above L. The limit is exceeded if L > limit(D(L)) for some L; the utilisation is the largest L / limit(D(L)).

In cumulative mode D is linear in L between sample values, so checking every sample value and every level where D meets a limit breakpoint is exact for the linearly interpolated signal. In continuous mode 2000 evenly spaced levels are added as well.