Debian Codegraph @

tcl/ex/red-pd/testFRp/testFRp.pl

raw
1 #!/usr/bin/perl -w
2
3 use strict 'refs';
4 use strict 'subs';
5
6 if ($#ARGV != 2) {
7 &usage;
8 exit;
9 }
10
11 sub usage {
12 print STDERR " usage: $0 <pattern> <probability> <time>\n";
13 exit;
14 }
15
16 my $p = $ARGV[1];
17 my @a = <$ARGV[0]*>;
18 my $time = $ARGV[2] - 10;
19
20 my $frp = sqrt(1.5)/(0.040*sqrt($p));
21 print STDERR "frp = $frp \n";
22
23 foreach $file (@a) {
24
25 my ($pre1, $pre2, $x) = split(/-/,$file);
26
27 print STDERR "Doing $file \n";
28
29 my $command = "awk \'{if (\$4==1) { if (\$2==50) start = \$6; if(\$2==$time) print $x, (\$6-start)/\(($time-50)*1000*$frp\)}}\' $file";
30
31 # print "$command", "\n";
32 system($command);
33
34 }
35
36