worked out some formatting things, trying to find better initializations for the parameters

This commit is contained in:
othocaeS 2016-06-21 13:56:59 -04:00
parent 7e53d636e4
commit 4dd6054a07
3 changed files with 63 additions and 20 deletions

View File

@ -3,7 +3,7 @@ data/calibration/lc_drive.dat 0
data/calibration/lc_1.dat 0 data/calibration/lc_1.dat 0
8 0.005 0.019 0.0425 0.07 0.11 0.17 0.24 0.4 0.603 8 0.005 0.019 0.0425 0.07 0.11 0.17 0.24 0.4 0.603
0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 100 1 1 0.49 26 1 1 0.46 2.5 1 1 0.51 1.8 1 1 -.41 0.6 1 1 0.15 0.28 1 1 0.075 0.15 1 1 0 0.10 1 1 0.015
0:1 1 0:1 1
0 0
0 0

View File

@ -4,9 +4,10 @@
# plot 'file' using 1:2:(sqrt($1)) with xerrorbars # plot 'file' using 1:2:(sqrt($1)) with xerrorbars
# plot 'file' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars # plot 'file' using 1:2:($1-$3):($1+$3):4:5 with xyerrorbars
#plot 'tmp.sourcePSD' using 1:2:3:4 with xyerrorbars plot 'tmp.sourcePSD' using 1:2:3:4 with xyerrorbars
plot 'tmp.reprocPSD' using 1:2:3:4 with xyerrorbars #plot 'tmp.reprocPSD' using 1:2:3:4 with xyerrorbars
#plot 'tmp.ccPSD' using 1:2:3:4 with xyerrorbars #plot 'tmp.ccPSD' using 1:2:3:4 with xyerrorbars
#plot 'tmp.timelag' using 1:2:3:4 with xyerrorbars
set logscale xy set logscale xy
set xrange [0.005:0.603] set xrange [0.005:0.603]
# set yrange [:1] # set yrange [:1]

View File

