Root/usrp/sps/range

Source at commit 66d641f624f7c2a196c483d0592a7a871976310f created 12 years 11 months ago.
By Werner Almesberger, atrf-path/genpathprof: profile generator
1#!/usr/bin/perl
2
3sub read
4{
5    local ($n) = "$_[0].fft";
6    local (@f);
7    local $i = 0;
8    local $ym, $v;
9
10    open(FILE, $n) || die "$n: $!";
11    while (<FILE>) {
12        chop;
13        push(@f, $_);
14        $ym = $_ unless defined $ym && $ym > $_;
15    }
16    close FILE;
17    for (@f) {
18        $v = $_-$ym;
19        $min[$i] = $v unless defined $min[$i] && $min[$i] < $v;
20        $max[$i] = $v unless defined $max[$i] && $max[$i] > $v;
21        $sum[$i] += $v;
22        $i++;
23    }
24}
25
26
27sub usage
28{
29    print STDERR "usage: $0\n";
30    exit(1);
31}
32
33
34&usage if @ARGV;
35
36#
37# @@@ for future study: use an x axis proportional to the center frequency,
38# instead of an absolute frequency.
39#
40
41for ($f = 2405; $f <= 2480; $f += 5) {
42    &read($f);
43    &read($f+1);
44    $n += 2;
45}
46
47$mhz_per_bin = 100.0/16/@sum; # 100 MHz ADC, decimation 16
48
49$, = " ";
50for ($i = 0; $i != @sum; $i++) {
51    print $mhz_per_bin*($i-@sum/2)+0.5, "";
52    print $min[$i], $sum[$i]/$n, $max[$i], "\n";
53}
54

Archive Download this file



interactive