diff options
| author | Marin Ivanov <[email protected]> | 2025-07-25 10:17:14 +0300 |
|---|---|---|
| committer | Marin Ivanov <[email protected]> | 2026-01-18 20:09:26 +0200 |
| commit | 0168586485e6310c598713c911b1dec5618d61a1 (patch) | |
| tree | 6aabc2a12ef8fef70683f5389bea00f948015f77 /unittest/ofdm_time_sync.sh | |
* codec2 cut-down version 1.2.0
* Remove codebook and generation of sources
* remove c2dec c2enc binaries
* prepare for emscripten
Diffstat (limited to 'unittest/ofdm_time_sync.sh')
| -rwxr-xr-x | unittest/ofdm_time_sync.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/unittest/ofdm_time_sync.sh b/unittest/ofdm_time_sync.sh new file mode 100755 index 0000000..fec51c9 --- /dev/null +++ b/unittest/ofdm_time_sync.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Shell script version of ofdm_time_sync() +# David June 2019 +# Tests ofdm modem sync time, using real, off air files + +onerun=$(mktemp) +results=$(mktemp) + +# bunch of runs at different time offsets into a sample off air file with low SNR and semi-staionary fading +for start_secs in `seq 0 29`; +do + if [ "$1" = "700D" ]; then + ofdm_demod --in ../wav/vk2tpm_004.wav --out /dev/null --verbose 2 --ldpc \ + --start_secs $start_secs --len_secs 5 2>/dev/null > $onerun + fi; + if [ "$1" = "2020" ]; then + ofdm_demod --mode 2020 --in ../wav/david4.wav --out /dev/null --verbose 2 --ldpc \ + --start_secs $start_secs --len_secs 5 2>/dev/null > $onerun + fi; + [ ! $? -eq 0 ] && { echo "error running ofdm_demod"; exit 1; } + cat $onerun | sed -n "s/time_to_sync: \([0-9..]*\)/\1/p" >> $results +done +# a pass is we never take longer than 5 secs to sync (mean is much smaller) +python3 -c " +import sys; import numpy as np +x=np.loadtxt(\"$results\") +fails=sum(x == -1) +print(\"fails: %d mean: %5.2f var: %5.2f \" % (fails, np.mean(x), np.var(x))) +sys.exit(0) if fails==0 else sys.exit(1) +" |
