visualdynamics.core.truncate¶
truncate
¶
Truncating a record to the stretch that matters.
A recording rarely starts and stops where the test does: there is a lead-in before the excitation reaches level, a tail after it stops, sometimes a false start at the front of the file. The truncation names the stretch to keep — a start and a stop, in seconds — and Truncate Data makes the record that holds only that stretch, every channel cut at the same two instants so the set stays one record.
The clock is kept. A truncated record's samples keep their measured instants rather than being re-zeroed: the sample recorded at t = 1.25 s still says 1.25 s, so events line up with the recording they came from, with the setup log, and with any untruncated channel set beside them. A re-zeroed clock would be a second time base to reconcile, silently.
No marks are carried. core.filters carries the averaging frames
and shock windows onto what it makes because the abscissa is the same
and the marks still say what they said. Here the abscissa changed —
that is the whole point — and a frame or a window can refer to samples
that no longer exist, so the honest answer is a clean record: re-find
the shocks, re-frame the averaging, on the data that is actually
there.
Classes:
| Name | Description |
|---|---|
Truncation |
The stretch a record is cut to: start and stop, in seconds. |
Functions:
| Name | Description |
|---|---|
truncate |
The record between the truncation's start and stop, inclusive |
Classes¶
Truncation
dataclass
¶
The stretch a record is cut to: start and stop, in seconds.
On the record's own clock — which may not begin at zero, since a truncated record keeps its measured instants — so a second cut of an already-cut record means what it says.
Frozen like Averaging and Filtering, and for the same reason:
the settings ride the history, the staleness fingerprint is their
fields, and a mutable setting would be a fingerprint that lies.
Methods:
| Name | Description |
|---|---|
describe |
The cut in words — 'keeping 0.5 to 2 s'. One implementation: |
Functions:¶
truncate
¶
truncate(
data: TimeHistory, truncation: Truncation
) -> TimeHistory
The record between the truncation's start and stop, inclusive at both ends, every channel cut at the same two instants.
A sample is kept when its own instant lies inside the span — read off the abscissa, so an unevenly sampled record cuts correctly too. Refuses a span holding fewer than two samples: one sample has no sample rate, and no downstream reading can be made from it.