sidescanpy.core.units#
Single source for linear <-> dB conversion and the floor-clip artifact.
Convention: every conversion in sidescanpy is amplitude (20*log10),
because raw backscatter_intensity is linear amplitude. There is no
power (10*log10) conversion anywhere in the library.
Linear values below MIN_LINEAR are clipped before the log so
exact zeros (blanking / ring-down) map to FLOOR_DB instead of
-inf. That deterministic floor is an artifact, not a real return;
mask_floor_clip() / mask_floor_db() turn it into NaN.
2026 rshomberg@uri.edu
Contents
Smallest linear amplitude kept before taking the log. |
|
|
|
Deterministic floor-clip artifact values: exact-zero linear amplitude (pre-dB) and the dB floor (post-dB). |
|
Convert linear amplitude to dB: |
|
Convert dB to linear amplitude: |
|
Replace the exact floor-clip artifact values (0.0 and -120 dB) with NaN. |
|
Replace dB values at or below |
- sidescanpy.core.units.MIN_LINEAR = 1e-06#
Smallest linear amplitude kept before taking the log.
- sidescanpy.core.units.FLOOR_DB = -120.0#
20*log10(MIN_LINEAR): the dB value exact-zero amplitude converts to.
- sidescanpy.core.units.FLOOR_CLIP_VALUES = (0.0, -120.0)#
Deterministic floor-clip artifact values: exact-zero linear amplitude (pre-dB) and the dB floor (post-dB).
- sidescanpy.core.units.linear_to_db(x, floor_db=-120.0)#
Convert linear amplitude to dB:
20*log10(clip(x, min_linear)).min_linearis the linear value offloor_db(1e-6for the default -120 dB). Accepts scalars, numpy arrays andxr.DataArray; dtype and NaN are preserved (NaN stays NaN).
- sidescanpy.core.units.db_to_linear(db)#
Convert dB to linear amplitude:
10**(db/20).
- sidescanpy.core.units.mask_floor_clip(values)#
Replace the exact floor-clip artifact values (0.0 and -120 dB) with NaN.