fix: show mic as dbL (not psi)
This commit is contained in:
+4
-3
@@ -637,6 +637,7 @@ let eventList = [];
|
|||||||
let currentEvent = 0;
|
let currentEvent = 0;
|
||||||
let charts = {};
|
let charts = {};
|
||||||
let geoRange = 6.206;
|
let geoRange = 6.206;
|
||||||
|
const DBL_REF = 2.9e-9; // 20 µPa in psi — reference pressure for dBL
|
||||||
const CHANNEL_COLORS = { Tran:'#58a6ff', Vert:'#3fb950', Long:'#d29922', Mic:'#bc8cff' };
|
const CHANNEL_COLORS = { Tran:'#58a6ff', Vert:'#3fb950', Long:'#d29922', Mic:'#bc8cff' };
|
||||||
|
|
||||||
// ── Helpers ────────────────────────────────────────────────────────────────────
|
// ── Helpers ────────────────────────────────────────────────────────────────────
|
||||||
@@ -945,7 +946,8 @@ function updatePeaksBar(ev) {
|
|||||||
qs('pk-tran').textContent = pv.tran_in_s != null ? `${pv.tran_in_s.toFixed(5)} in/s` : '—';
|
qs('pk-tran').textContent = pv.tran_in_s != null ? `${pv.tran_in_s.toFixed(5)} in/s` : '—';
|
||||||
qs('pk-vert').textContent = pv.vert_in_s != null ? `${pv.vert_in_s.toFixed(5)} in/s` : '—';
|
qs('pk-vert').textContent = pv.vert_in_s != null ? `${pv.vert_in_s.toFixed(5)} in/s` : '—';
|
||||||
qs('pk-long').textContent = pv.long_in_s != null ? `${pv.long_in_s.toFixed(5)} in/s` : '—';
|
qs('pk-long').textContent = pv.long_in_s != null ? `${pv.long_in_s.toFixed(5)} in/s` : '—';
|
||||||
qs('pk-mic').textContent = pv.micl_psi != null ? `${pv.micl_psi.toExponential(3)} psi` : '—';
|
const micDbl = pv.micl_psi != null && pv.micl_psi > 0 ? 20 * Math.log10(pv.micl_psi / DBL_REF) : null;
|
||||||
|
qs('pk-mic').textContent = micDbl != null ? `${micDbl.toFixed(1)} dBL` : '—';
|
||||||
qs('pk-pvs').textContent = pv.peak_vector_sum != null ? `${pv.peak_vector_sum.toFixed(5)} in/s` : '—';
|
qs('pk-pvs').textContent = pv.peak_vector_sum != null ? `${pv.peak_vector_sum.toFixed(5)} in/s` : '—';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1008,7 +1010,6 @@ function renderWaveform(data) {
|
|||||||
Object.values(charts).forEach(c => c.destroy()); charts = {};
|
Object.values(charts).forEach(c => c.destroy()); charts = {};
|
||||||
|
|
||||||
const micPeakPsi = data.peak_values?.micl_psi ?? null;
|
const micPeakPsi = data.peak_values?.micl_psi ?? null;
|
||||||
const DBL_REF = 2.9e-9;
|
|
||||||
|
|
||||||
for (const [ch, color] of Object.entries(CHANNEL_COLORS)) {
|
for (const [ch, color] of Object.entries(CHANNEL_COLORS)) {
|
||||||
const samples = channels[ch];
|
const samples = channels[ch];
|
||||||
@@ -1031,7 +1032,7 @@ function renderWaveform(data) {
|
|||||||
plotData = samples.map(s => s * micScale);
|
plotData = samples.map(s => s * micScale);
|
||||||
const peakPsi = Math.max(...plotData.map(Math.abs));
|
const peakPsi = Math.max(...plotData.map(Math.abs));
|
||||||
const peakDbl = peakPsi > 0 ? 20 * Math.log10(peakPsi / DBL_REF) : -Infinity;
|
const peakDbl = peakPsi > 0 ? 20 * Math.log10(peakPsi / DBL_REF) : -Infinity;
|
||||||
peakLabel = `${peakDbl.toFixed(1)} dBL (${peakPsi.toExponential(3)} psi)`;
|
peakLabel = `${peakDbl.toFixed(1)} dBL`;
|
||||||
yUnit = 'psi';
|
yUnit = 'psi';
|
||||||
ttFmt = v => `${v.toExponential(3)} psi`;
|
ttFmt = v => `${v.toExponential(3)} psi`;
|
||||||
tickFmt = v => v.toExponential(1);
|
tickFmt = v => v.toExponential(1);
|
||||||
|
|||||||
Reference in New Issue
Block a user