renaming files as the project develops

This commit is contained in:
caes 2016-07-12 23:28:11 -04:00
parent ae2c7ca347
commit fa40af3ce9
4 changed files with 67 additions and 29 deletions

View File

@ -1,12 +1,50 @@
#!/usr/local/bin/bash #!/usr/local/bin/bash
mkdir -p analyses/tables
mkdir -p analyses/plots
for analysis in analyses/* for analysis in analyses/*
do do
driving_name=$(basename $analysis|sed 's@[^≻]*≻\([^≻_]*\)_[^_]*@\1@') # Grab and determine labels of analyses, skip if over the same band.
reproc_name=$(basename $analysis|sed 's@\([^≻]*\)≻[^≻_]*_[^_]*@\1@') ref_band=$(basename $analysis|sed 's@[^≻]*≻\([^≻_]*\)_[^_]*@\1@')
# scripts/power_lag_plot.pl $analysis echo_band=$(basename $analysis|sed 's@\([^≻]*\)≻[^≻_]*_[^_]*@\1@')
# mv tmp.sourcePSD analyses/tables/$reproc_namePSD.tab if [[ $ref_band == $echo_band ]]; then continue; fi
echo $driving_name with $reproc_name
# Prepare files
echo "Plotting PSD and time lags for $echo_band, referred to ${ref_band}."
echoPSD_tabfile=analyses/tables/${echo_band}PSD.tab
refPSD_tabfile=analyses/tables/${ref_band}PSD.tab
PSD_plotfile=analyses/plots/${echo_band}_≻_${ref_band}_PSD.png
timelag_plotfile=analyses/plots/${echo_band}_≻_${ref_band}_timelag.png
# Output curves to temporary files using perl script, move tables to
# permanent location. This just assumes there are no conflicts.
scripts/power_lag_plot.pl $analysis
mv tmp.echoPSD $echoPSD_tabfile
mv tmp.refPSD $refPSD_tabfile
mv
# Plot PSD and save using gnuplot
cat scripts/templates/psd_freq.gp|
sed "s@%TITLE@Power Spectrum for Lightcurves $echo_band & $ref_band@"|
sed "s@%SUBTITLE@as reported by Fausnaugh et. al, STORM III, 2016@"|
sed "s@%FILE1@$refPSD_tabfile@"|
sed "s@%FILE2@$echoPSD_tabfile@"|
sed "s@%OUTPUTFILE@$PSD_plotfile@" >
tmp.gp
gnuplot tmp.gp
# Plot time lags and save using gnuplot
cat scripts/templates/timelag_freq.gp|
sed "s@%TITLE@Time Lag for Lightcurve $echo_band relative to $ref_band@"|
sed "s@%SUBTITLE@as reported by Fausnaugh et. al, STORM III, 2016@"|
sed "s@%FILE1@$refPSD_tabfile@"|
sed "s@%FILE2@$echoPSD_tabfile@"|
sed "s@%OUTPUTFILE@$PSD_plotfile@" >
tmp.gp
gnuplot tmp.gp
done done

View File

@ -105,7 +105,7 @@ increments to designate the data being captured.
if ($verbose) { if ($verbose) {
say encode($charset,""); say encode($charset,"");
say encode($charset, say encode($charset,
" New Curve -- Source PSD"); " New Curve -- Reference Curve PSD");
say encode($charset, say encode($charset,
"──────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
@ -118,8 +118,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
# $μ = abs($μ); # $μ = abs($μ);
# $function_bin{$_}{"φdiff_μ"} = PI; # $function_bin{$_}{"φdiff_μ"} = PI;
# } # }
$function_bin{$_}{"source_PSD_μ"} = $μ; $function_bin{$_}{"ref_PSD_μ"} = $μ;
$function_bin{$_}{"source_PSD_σ"} = $σ; $function_bin{$_}{"ref_PSD_σ"} = $σ;
if ($verbose) { if ($verbose) {
say encode($charset, say encode($charset,
"freq = " . "freq = " .
@ -134,7 +134,7 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
if ($verbose) { if ($verbose) {
say encode($charset,""); say encode($charset,"");
say encode($charset, say encode($charset,
" New Curve -- Reprocessed PSD"); " New Curve -- Reverberating Curve PSD");
say encode($charset, say encode($charset,
"──────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
@ -146,8 +146,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
# $μ = abs($μ); # $μ = abs($μ);
# $function_bin{$_}{"φdiff_μ"} = PI; # $function_bin{$_}{"φdiff_μ"} = PI;
# } # }
$function_bin{$_}{"reproc_PSD_μ"} = $μ; $function_bin{$_}{"echo_PSD_μ"} = $μ;
$function_bin{$_}{"reproc_PSD_σ"} = $σ; $function_bin{$_}{"echo_PSD_σ"} = $σ;
if ($verbose) { if ($verbose) {
say encode($charset, say encode($charset,
"freq = " . "freq = " .
@ -163,7 +163,7 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
if ($verbose) { if ($verbose) {
say encode($charset,""); say encode($charset,"");
say encode($charset, say encode($charset,
" New Curve -- Cross Spectra PSD"); " New Curve -- Cross Spectrum PSD");
say encode($charset, say encode($charset,
"──────────────────────────────────────────────────"); "──────────────────────────────────────────────────");
} }
@ -175,8 +175,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) {
# $μ = abs($μ); # $μ = abs($μ);
# $function_bin{$_}{"φdiff_μ"} = PI; # $function_bin{$_}{"φdiff_μ"} = PI;
# } # }
$function_bin{$_}{"cc_PSD_μ"} = $μ; $function_bin{$_}{"crsspctrm_PSD_μ"} = $μ;
$function_bin{$_}{"cc_PSD_σ"} = $σ; $function_bin{$_}{"crsspctrm_PSD_σ"} = $σ;
if ($verbose) { if ($verbose) {
say encode($charset, say encode($charset,
"freq = " . "freq = " .
@ -241,33 +241,33 @@ if($debug) {
close($outputfile); close($outputfile);
open($datafile,'>',"tmp.sourcePSD") or die $!; open($datafile,'>',"tmp.refPSD") or die $!;
while( each %function_bin) { while( each %function_bin) {
say $datafile say $datafile
$_ . " " . $_ . " " .
$function_bin{$_}{"source_PSD_μ"} . " " . $function_bin{$_}{"ref_PSD_μ"} . " " .
$function_bin{$_}{"Δ"} . " " . $function_bin{$_}{"Δ"} . " " .
$function_bin{$_}{"source_PSD_σ"}; $function_bin{$_}{"ref_PSD_σ"};
} }
close($datafile); close($datafile);
open($datafile,'>',"tmp.reprocPSD") or die $!; open($datafile,'>',"tmp.echoPSD") or die $!;
while( each %function_bin) { while( each %function_bin) {
say $datafile say $datafile
$_ . " " . $_ . " " .
$function_bin{$_}{"reproc_PSD_μ"} . " " . $function_bin{$_}{"echo_PSD_μ"} . " " .
$function_bin{$_}{"Δ"} . " " . $function_bin{$_}{"Δ"} . " " .
$function_bin{$_}{"reproc_PSD_σ"}; $function_bin{$_}{"echo_PSD_σ"};
} }
close($datafile); close($datafile);
open($datafile,'>',"tmp.ccPSD") or die $!; open($datafile,'>',"tmp.crsspctrmPSD") or die $!;
while( each %function_bin) { while( each %function_bin) {
say $datafile say $datafile
$_ . " " . $_ . " " .
$function_bin{$_}{"cc_PSD_μ"} . " " . $function_bin{$_}{"crsspctrm_PSD_μ"} . " " .
$function_bin{$_}{"Δ"} . " " . $function_bin{$_}{"Δ"} . " " .
$function_bin{$_}{"cc_PSD_σ"}; $function_bin{$_}{"crsspctrm_PSD_σ"};
} }
close($datafile); close($datafile);
@ -282,4 +282,4 @@ while( each %function_bin) {
close($datafile); close($datafile);
#open($datafile,'>',"tmp.reprocPSD") or die $!; #open($datafile,'>',"tmp.echoPSD") or die $!;

View File

@ -1,11 +1,10 @@
# This method assumes y values are in logarithm units already. # This method assumes y values are in logarithm units already.
set title "%TITLE"
set terminal png set terminal png
set output "tmp.png" set output "%OUTPUTFILE"
set title "Yo" set title "%TITLE\n{/*0.5 %SUBTITLE}"
set xlabel "Temporal Frequency [1/days]" set xlabel "Temporal Frequency [days^{-1}]"
set xrange [0.005:0.603] set xrange [0.005:0.603]
# Use this if you want to show PSD directly on a log axis # Use this if you want to show PSD directly on a log axis
@ -20,4 +19,4 @@ set logscale x
set ylabel "log_{10} PSD" set ylabel "log_{10} PSD"
set yrange [-5.5:0.5] set yrange [-5.5:0.5]
plot '%FILE1' using 1:2:3:4 with xyerrorbars, \ plot '%FILE1' using 1:2:3:4 with xyerrorbars, \
'%FILE2' using 1:2:3:4 with xyerrorbars '%FILE2' using 1:2:3:4 with xyerrorbars

View File

@ -1,5 +1,6 @@
set terminal png set terminal png
set termoption dash set termoption dash
set output "%OUTPUTFILE"
plot 'tables/timelag_lc1.dat' using 1:2:3:4 with xyerrorbars, \ plot 'tables/timelag_lc1.dat' using 1:2:3:4 with xyerrorbars, \