Lab043: add hardware diagnostics and HackRF comparison tools
This commit is contained in:
@@ -764,6 +764,39 @@ def test_symbol_sample_phase_is_selected_separately(initial_sample_phase: int) -
|
||||
assert found["score"] > 0.99
|
||||
|
||||
|
||||
def test_spectral_tone_start_fallback_finds_narrow_tones_without_broadband_jump() -> None:
|
||||
sample_rate = 240_000.0
|
||||
rng = np.random.default_rng(43)
|
||||
samples = (
|
||||
rng.normal(0.0, 0.08, 240_000)
|
||||
+ 1j * rng.normal(0.0, 0.08, 240_000)
|
||||
)
|
||||
tone_start = 96_000
|
||||
tone_count = 60_000
|
||||
indexes = np.arange(tone_count, dtype=np.float64)
|
||||
samples[tone_start : tone_start + tone_count] += 0.025 * (
|
||||
np.exp(-1j * 2.0 * np.pi * 50_000.0 * indexes / sample_rate)
|
||||
+ np.exp(1j * 2.0 * np.pi * 50_000.0 * indexes / sample_rate)
|
||||
)
|
||||
|
||||
with pytest.raises(RuntimeError, match="10"):
|
||||
lab043.locate_calibration_tone_start(
|
||||
samples,
|
||||
sample_rate,
|
||||
block_samples=2048,
|
||||
hop_samples=1024,
|
||||
)
|
||||
found = lab043.locate_calibration_tone_start_spectral(
|
||||
samples,
|
||||
sample_rate,
|
||||
block_samples=8192,
|
||||
hop_samples=2048,
|
||||
required_consecutive_blocks=3,
|
||||
)
|
||||
|
||||
assert tone_start - 8192 <= found <= tone_start + 2048
|
||||
|
||||
|
||||
def test_one_control_packet_passes_crc() -> None:
|
||||
assert lab043.control_packet_crc_roundtrip(b"known payload")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user