did a bunch of work to the new main plot.sh script

This commit is contained in:
caes 2016-08-09 22:38:11 -04:00
parent da74e3d1a4
commit 4f54ac104e
5 changed files with 68 additions and 10 deletions

51
plot.sh Normal file → Executable file
View File

@ -3,3 +3,54 @@
# This metascript uses the available plotting scripts to produce a list of
# document-rady plots.
# Only analyses with this error type will be represented in the atlas
errtype="CM"
ref_band="1367Å"
echo_bands=$(ls analyses/*CM*|sed 's|[^≺]*≺_\(.\{5\}\).*|\1|')
# echo Using list of reverberated bands: $echo_bands
echo Propagating tables.
scripts/propagate_tables.sh > /dev/null
case $1 in
"PSD")
echo "Producing PSD atlas."
gnuplot_file=psd_atlas.gp
gnuplot_input=$(cat scripts/templates/${gnuplot_file}|perl -pe 's|\n|␤|g')
for tabfile in analyses/tables/PSD_*${errtype}*;
do
echo_band=$(basename $tabfile|
sed 's|PSD[_ ]\(.\{5\}\)[_ ]{[^_ ]*}.tab|\1|')
if [[ "$echo_band" == "$ref_band" ]] ; then continue; fi
gnuplot_input_edit=$(echo "$gnuplot_input"|
sed "s|%FILE%|$tabfile|"|
sed "s|%LABEL%|$echo_band|")
gnuplot_input="${gnuplot_input_edit}"
done
echo "$gnuplot_input"|perl -pe 's|␤|\n|g' > ${gnuplot_file}
gnuplot $gnuplot_file
;;
"lags")
echo "Producing time delay atlas."
gnuplot_file=timelag_atlas.gp
gnuplot_input=$(cat scripts/templates/${gnuplot_file}|perl -pe 's|\n|␤|g')
for tabfile in analyses/tables/timelag_*${errtype}*;
do
ref_band_extracted=$(basename $tabfile|sed 's|timelag_\([^≺]*\)[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*}.tab|\1|')
echo_band=$(basename $tabfile|sed 's|timelag_[^≺]*[_ ]≺[_ ]\([^≺_ ]*\)[_ ]{[^_ ]*}.tab|\1|')
if [[ "$echo_band" == "$ref_band" ]] ; then continue; fi
gnuplot_input_edit=$(echo "$gnuplot_input"|
sed "s|%FILE%|$tabfile|"|
sed "s|%LABEL%|$echo_band|")
gnuplot_input="${gnuplot_input_edit}"
done
echo "$gnuplot_input"|perl -pe 's|␤|\n|g' > ${gnuplot_file}
gnuplot $gnuplot_file
;;
default)
echo "Did not understand plot type."
;;
esac

View File

@ -1,5 +1,8 @@
#!/usr/bin/env perl
# This extracts the gnuplot-ready tables from a psdlag analysis and saves them
# to temporary files. propogate_tables.sh uses this script to create the
# tables it saves to analyses/tables.
use utf8;
use Encode qw(encode decode);

View File

@ -42,7 +42,7 @@ do
# Output curves to temporary files using perl script, move tables to
# permanent location. This just assumes there are no conflicts.
scripts/create_tables.pl $analysis > /dev/null
scripts/extract_tables.pl $analysis > /dev/null
mv tmp.echoPSD $echoPSD_tabfile
mv tmp.refPSD $refPSD_tabfile
mv tmp.timelag $timelag_tabfile

View File

@ -1,29 +1,34 @@
# This method assumes y values are in logarithm units already.
set terminal pngcairo
set terminal pdf
set output "%OUTPUTFILE"
set termoption dash
# set termoption dash
set termopt enhanced
set title "%TITLE\n{/*0.7 %SUBTITLE}"
set xlabel "Temporal Frequency [days^{-1}]"
set title "%TITLE\n{/*0.7 %SUBTITLE}" font "Times"
set xlabel "Temporal Frequency [days^{-1}]" font "Times"
set xrange [0.005:0.620]
set xtics font "Times"
set ytics font "Times"
# Use this if you want to show PSD directly on a log axis
# set logscale xy
# set ylabel "PSD"
# set ylabel "PSD" font "Times"
# set yrange [%YMIN:%YMAX]
# plot '%FILE1' using 1:(10**($2+2)):3:4 with xyerrorbars title "%LABEL1", \
# '%FILE2' using 1:(10**($2+2)):3:4 with xyerrorbars title "%LABEL2"
# Use this if you want to show the log value of the PSD
set logscale x
set ylabel "log_{10} PSD"
set ylabel "log_{10} PSD" font "Times"
#set yrange [%YMIN:%YMAX]
#set yrange [-5.5:0.5]
set key outside
set key center bottom
set key font "Times"
plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1", \
'%FILE2' using 1:2:3:4 with xyerrorbars title "%LABEL2"
set yzeroaxis
plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1" pt 0 ps 1 lt rgb "green", \
'%FILE2' using 1:2:3:4 with xyerrorbars title "%LABEL2" pt 0 ps 1 lt rgb "red"

View File

@ -2,7 +2,6 @@ set terminal pngcairo
set termoption dash
set termopt enhanced
set output "%OUTPUTFILE"
set encoding utf8
set title "%TITLE\n{/*0.7 %SUBTITLE}"
set xlabel "Temporal Frequency [days^{-1}]"