Skip to content

Commit f8dd594

Browse files
committed
Finally fixed the test. Rounding errors compounded
1 parent b8295b7 commit f8dd594

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

adc_eval/spectrum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def sndr_sfdr(spectrum, freq, fs, nfft, leak, full_scale=0):
6363
"floor": noise_floor,
6464
"power": noise_power,
6565
"rms": np.sqrt(noise_power),
66-
"dBHz": round(dBW(noise_floor) - full_scale, 1),
67-
"NSD": round(dBW(noise_floor) - full_scale - 2 * dBW(fbin), 1),
66+
"dBHz": round(dBW(noise_floor, 3) - full_scale, 1),
67+
"NSD": round(dBW(noise_floor, 3) - full_scale - 2 * dBW(fbin, 3), 1),
6868
}
6969
stats["sndr"] = {
7070
"dBc": dBW(psig / noise_power),

tests/test_spectrum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_sndr_sfdr_outputs(self):
8888
"power": 9,
8989
"rms": 3,
9090
"dBHz": round(-11.529675 - full_scale, 1),
91-
"NSD": round(-11.529675 - full_scale + 48.1648, 1),
91+
"NSD": round(36.6351 - full_scale, 1),
9292
},
9393
"sndr": {
9494
"dBc": 10.0,

0 commit comments

Comments
 (0)