Skip to content

Commit 4db153a

Browse files
committed
Verify recovery when a spectral null separates two usable pilots
1 parent e92eee4 commit 4db153a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎tests/test_iq_rx_stream.py‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,23 @@ def observe(receiver, scope, center, rate, timeout, count, extract, description)
310310
expected = [center + direction * offset for offset in [spacing, round(1.5 * spacing / 1000) * 1000]]
311311
assert [call.args for call in iq.set_reference.call_args_list] == [("iq", frequency, backoff) for frequency in expected]
312312

313+
# A null between two usable observations must keep the first fit.
314+
# The next independent observation still measures the same receiver.
315+
fit = stream._fit_noise
316+
observed = []
317+
318+
def null_on_second(*args):
319+
observed.append(phase)
320+
if len(observed) == 2:
321+
raise RuntimeError("Insufficient coherent bandwidth")
322+
return fit(*args)
323+
324+
monkeypatch.setattr(stream, "_fit_noise", null_on_second)
325+
_, recovered, _, _ = stream.measure_bluetooth(receiver, scope, configs, center, 16000, 3, attempt)
326+
np.testing.assert_allclose(recovered, measured, atol=1e-7)
327+
assert len(observed) == 3
328+
monkeypatch.setattr(stream, "_fit_noise", fit)
329+
313330
# Keep both training waveforms individually coherent, but change the
314331
# phase on the independent measurement. The two fits must disagree.
315332
def disagree(*args):

0 commit comments

Comments
 (0)