@ -10,6 +10,7 @@ use constant PI => 4 * atan2(1, 1);
# Enables debug output. # Enables debug output.
our $debug=1; our $debug=1;
our $verbosedebug=0;
# This section locates the output data of interest in a # This section locates the output data of interest in a
@ -37,7 +38,7 @@ while(<$outputfile>) {
$star_bytenum_2 = tell($outputfile); $star_bytenum_2 = tell($outputfile);
} }
} }
if ($debug) { if ($verbosedebug) {
say encode($charset,"Final set found between lines "), say encode($charset,"Final set found between lines "),
$star_linenum_1, $star_linenum_1,
" and ", " and ",
@ -55,7 +56,7 @@ $bin_bounds_line = <$outputfile>;
$bin_bounds_line =~ s/^#\s*(.*)$/$1/; $bin_bounds_line =~ s/^#\s*(.*)$/$1/;
#$line =~ / #$line =~ /
@bin_bounds = split /\s/,$bin_bounds_line; @bin_bounds = split /\s/,$bin_bounds_line;
if ($debug) { if ($verbosedebug) {
print encode($charset,"Found bin boundaries: "); print encode($charset,"Found bin boundaries: ");
foreach (@bin_bounds) {print encode($charset,"$_ ");} foreach (@bin_bounds) {print encode($charset,"$_ ");}
say encode($charset," "); say encode($charset," ");
@ -84,8 +85,10 @@ $numbins = keys %function_bin;
say encode($charset,"$numbins frequency bins captured in output."); say encode($charset,"$numbins frequency bins captured in output.");
if($debug) { if($debug) {
say encode($charset,"freq μ freq σ");
while (each %function_bin ) { while (each %function_bin ) {
say encode($charset,$_ . " => " . $function_bin{$_}{"Δ"}); say encode($charset,
sprintf("%f %f",$_,$function_bin{$_}{"Δ"}));
} }
} }
@ -104,8 +107,7 @@ if ($debug) {
say encode($charset, say encode($charset,
" New Curve -- Source PSD"); " New Curve -- Source PSD");
say encode($charset, say encode($charset,
"─────────────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
foreach ( sort { $a <=> $b } keys %function_bin ) { foreach ( sort { $a <=> $b } keys %function_bin ) {
@ -120,7 +122,12 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
$function_bin{$_}{"source_PSD_σ"} = $σ; $function_bin{$_}{"source_PSD_σ"} = $σ;
if ($debug) { if ($debug) {
say encode($charset, say encode($charset,
"freq = " . sprintf('%f',$_) . ": μ = " . $μ . "; σ = " . $σ); "freq = " .
sprintf('%.3f',$_) .
": μ = " .
sprintf('%10.3e',$μ) .
"; σ = " .
sprintf('%10.3e',$σ));
} }
} }
@ -129,7 +136,7 @@ if ($debug) {
say encode($charset, say encode($charset,
" New Curve -- Reprocessed PSD"); " New Curve -- Reprocessed PSD");
say encode($charset, say encode($charset,
"─────────────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
foreach ( sort { $a <=> $b } keys %function_bin ) { foreach ( sort { $a <=> $b } keys %function_bin ) {
my $μ = my $σ = <$outputfile>; my $μ = my $σ = <$outputfile>;
@ -143,7 +150,12 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
$function_bin{$_}{"reproc_PSD_σ"} = $σ; $function_bin{$_}{"reproc_PSD_σ"} = $σ;
if ($debug) { if ($debug) {
say encode($charset, say encode($charset,
"freq = " . sprintf('%f',$_) . ": μ = " . $μ . "; σ = " . $σ); "freq = " .
sprintf('%.3f',$_) .
": μ = " .
sprintf('%10.3e',$μ) .
"; σ = " .
sprintf('%10.3e',$σ));
} }
} }
@ -151,9 +163,9 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
if ($debug) { if ($debug) {
say encode($charset,""); say encode($charset,"");
say encode($charset, say encode($charset,
" New Curve -- Cross-Correlation PSD"); " New Curve -- Cross Spectra PSD");
say encode($charset, say encode($charset,
"─────────────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
foreach ( sort { $a <=> $b } keys %function_bin ) { foreach ( sort { $a <=> $b } keys %function_bin ) {
my $μ = my $σ = <$outputfile>; my $μ = my $σ = <$outputfile>;
@ -167,7 +179,12 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
$function_bin{$_}{"cc_PSD_σ"} = $σ; $function_bin{$_}{"cc_PSD_σ"} = $σ;
if ($debug) { if ($debug) {
say encode($charset, say encode($charset,
"freq = " . sprintf('%f',$_) . ": μ = " . $μ . "; σ = " . $σ); "freq = " .
sprintf('%.3f',$_) .
": μ = " .
sprintf('%10.3e',$μ) .
"; σ = " .
sprintf('%10.3e',$σ));
} }
} }
@ -176,7 +193,7 @@ if ($debug) {
say encode($charset, say encode($charset,
" New Curve -- Phase Difference φ"); " New Curve -- Phase Difference φ");
say encode($charset, say encode($charset,
"─────────────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
foreach ( sort { $a <=> $b } keys %function_bin ) { foreach ( sort { $a <=> $b } keys %function_bin ) {
my $μ = my $σ = <$outputfile>; my $μ = my $σ = <$outputfile>;
@ -189,13 +206,30 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
$function_bin{$_}{"φdiff_σ"} = $σ; $function_bin{$_}{"φdiff_σ"} = $σ;
if ($debug) { if ($debug) {
say encode($charset, say encode($charset,
"freq = " . sprintf('%f',$_) . ": μ = " . $μ . "; σ = " . $σ); "freq = " .
sprintf('%.3f',$_) .
": μ = " .
sprintf('%10.3e',$μ) .
"; σ = " .
sprintf('%10.3e',$σ));
}
$μ = $μ/(2*PI*$_);
$σ = $σ/(2*PI*$_);
$function_bin{$_}{"timelag_μ"} = $μ;
$function_bin{$_}{"timelag_σ"} = $σ;
if ($debug) {
say encode($charset,
" timelag: μ = " .
sprintf('%10.3e',$μ) .
"; σ = " .
sprintf('%10.3e',$σ)) .
"\n";
} }
} }
say encode($charset,""); say encode($charset,"");
if($debug) { if($verbosedebug) {
while (each %function_bin ) { while (each %function_bin ) {
print encode($charset,$_ . ": "); print encode($charset,$_ . ": ");
while ( my ($key,$value) = each %{$function_bin{$_}} ) { while ( my ($key,$value) = each %{$function_bin{$_}} ) {
@ -237,7 +271,15 @@ while( each %function_bin) {
} }
close($datafile); close($datafile);
open($datafile,'>',"tmp.timelag") or die $!;
while( each %function_bin) {
say $datafile
$_ . " " .
$function_bin{$_}{"timelag_μ"} . " " .
$function_bin{$_}{"Δ"} . " " .
$function_bin{$_}{"timelag_σ"};
}
close($datafile);
#open($datafile,'>',"tmp.reprocPSD") or die $!; #open($datafile,'>',"tmp.reprocPSD") or die $!;