fbe transform: is 10*log10(RMS) the intended dB convention (vs 20*log10)?
#739
d-chambers
started this conversation in
Ideas
Replies: 1 comment
|
@d-chambers Thanks for pointing this out. This is probably a leftover bug from an earlier version that simply used the amplitude. I will make a pull request |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
While reviewing the new
fbe(Frequency Band Energy) transform ondev, the decibel conversion looks like it may be off by a factor of two (or, equivalently, mixing the amplitude and power dB conventions). Opening this for discussion before changing anything, since it may be an intentional choice tied to a reference implementation.Current behavior
dascore/transform/fbe.py:So the linear output is the windowed RMS amplitude of the band-passed signal:
and the dB output is:
Why this looks inconsistent
There are two standard ways to express this in dB, and they agree with each other:
20 * log10(RMS)10 * log10(mean(x^2))Both reduce to
20 * log10(RMS). The current code uses10 * log10(RMS), which is exactly half of both — it applies the power factor (10) to an amplitude (RMS). A 10× change in RMS should read as 20 dB; today it reads as 10 dB.Options
** 0.5in the dB path (or apply10*log10to the pre-sqrt energy). Matches the "Energy" in the name.20 * log10(RMS). Numerically identical to option 1 in dB, but the linear output stays RMS amplitude.A secondary point: the dB is currently referenced to 1 (raw data units), i.e. it's a relative "dBFS-like" measure. Worth documenting, and possibly exposing a reference level, but that's separable from the factor question.
Question
Was
10 * log10(RMS)intentional (matching an external tool), or should it be20 * log10(RMS)/10 * log10(energy)? Happy to open a PR for whichever convention we settle on, plus a docstring note and a test that pins the chosen definition.Context: found during a review of the
devbranch; unrelated fixes forfile://handling, remote HTTP headers, config thread-safety, and NetCDF remote scan are being handled separately.All reactions