clag-agn/scripts/plot.sh

96 lines
3.8 KiB
Bash
Raw Normal View History

2017-06-22 10:10:46 +00:00
#!/usr/bin/env bash
# This metascript uses the available plotting scripts to produce a list of
# document-rady plots.
2017-06-22 10:36:22 +00:00
ref_band="1367A"
2017-06-22 10:10:46 +00:00
case $1 in
"PSD"|"psd"|"PSDs"|"PSDS"|"psds")
gnuplot_file=psd_atlas.gp
2017-06-22 10:49:53 +00:00
gnuplot_input=$(cat scripts/templates/${gnuplot_file}|
perl -pe 's|\n|␤|g')
for tabfile in data/tables/psd_*.tab;
2017-06-22 10:10:46 +00:00
do
echo_band=$(basename $tabfile|
2017-06-22 11:11:39 +00:00
sed 's|psd_\([0-9]\{4\}A\).tab|\1|')
2017-06-22 10:10:46 +00:00
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
2017-06-22 11:40:19 +00:00
rm $gnuplot_file
2017-06-22 10:10:46 +00:00
;;
"lags"|"lag"|"delay"|"delays")
2017-06-22 11:40:19 +00:00
gnuplot_file=lag_atlas.gp
2017-06-22 10:10:46 +00:00
gnuplot_input=$(cat scripts/templates/${gnuplot_file}|perl -pe 's|\n|␤|g')
2017-06-22 11:18:00 +00:00
for tabfile in data/tables/lag_*.tab;
2017-06-22 10:10:46 +00:00
do
2017-06-22 11:18:00 +00:00
ref_band_extracted=$(basename $tabfile|
sed 's|lag_\([0-9]\{4\}A\)_[0-9]\{4\}A.tab|\1|')
echo_band=$(basename $tabfile|
sed 's|lag_[0-9]\{4\}A_\([0-9]\{4\}A\).tab|\1|')
2017-06-22 10:10:46 +00:00
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
2017-06-22 11:40:19 +00:00
rm $gnuplot_file
2017-06-22 10:10:46 +00:00
;;
2017-06-22 13:28:23 +00:00
"twolags"|"2lags"|"overlay")
gnuplot_file=lag_atlas_overlay.gp
2017-06-22 12:11:27 +00:00
gnuplot_input=$(cat scripts/templates/${gnuplot_file}|perl -pe 's|\n|␤|g')
for tabfile in data/tables/${2}/lag_*.tab;
do
ref_band_extracted=$(basename $tabfile|
sed 's|lag_\([0-9]\{4\}A\)_[0-9]\{4\}A.tab|\1|')
echo_band=$(basename $tabfile|
sed 's|lag_[0-9]\{4\}A_\([0-9]\{4\}A\).tab|\1|')
if [[ "$echo_band" == "$ref_band" ]] ; then continue; fi
gnuplot_input_edit=$(echo "$gnuplot_input"|
2017-06-22 13:28:23 +00:00
sed "s|%FILEA%|$tabfile|"|
2017-06-22 12:11:27 +00:00
sed "s|%LABEL%|$echo_band|")
gnuplot_input="${gnuplot_input_edit}"
2017-07-05 17:35:33 +00:00
comp_tabfile=$(echo $tabfile|sed "s|${2}|${3}|")
2017-06-22 12:11:27 +00:00
gnuplot_input_edit=$(echo "$gnuplot_input"|
2017-07-05 17:35:33 +00:00
sed "s|%FILEB%|$comp_tabfile|")
2017-06-22 12:11:27 +00:00
gnuplot_input="${gnuplot_input_edit}"
2017-07-05 17:35:33 +00:00
2017-06-22 12:11:27 +00:00
done
2017-07-05 17:35:33 +00:00
# for tabfile in data/tables/${3}/lag_*.tab;
# do
# ref_band_extracted=$(basename $tabfile|
# sed 's|lag_\([0-9]\{4\}A\)_[0-9]\{4\}A.tab|\1|')
# echo_band=$(basename $tabfile|
# sed 's|lag_[0-9]\{4\}A_\([0-9]\{4\}A\).tab|\1|')
# if [[ "$echo_band" == "$ref_band" ]] ; then continue; fi
# gnuplot_input_edit=$(echo "$gnuplot_input"|
# sed "s|%FILEB%|$tabfile|"|
# sed "s|%LABEL%|$echo_band|")
# gnuplot_input="${gnuplot_input_edit}"
# done
2017-06-22 12:11:27 +00:00
echo "$gnuplot_input"|perl -pe 's|␤|\n|g' > ${gnuplot_file}
gnuplot $gnuplot_file
rm $gnuplot_file
;;
2017-06-22 10:10:46 +00:00
"tophat"|"th")
2017-06-22 10:36:22 +00:00
mkdir -p data/tables/
2017-06-22 10:10:46 +00:00
scripts/tophat_fft.pl
gnuplot scripts/templates/tophat_freqdomain.gp
gnuplot scripts/templates/tophat_timedomain.gp
;;
*)
echo "Did not understand plot type."
;;
esac