From f4436c1f49114efdbde07b71f8c224052066109c Mon Sep 17 00:00:00 2001 From: caes Date: Wed, 10 Aug 2016 01:17:36 -0400 Subject: [PATCH] added templates and propagation of tables script --- scripts/propagate_tables.sh | 28 +++++ scripts/templates/psd_atlas.gp | 155 ++++++++++++++++++++++++++++ scripts/templates/timelag_atlas.gp | 159 +++++++++++++++++++++++++++++ 3 files changed, 342 insertions(+) create mode 100755 scripts/propagate_tables.sh create mode 100644 scripts/templates/psd_atlas.gp create mode 100644 scripts/templates/timelag_atlas.gp diff --git a/scripts/propagate_tables.sh b/scripts/propagate_tables.sh new file mode 100755 index 0000000..bb24864 --- /dev/null +++ b/scripts/propagate_tables.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +mkdir -p analyses/tables + +for analysis in analyses/* +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|') + +echo -n "Tabling PSD and time lags referred to ${ref_band} for $echo_band{${err_str}}." + + # Propagate tables into analyses/tables + 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 + + # Output curves to temporary files using perl script, move tables to + # permanent location. This just assumes there are no conflicts. + scripts/extract_tables.pl $analysis > /dev/null + mv tmp.echoPSD $echoPSD_tabfile + mv tmp.refPSD $refPSD_tabfile + mv tmp.timelag $timelag_tabfile +done + +rm tmp.* \ No newline at end of file diff --git a/scripts/templates/psd_atlas.gp b/scripts/templates/psd_atlas.gp new file mode 100644 index 0000000..416d3ed --- /dev/null +++ b/scripts/templates/psd_atlas.gp @@ -0,0 +1,155 @@ +set terminal pdf size 3.5,5 +set output "psd_atlas.pdf" +set termopt enhanced + +set macros + + # Placement of the a,b,c,d labels in the graphs + POS = "at graph 0.61,0.85 font 'Times,12'" + + # x- and ytics for each row resp. column + NOXNUMS = "unset xlabel;\ + set format x ''" + XNUMS = "unset xlabel;\ + set format x '10^{%+3T}'" + 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'" + NOYNUMS = "set format y ''; unset ylabel" + YNUMS = "set format y '%.0t'" + + VSET_1 = "set tmargin at screen 0.97; set bmargin at screen 0.825" + VSET_2 = "set tmargin at screen 0.825; set bmargin at screen 0.68" + VSET_3 = "set tmargin at screen 0.68; set bmargin at screen 0.535" + VSET_4 = "set tmargin at screen 0.535; set bmargin at screen 0.39" + VSET_5 = "set tmargin at screen 0.39; set bmargin at screen 0.245" + VSET_6 = "set tmargin at screen 0.245; set bmargin at screen 0.10" + + HSET_1 = "set lmargin at screen 0.15; set rmargin at screen 0.42" + HSET_2 = "set lmargin at screen 0.42; set rmargin at screen 0.69" + HSET_3 = "set lmargin at screen 0.69; set rmargin at screen 0.96" + +unset key +set logscale x +set xtics auto font 'Times,9' offset 0,.5 +set ytics auto font 'Times,9' +set ytics add ('' -0.5 1,'' -1.5 1,'' -2.5 1,'' -3.5 1,'' -4.5 1) +set xrange [0.005:0.620]; +set yrange [-5.5:0.5] + + +set multiplot layout 6,3 rowsfirst + + + # --- GRAPH a + @VSET_1; @HSET_1 + @NOXNUMS; @YNUMS + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH b + @NOXNUMS; @NOYNUMS + @VSET_1; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + #-- GRAPH c + @NOXNUMS; @NOYNUMS + @VSET_1; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH d + @NOXNUMS; @YNUMS + @VSET_2; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_2; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_2; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YNUMS + @VSET_3; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_3; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_3; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YLABEL + @VSET_4; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_4; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_4; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YNUMS + @VSET_5; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_5; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_5; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XNUMS; @YNUMS + @VSET_6; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XLABEL; @NOYNUMS + @VSET_6; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XNUMS; @NOYNUMS + @VSET_6; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + +unset multiplot + diff --git a/scripts/templates/timelag_atlas.gp b/scripts/templates/timelag_atlas.gp new file mode 100644 index 0000000..e72429d --- /dev/null +++ b/scripts/templates/timelag_atlas.gp @@ -0,0 +1,159 @@ +set terminal pdf size 3.5,5 +set output "timelag_atlas.pdf" +set termopt enhanced + +set macros + + # Placement of the a,b,c,d labels in the graphs + POS = "at graph 0.61,0.85 font 'Times,12'" + + # x- and ytics for each row resp. column + NOXNUMS = "unset xlabel;\ + set format x ''" + XNUMS = "unset xlabel;\ + set format x '10^{%+3T}'" + XLABEL = "set xlabel 'Temporal Frequency [days^{-1}]' font 'Times' off 0,1;\ + set format x '10^{%+3T}'" + YLABEL = "set ylabel 'Lag [days]' font 'Times' offset 1,2.5;\ + set format y '%.0t'" + NOYNUMS = "set format y ''; unset ylabel" + YNUMS = "set format y '%.0t'" + + + VSET_1 = "set tmargin at screen 0.97; set bmargin at screen 0.825" + VSET_2 = "set tmargin at screen 0.825; set bmargin at screen 0.68" + VSET_3 = "set tmargin at screen 0.68; set bmargin at screen 0.535" + VSET_4 = "set tmargin at screen 0.535; set bmargin at screen 0.39" + VSET_5 = "set tmargin at screen 0.39; set bmargin at screen 0.245" + VSET_6 = "set tmargin at screen 0.245; set bmargin at screen 0.10" + + HSET_1 = "set lmargin at screen 0.15; set rmargin at screen 0.42" + HSET_2 = "set lmargin at screen 0.42; set rmargin at screen 0.69" + HSET_3 = "set lmargin at screen 0.69; set rmargin at screen 0.96" + +unset key +set logscale x +set xtics auto font 'Times,9' offset 0,.5 +set ytics (-1,0,1,2,3,4,5) font 'Times,9' +set ytics add ('' -1.5 1,'' -0.5 1,'' 0.5 1,'' 1.5 1,'' 2.5 1,'' 3.5 1,'' 4.5 1,'' 5.5 1) +set xrange [0.005:0.620]; +set yrange [-2:6] + +# Draw line at origin +set arrow from 0.005,0 to 0.620,0 nohead lt 3 lc rgb 'black' +set pointsize 0 + +set multiplot layout 6,3 rowsfirst + + + # --- GRAPH a + @VSET_1; @HSET_1 + @NOXNUMS; @YNUMS + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH b + @NOXNUMS; @NOYNUMS + @VSET_1; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + #-- GRAPH c + @NOXNUMS; @NOYNUMS + @VSET_1; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH d + @NOXNUMS; @YNUMS + @VSET_2; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_2; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_2; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YNUMS + @VSET_3; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_3; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_3; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YLABEL + @VSET_4; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_4; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_4; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @YNUMS + @VSET_5; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_5; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @NOXNUMS; @NOYNUMS + @VSET_5; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XNUMS; @YNUMS + @VSET_6; @HSET_1 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XLABEL; @NOYNUMS + @VSET_6; @HSET_2 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + # --- GRAPH a + @XNUMS; @NOYNUMS + @VSET_6; @HSET_3 + set label 1 '%LABEL%' @POS + plot '%FILE%' using 1:2:($2-$4):($2+$4) with yerrorbars pt 7 ps .3 lt rgb "black" + + +unset multiplot +