@in = ( [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ], [ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 ], # ... ); #### @in = ( { user => 'Fighter2', id => 936570, xp => 34, writeups => 11, ... }, ); #### #!/usr/bin/perl #Initialization my @in=( [...], [...], ); my $MaxAgc0 = "1.15503129132678e-005"; # MaxAgc0 is a constant #Interpolation if (@in) { for my $i (0..$#in) { my $ptr = $in[$i]; # convenience. # we don't need the first item to be a count of sectors anymore. # we also don't need this loop at all. #for my $j (0..$#$ptr) #{ # so we also reduce the numbers here. my $num = $ptr->[11] * $MaxAgc0; push @Attn, $num / $ptr->[9]; #} } for my $i (0..$#in) { push @powers, ($in[$i][$_] - $Attn[$i])/100 for (1..8); } } else { # @in is empty print "\n No data to map for Panda machine. Check if input logfile is empty"; kill; } #### ( { attn => 5, # attenuation? agc => 6, # the MaxAgc0 multiplier sectors => [ all the sectors for this data point in this array ], # etc. }, # repeat for each item. ) #### #!/usr/bin/perl #Initialization my @in=( {...}, {...}, ); my $MaxAgc0 = "1.15503129132678e-005"; # MaxAgc0 is a constant use List::MoreUtils qw(pairwise); #Interpolation if (@in) { my @Attn = map { my $num = $_->{agc} * $MaxAgc0; $num / $_->{attn}; } @in; @powers = pairwise { [ map { ( $a->{sectors}[$_] - $b ) / 100 } for @{$a->{sectors}} ] } @in, @Attn; } else { # @in is empty print "\n No data to map for Panda machine. Check if input logfile is empty"; kill; } #### #Initialization my @in=( {...}, {...}, ); my $MaxAgc0 = "1.15503129132678e-005"; # MaxAgc0 is a constant #Interpolation if (@in) { @powers = map { my $attn = $_->{agc} * $MaxAgc0 / $_->{attn}; [ map { ( $_->{sectors}[$_] - $attn ) / 100 } for @{$_->{sectors}} ] } @in; } else { # @in is empty print "\n No data to map for Panda machine. Check if input logfile is empty"; kill; }