1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-26 12:45:21 +02:00
ben-wpan/usrp/sps/viz
Werner Almesberger 7258e10a9a usrp/sps: further improved scripts, added Makefile
- Makefile (index): generate an illustrated index of all the measurement
  runs
- Makefile (upload): upload images and index to downloads.qi-hardware.com
- collect: added optional directory argument, for cases where the
  destination directory differs from the local directory
- collect: hard-coded remote host to run usrp2_rx_cfile.py at
- collect: added . to PATH, for execution of a local copy of atrf-txrx
- row: generate entire HTML page, not just the table entries
- row: accept a list of prefixes to iterate through
- row: highlight rows starting a "new" prefix
- viz: corrected sprintf formats from +%...f to %+...f
- viz: show negative peak power in red
2011-03-04 20:28:59 -03:00

78 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
usage()
{
echo "usage: $0 [-f font] prefix frequency" 1>&2
exit 1
}
font=
term=
output=
while true; do
case "$1" in
-f) [ "$2" ] || usage
shift
font=$1
shift;;
-p) [ "$2" ] || usage
shift
term="set term png"
output="set output \"$1\""
shift;;
*)
break;;
esac
done
[ "$2" ] || usage
[ "$3" ] && usage
prefix=$1
f=$2
../fft -s 100 -d -w hamming 100 <./$prefix-$f >_tmp
set `./norm _tmp`
xm=$1.0 # sample number of y peak
ym=$2 # magnitude of y peak
n=$3 # total number of samples
span=6.25 # ADC sample rate in MHz / decimation (100 MHz/16)
if [ ${ym#-} = $ym ]; then
ymbar=-$ym
ymbarlt=2
else
ymbar=$ym
ymbarlt=1
fi
gnuplot -persist <<EOF
$term
$output
set label "$prefix" at graph 0.03, graph 0.93 font "$font,22"
set label sprintf("%+.1f dB", $ym) at graph 0.03, graph 0.82 font "$font,18"
set label sprintf("%.1f MHz", $f-0.5) \
at graph 0.97, graph 0.93 right font "$font,22"
set label sprintf("%+.1f ppm", (($xm/$n-0.5)*$span+0.5)/($f-0.5)*1000000) \
at graph 0.97, graph 0.82 right font "$font,18"
set xrange [-2.5:2.5]
set yrange [-70:0]
set mxtics 10
set mytics 2
set grid
set xlabel "MHz from nominal frequency of test wave"
set style fill solid 1
plot "_tmp" using ((\$0/$n-0.5)*$span+0.5):(\$1-$ym) with lines notitle, \
"<echo -0.9 $ymbar 0.2" with boxes lt $ymbarlt notitle
EOF
rm -f _tmp