Date:2011-04-14 02:13:26 (8 years 8 months ago)
Author:Werner Almesberger
Commit:66d641f624f7c2a196c483d0592a7a871976310f
Message:atrf-path/genpathprof: profile generator

- genpathprof: generate a profile for atrf-path from measurements and/or
user-provided limits
- profile.example: example profile
Files: tools/atrf-path/genpathprof (1 diff)
tools/atrf-path/profile.example (1 diff)

Change Details

tools/atrf-path/genpathprof
1#!/usr/bin/perl
2#
3# atrf-path/genpathprof - Generate profile for atrf-path
4#
5# Written 2011 by Werner Almesberger
6# Copyright 2011 Werner Almesberger
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13
14sub usage
15{
16    print STDERR <<"END"
17usage: $0 below above [file ...]
18
19  below/above define either absolute values or clearances:
20    10 = 10.0 dBm
21    -3.5 = -3.5 dBm
22    +5 = 5 dBm below or above the minimum/maximum measurement
23END
24;
25    exit(1);
26}
27
28$below = shift @ARGV;
29$above = shift @ARGV;
30
31&usage unless defined $below && defined $above;
32
33while (<>) {
34    next unless /^(\d+)\.5\s+(-?\d+(\.\d*))\s+/;
35    $f = int(($1+2.5)/5)*5;
36    $min{$f} = $2 if $min{$f} > $2 || !defined $min{$f};
37    $max{$f} = $2 if $max{$f} < $2 || !defined $max{$f};
38}
39print "# min\tmax\t Chan\tMHz\n";
40for ($i = 0; $i != 16; $i++) {
41    $f = 2405+5*$i;
42    if ($below =~ /^\+/) {
43        $min = $min{$f}-$';
44    } else {
45        $min = $below;
46    }
47    if ($above =~ /^\+/) {
48        $max = $max{$f}+$';
49    } else {
50        $max = $above;
51    }
52    printf("%.2f\t%.2f\t# %d\t%d\n", $min, $max, $i+11, $f);
53}
tools/atrf-path/profile.example
1# min max Chan MHz
2-61.00 -40.00 # 11 2405
3-61.00 -40.00 # 12 2410
4-60.85 -40.00 # 13 2415
5-60.70 -40.00 # 14 2420
6-60.25 -40.00 # 15 2425
7-59.20 -40.00 # 16 2430
8-58.45 -40.00 # 17 2435
9-58.90 -40.00 # 18 2440
10-58.60 -40.00 # 19 2445
11-60.10 -40.00 # 20 2450
12-61.00 -40.00 # 21 2455
13-61.45 -40.00 # 22 2460
14-62.65 -40.00 # 23 2465
15-63.70 -40.00 # 24 2470
16-64.30 -40.00 # 25 2475
17-65.05 -40.00 # 26 2480

Archive Download the corresponding diff file



interactive