diff --git a/usrp/sps/range b/usrp/sps/range new file mode 100755 index 0000000..dce7b1d --- /dev/null +++ b/usrp/sps/range @@ -0,0 +1,53 @@ +#!/usr/bin/perl + +sub read +{ + local ($n) = "$_[0].fft"; + local (@f); + local $i = 0; + local $ym, $v; + + open(FILE, $n) || die "$n: $!"; + while () { + chop; + push(@f, $_); + $ym = $_ unless defined $ym && $ym > $_; + } + close FILE; + for (@f) { + $v = $_-$ym; + $min[$i] = $v unless defined $min[$i] && $min[$i] < $v; + $max[$i] = $v unless defined $max[$i] && $max[$i] > $v; + $sum[$i] += $v; + $i++; + } +} + + +sub usage +{ + print STDERR "usage: $0\n"; + exit(1); +} + + +&usage if @ARGV; + +# +# @@@ for future study: use an x axis proportional to the center frequency, +# instead of an absolute frequency. +# + +for ($f = 2405; $f <= 2480; $f += 5) { + &read($f); + &read($f+1); + $n += 2; +} + +$mhz_per_bin = 100.0/16/@sum; # 100 MHz ADC, decimation 16 + +$, = " "; +for ($i = 0; $i != @sum; $i++) { + print $mhz_per_bin*($i-@sum/2)+0.5, ""; + print $min[$i], $sum[$i]/$n, $max[$i], "\n"; +} diff --git a/usrp/sps/row b/usrp/sps/row index bdead06..f16517c 100755 --- a/usrp/sps/row +++ b/usrp/sps/row @@ -23,35 +23,55 @@ for prefix in "$@"; do color=' bgcolor="#a0e0ff"' fi last=$prefix - - echo "$prefix" + + echo "$prefixOffset" f=2405 while [ $f -le 2480 ]; do - echo "$f MHz" + echo "$f MHz" f=`expr $f + 5` done - echo "-0.5 MHz" + echo "" + echo "" + echo "-0.5 MHz" + f=2405 while [ $f -le 2480 ]; do - ./viz -f LiberationSans-Bold -p $prefix-$f.png $prefix $f + ./viz -f LiberationSans-Bold -p $prefix-$f.png \ + -o $f.fft $prefix $f convert -resize '15%' $prefix-$f.png $prefix-$f-small.png echo "" f=`expr $f + 5` done - echo "+0.5 MHz" + echo "" + echo "" + echo "+0.5 MHz" + f=2405 while [ $f -le 2480 ]; do f1=`expr $f + 1` - ./viz -f LiberationSans-Bold -p $prefix-$f1.png $prefix $f1 + ./viz -f LiberationSans-Bold -p $prefix-$f1.png \ + -o $f1.fft $prefix $f1 convert -resize '15%' $prefix-$f1.png $prefix-$f1-small.png echo "" f=`expr $f + 5` done -done + ffts=` + f=2405 + while [ $f -le 2480 ]; do + echo $f.fft + echo \`expr $f + 1\`.fft + f=\`expr $f + 5\` + done` + ./range >_tmp + ./vizr -f LiberationSans-Bold -p $prefix.png $prefix _tmp + rm -f $ffts _tmp + + convert -resize '15%' $prefix.png $prefix-small.png +done cat < EOF diff --git a/usrp/sps/vizr b/usrp/sps/vizr new file mode 100755 index 0000000..afe696f --- /dev/null +++ b/usrp/sps/vizr @@ -0,0 +1,54 @@ +#!/bin/sh + +usage() +{ + echo "usage: $0 [-f font] [-p png_file] prefix range_file" 1>&2 + exit 1 +} + + +font= +term= +output= + +while true; do + case "$1" in + -f) [ "$2" ] || usage + shift + font=$1;; + -p) [ "$2" ] || usage + shift + term="set term png" + output="set output \"$1\"";; + -*) usage;; + *) + break;; + esac + shift +done + +[ "$2" ] || usage +[ "$3" ] && usage + +prefix=$3 +file=$2 + +gnuplot -persist <