diff --git a/scripts/plot_MC_against_CM.sh b/scripts/plot_MC_against_CM.sh index 60d85a2..36e7ffb 100755 --- a/scripts/plot_MC_against_CM.sh +++ b/scripts/plot_MC_against_CM.sh @@ -69,7 +69,7 @@ do sed 's|=|=|g'| sed 's|Å|A|g') - cat scripts/templates/psd_freq.gp| + cat scripts/templates/psd.gp| sed "s|%TITLE|Error Fit Comparison for PSD of $echo_band|"| sed "s|%SUBTITLE|as reported by Fausnaugh et. al, STORM III, 2016|"| sed "s|%FILE1|$table|"| diff --git a/scripts/plot_psdlag.sh b/scripts/plot_psdlag.sh index 79c8f4e..e101758 100755 --- a/scripts/plot_psdlag.sh +++ b/scripts/plot_psdlag.sh @@ -29,7 +29,6 @@ do # Grab and determine labels of analyses, skip if over the same band. ref_band=$(basename $analysis|sed 's|\([^≺]*\)[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*}|\1|') echo_band=$(basename $analysis|sed 's|[^≺]*[_ ]≺[_ ]\([^≺_ ]*\)[_ ]{[^_ ]*}|\1|') - if [[ $ref_band == $echo_band ]]; then continue; fi err_str=$(basename $analysis|sed 's|[^≺]*[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*;\(σ∊[CLM][MFC]\)}|\1|') # Prepare files @@ -37,8 +36,8 @@ do echoPSD_tabfile=analyses/tables/PSD_${echo_band}_\{${err_str}\}.tab refPSD_tabfile=analyses/tables/PSD_${ref_band}_\{${err_str}\}.tab timelag_tabfile=analyses/tables/timelag_${ref_band}_≺_${echo_band}_\{${err_str}\}.tab - PSD_plotfile=analyses/plots/PSD_${ref_band}_≺_${echo_band}_\{${err_str}\}.png - timelag_plotfile=analyses/plots/timelag_${ref_band}_≺_${echo_band}_\{${err_str}\}.png + PSD_plotfile=analyses/plots/PSD_${echo_band}_\{${err_str}\}.pdf + timelag_plotfile=analyses/plots/timelag_${ref_band}_≺_${echo_band}_\{${err_str}\}.pdf # Output curves to temporary files using perl script, move tables to # permanent location. This just assumes there are no conflicts. @@ -51,26 +50,26 @@ do # Plot PSD and save using gnuplot # read ymin ymax <<< $(ywindow_of $timelag_tabfile) # echo $ymin $ymax - cat scripts/templates/psd_freq.gp| - sed "s|%TITLE|Power Spectrum for Lightcurves $echo_band and $ref_band|"| - sed "s|%SUBTITLE|as reported by Fausnaugh et. al, STORM III, 2016|"| - sed "s|%FILE1|$refPSD_tabfile|"| - sed "s|%LABEL1|${ref_band} PSD|"| - sed "s|%FILE2|$echoPSD_tabfile|"| - sed "s|%LABEL2|${echo_band} PSD|"| - sed "s|%YMIN|$ymin|"|sed "s|%YMAX|$ymax|"| - sed "s|%OUTPUTFILE|$PSD_plotfile|" > tmp.gp + cat scripts/templates/psd.gp| + sed "s|%TITLE%|Power Spectrum for Lightcurves $echo_band and $ref_band|"| + sed "s|%SUBTITLE%|as reported by Fausnaugh et. al, STORM III, 2016|"| + sed "s|%FILE1%|$echoPSD_tabfile|"| + sed "s|%LABEL1%|${echo_band} PSD|"| + #sed "s|%FILE2%|$refPSD_tabfile|"| + #sed "s|%LABEL2%|${ref_band} PSD|"| + sed "s|%YMIN%|$ymin|"|sed "s|%YMAX|$ymax|"| + sed "s|%OUTPUTFILE%|$PSD_plotfile|" > tmp.gp gnuplot tmp.gp # Plot time lags and save using gnuplot # read ymin ymax <<< $(ywindow_of $timelag_tabfile) 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|$timelag_tabfile|"| - sed "s|%LABEL1|${echo_band} Lag|"| - sed "s|%YMIN|$ymin|"|sed "s|%YMAX|$ymax|"| - sed "s|%OUTPUTFILE|$timelag_plotfile|" > tmp.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%|$timelag_tabfile|"| + sed "s|%LABEL1%|${echo_band} Lag|"| + sed "s|%YMIN%|$ymin|"|sed "s|%YMAX|$ymax|"| + sed "s|%OUTPUTFILE%|$timelag_plotfile|" > tmp.gp gnuplot tmp.gp done diff --git a/scripts/templates/psd.gp b/scripts/templates/psd.gp new file mode 100644 index 0000000..4989ffb --- /dev/null +++ b/scripts/templates/psd.gp @@ -0,0 +1,37 @@ +# This method assumes y values are in logarithm units already. + +set terminal pdf +set output "%OUTPUTFILE%" +set termopt enhanced + +set macros + + # Placement of the a,b,c,d labels in the graphs + POS = "at graph 0.7,0.92 font 'Times,24'" + + + + XLABEL = "set xlabel 'Temporal Frequency [days^{-1}]' font 'Times' off 0,1;\ + set format x '10^{%+3T}'" + YLABEL = "set ylabel 'log_{10} PSD' font 'Times' offset 1,2.5;\ + set format y '%.0t'" + + +unset title +unset key + +set xlabel "Temporal Frequency [days^{-1}]" font "Times,24" +set xrange [0.005:0.620] +set xtics auto font 'Times,16' +set logscale x + +set ylabel "log_{10} PSD" font "Times,24" +set yrange [-5.5:0.5] +set ytics auto font 'Times,16' +set ytics add ('' -0.5 1,'' -1.5 1,'' -2.5 1,'' -3.5 1,'' -4.5 1) +set yzeroaxis + +set label 1 '%LABEL1%' @POS + +plot '%FILE1%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .5 lt rgb "black", \ +'%FILE2%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .5 lt rgb "red" diff --git a/scripts/templates/psd_freq.gp b/scripts/templates/psd_freq.gp deleted file mode 100644 index 1a6faec..0000000 --- a/scripts/templates/psd_freq.gp +++ /dev/null @@ -1,34 +0,0 @@ -# This method assumes y values are in logarithm units already. - -set terminal pdf -set output "%OUTPUTFILE" -# set termoption dash -set termopt enhanced - -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" 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" font "Times" -#set yrange [%YMIN:%YMAX] -#set yrange [-5.5:0.5] - -set key outside -set key center bottom -set key font "Times" - -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"