mirror of
https://asciireactor.com/otho/psdlag-agn.git
synced 2024-11-22 02:35:08 +00:00
converting to use of perl records
This commit is contained in:
parent
a66b3bb1d1
commit
ee2a2f5186
@ -30,10 +30,10 @@ while(<$outputfile>) {
|
|||||||
$linenum++;
|
$linenum++;
|
||||||
if ($_ =~ /^\*+$/) {
|
if ($_ =~ /^\*+$/) {
|
||||||
$star_linenum_1=$star_linenum_2;
|
$star_linenum_1=$star_linenum_2;
|
||||||
$star_linenum_2 = $linenum;
|
$star_linenum_2 = $linenum;
|
||||||
$star_bytenum_1=$star_bytenum_2;
|
$star_bytenum_1=$star_bytenum_2;
|
||||||
#$star_bytenum_2 = $outputfile.tell();
|
#$star_bytenum_2 = $outputfile.tell();
|
||||||
$star_bytenum_2 = tell($outputfile);
|
$star_bytenum_2 = tell($outputfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
@ -64,16 +64,16 @@ if ($debug) {
|
|||||||
# These arrays store the various quantities of interest.
|
# These arrays store the various quantities of interest.
|
||||||
@freq_coords_avg = [];
|
@freq_coords_avg = [];
|
||||||
@freq_coords_err = [];
|
@freq_coords_err = [];
|
||||||
@power_curve_source_avg = [];
|
@arr_power_curve_source_avg = [];
|
||||||
@power_curve_source_err = [];
|
@arr_power_curve_source_err = [];
|
||||||
@power_curve_reprocessed_avg = [];
|
@arr_power_curve_reprocessed_avg = [];
|
||||||
@power_curve_reprocessed_err = [];
|
@arr_power_curve_reprocessed_err = [];
|
||||||
@cross_correlation_power_curve_avg = [];
|
@arr_cross_correlation_power_curve_avg = [];
|
||||||
@cross_correlation_power_curve_err = [];
|
@arr_cross_correlation_power_curve_err = [];
|
||||||
@phase_difference_avg = [];
|
@arr_phase_difference_avg = [];
|
||||||
@phase_difference_err = [];
|
@arr_phase_difference_err = [];
|
||||||
@time_lag_avg = [];
|
@arr_time_lag_avg = [];
|
||||||
@time_lag_err = [];
|
@arr_time_lag_err = [];
|
||||||
|
|
||||||
# This captures the frequency bins.
|
# This captures the frequency bins.
|
||||||
my $upper_bound = 0;
|
my $upper_bound = 0;
|
||||||
@ -99,7 +99,7 @@ my $mode=0;
|
|||||||
while (<$outputfile>) {
|
while (<$outputfile>) {
|
||||||
next if $_ =~ /\*+/;
|
next if $_ =~ /\*+/;
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
case 0 {
|
case 0 {
|
||||||
my $avg = my $err = $_;
|
my $avg = my $err = $_;
|
||||||
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
||||||
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
||||||
@ -110,11 +110,11 @@ while (<$outputfile>) {
|
|||||||
print encode($charset,"Driving light curve power from $_");
|
print encode($charset,"Driving light curve power from $_");
|
||||||
say encode($charset,"Average: $avg, Err: $err");
|
say encode($charset,"Average: $avg, Err: $err");
|
||||||
}
|
}
|
||||||
push(@power_curve_source_avg,$avg);
|
push(@arr_power_curve_source_avg,$avg);
|
||||||
push(@power_curve_source_err,$err);
|
push(@arr_power_curve_source_err,$err);
|
||||||
$mode++;
|
$mode++;
|
||||||
}
|
}
|
||||||
case 1 {
|
case 1 {
|
||||||
my $avg = my $err = $_;
|
my $avg = my $err = $_;
|
||||||
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
||||||
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
||||||
@ -122,11 +122,11 @@ while (<$outputfile>) {
|
|||||||
print encode($charset,"Reprocessed light curve power from $_");
|
print encode($charset,"Reprocessed light curve power from $_");
|
||||||
say encode($charset,"Average: $avg, Err: $err");
|
say encode($charset,"Average: $avg, Err: $err");
|
||||||
}
|
}
|
||||||
push(@power_curve_reprocessed_avg,$avg);
|
push(@arr_power_curve_reprocessed_avg,$avg);
|
||||||
push(@power_curve_reprocessed_err,$err);
|
push(@arr_power_curve_reprocessed_err,$err);
|
||||||
$mode++;
|
$mode++;
|
||||||
}
|
}
|
||||||
case 2 {
|
case 2 {
|
||||||
my $avg = my $err = $_;
|
my $avg = my $err = $_;
|
||||||
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
$avg =~ s/^([\-\+e0-9\.]+)+\s+[\-\+e0-9\.]+\s*$/$1/;
|
||||||
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
||||||
@ -134,11 +134,11 @@ while (<$outputfile>) {
|
|||||||
print encode($charset,"Cross-Correlation from $_");
|
print encode($charset,"Cross-Correlation from $_");
|
||||||
say encode($charset,"Average: $avg, Err: $err");
|
say encode($charset,"Average: $avg, Err: $err");
|
||||||
}
|
}
|
||||||
push(@cross_correlation_power_curve_avg,$avg);
|
push(@arr_cross_correlation_power_curve_avg,$avg);
|
||||||
push(@cross_correlation_power_curve_err,$err);
|
push(@arr_cross_correlation_power_curve_err,$err);
|
||||||
$mode++;
|
$mode++;
|
||||||
}
|
}
|
||||||
case 3 {
|
case 3 {
|
||||||
my $avg = my $err = $_;
|
my $avg = my $err = $_;
|
||||||
$avg =~ s/^([\-\+e0-9\.]+)\s+[\-\+e0-9\.]+\s*$/$1/;
|
$avg =~ s/^([\-\+e0-9\.]+)\s+[\-\+e0-9\.]+\s*$/$1/;
|
||||||
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
$err =~ s/^[\-\+e0-9\.]+\s+([\-\+e0-9\.]+)\s*$/$1/;
|
||||||
@ -146,15 +146,31 @@ while (<$outputfile>) {
|
|||||||
print encode($charset,"Phase different from $_");
|
print encode($charset,"Phase different from $_");
|
||||||
say encode($charset,"Average: $avg, Err: $err");
|
say encode($charset,"Average: $avg, Err: $err");
|
||||||
}
|
}
|
||||||
push(@phase_difference_avg,$avg);
|
push(@arr_phase_difference_avg,$avg);
|
||||||
push(@phase_difference_err,$err);
|
push(@arr_phase_difference_err,$err);
|
||||||
|
my %freqrecord = ( "arr_power_curve_source_avg" => arr_power_curve_source_avg)
|
||||||
$mode = 0;
|
$mode = 0;
|
||||||
}
|
}
|
||||||
} # End switch
|
} # End switch
|
||||||
}
|
}
|
||||||
|
|
||||||
$numvals = scalar @power_curve_source_avg;
|
$numvals = scalar @arr_power_curve_source_avg;
|
||||||
say encode($charset,"Saved $numvals sets of quantities.");
|
say encode($charset,"Retrieved $numvals sets of quantities.");
|
||||||
|
|
||||||
|
# This section builds the records
|
||||||
|
foreach(@freq_coords_avg) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
open($datafile,'>',"tmp.sourcePSD") or die $!;
|
||||||
|
open($datafile,'>',"tmp.reprocPSD") or die $!;
|
||||||
|
|
||||||
|
foreach(@freq_coords_avg)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user