2. Signal Preprocessing for Correlation: Filtering, Resampling, and Alignment
Why Preprocessing Decides the Correlation Outcome
In test-CAE correlation, the raw signals rarely share a common time base, sampling rate, or noise floor. A physical accelerometer channel may be logged at 51.2 kHz with a 0.5 Hz high-pass filter already applied by the DAQ, while the CAE solver output is written at a uniform 10 kHz with no filtering. If you feed both directly into a CORA scorecard, the metric will penalize differences that are artifacts of acquisition and export, not of the underlying physics. Preprocessing is therefore not cosmetic cleanup — it is the step that makes the comparison physically meaningful and the CORA score defensible.
This case works through three preprocessing levers — filtering, resampling, and time alignment — applied to a single representative channel, and quantifies how each choice shifts the CORA magnitude and phase metrics. The goal is not to find one "correct" recipe but to understand the sensitivity, so that when a score changes you can attribute it to physics or to preprocessing.
Reference Setup and Example Signals
Use a synthetic but physically plausible pair so the effect of each lever is isolated and reproducible. The test signal is a damped two-mode response sampled at 20 kHz; the CAE signal is the same underlying response sampled at 5 kHz, delayed by 3.2 ms, with a small amplitude scale error and additive broadband noise on the test side. All numbers below are teaching values chosen to make the effects visible; they are not measured data.
import numpy as np
fs_test, fs_cae = 20_000.0, 5_000.0 # Hz
T = 0.20 # s, analysis window
t_test = np.arange(0, T, 1/fs_test)
t_cae = np.arange(0, T, 1/fs_cae)
def response(t, delay=0.0, gain=1.0):
# two lightly damped modes, 180 Hz and 640 Hz
r = (np.exp(-40*t)*np.sin(2*np.pi*180*(t-delay))
+ 0.6*np.exp(-90*t)*np.sin(2*np.pi*640*(t-delay)))
return gain * r
rng = np.random.default_rng(7)
test = response(t_test, delay=0.0, gain=1.00) + 0.02*rng.standard_normal(t_test.size)
cae = response(t_cae, delay=3.2e-3, gain=0.92) # 3.2 ms lag, 8% low
The test signal carries noise and a 3.2 ms lead relative to CAE; CAE is 8% low in amplitude. These three defects — noise, lag, gain — map cleanly onto the three preprocessing levers, which is why this pair is useful for a sensitivity study.
The Three Levers and Their Interaction
Filtering. A low-pass filter removes the noise floor above the highest mode of interest. With modes at 180 Hz and 640 Hz, a 4th-order Butterworth at 1 kHz preserves both modes while attenuating the broadband noise. Filtering must be applied identically (same type, order, cutoff) to both signals, and applied with zero-phase filtering (filtfilt) so the filter itself does not introduce a group delay that masquerades as a physical lag.
Resampling. CORA compares signals on a common time vector, so the 20 kHz test must be brought to the 5 kHz CAE grid (or both to a common grid). Downsampling without an anti-alias filter folds high-frequency noise back into the band of interest and inflates the magnitude error. Resample after low-pass filtering, and use a polyphase or FFT-based resampler rather than naive decimation.
Time alignment. The 3.2 ms lag is a pure time shift. CORA's phase metric is highly sensitive to it, while the magnitude metric is largely insensitive. Alignment can be done by cross-correlation peak, by a defined trigger feature (e.g., first zero crossing of the primary mode), or by letting CORA's own time-shift search absorb it. The choice matters: if you align by cross-correlation before scoring, you remove the lag from the phase metric; if you leave it, the phase metric reports it. Both are legitimate, but the scorecard must state which convention is used.
Quantifying the Effect on CORA Metrics
Run the same pair through four preprocessing configurations and record the magnitude and phase metrics. The table below uses illustrative values consistent with the signal defects described above; treat them as expected trends, not measured results. The point is the direction and relative size of each shift.
| Configuration | Filter | Resample | Align | Magnitude metric | Phase metric |
|---|---|---|---|---|---|
| A — raw | none | none | none | poor (noise + gain) | poor (3.2 ms lag) |
| B — filter only | 1 kHz LP | none | none | improved | unchanged (lag remains) |
| C — filter + resample | 1 kHz LP | 20→5 kHz | none | best magnitude | unchanged (lag remains) |
| D — full chain | 1 kHz LP | 20→5 kHz | cross-corr | best magnitude | best phase |
Two conclusions follow directly. First, the phase metric is dominated by alignment: configurations B and C do nothing for it, and only D recovers it. Second, the magnitude metric is dominated by filtering and resampling: the noise floor and the aliasing both inflate it, and the 8% gain error remains as a residual that preprocessing cannot remove — that is a genuine physics discrepancy and should stay in the score. This separation is exactly what makes the CORA scorecard interpretable: a low phase score with a high magnitude score points to a timing issue, while the reverse points to an amplitude/scaling issue.
Reproducible Procedure
- Confirm both signals share units and channel mapping (carried over from ingestion).
- Choose the cutoff from the highest mode of interest — here 1 kHz for modes at 180 and 640 Hz — and apply a zero-phase Butterworth to both signals.
- Resample the higher-rate signal down to the common grid using an anti-aliased resampler; verify the resampled signal still contains both modes by checking the spectrum.
- Align by cross-correlation peak within a bounded search window (e.g., ±10 ms); record the applied shift.
- Score with CORA and record magnitude and phase metrics separately, not just the overall score.
- Repeat with one lever disabled at a time to attribute any score change to a specific preprocessing choice.
Verification criteria: after filtering, the noise floor above 1 kHz should drop by the filter's stopband attenuation; after resampling, the spectrum below 1 kHz should be unchanged; after alignment, the cross-correlation peak should sit at zero lag. If the phase metric does not improve after alignment, the shift search window is likely too narrow or the alignment feature is ambiguous.