generalized some things and setup to plot comparisons of PSD and timelag for different error fit types

This commit is contained in:
caes 2016-07-27 02:11:17 -04:00
parent ff59a89aaa
commit 48bfc7d420
6 changed files with 101 additions and 35 deletions

View File

@ -38,7 +38,7 @@ do
# Determine band and inputs for band # Determine band and inputs for band
echo_band=$(basename $echo_curve|sed 's@\(.*\)\.lc@\1@') echo_band=$(basename $echo_curve|sed 's@\(.*\)\.lc@\1@')
echo -n $(date "+%R")\: Running psdlag for $echo_band against $ref_band. echo -n $(date "+%R")\: Running psdlag for $echo_band against $ref_band.
outputfile="analyses/${ref_band}_≺_${echo_band}_Δt${timestep}_σ${err_src}" outputfile="analyses/${ref_band}_≺_${echo_band}_{Δt${timestep};σ∊${err_src}}"
case $echo_band in case $echo_band in
"4775Å") "4775Å")
initial_params="$refpsd_params -9.745e-01 -1.384e+00 -2.748e+00 -3.305e+00 -3.314e+00 -3.389e+00 -4.198e+00 -4.465e+00 -4.700e-01 -7.487e-01 -2.046e+00 -2.428e+00 -2.953e+00 -3.086e+00 -3.761e+00 -4.290e+00 9.862e-02 3.899e-01 8.650e-01 5.516e-01 2.228e-01 9.508e-01 -2.872e-01 9.059e-02" initial_params="$refpsd_params -9.745e-01 -1.384e+00 -2.748e+00 -3.305e+00 -3.314e+00 -3.389e+00 -4.198e+00 -4.465e+00 -4.700e-01 -7.487e-01 -2.046e+00 -2.428e+00 -2.953e+00 -3.086e+00 -3.761e+00 -4.290e+00 9.862e-02 3.899e-01 8.650e-01 5.516e-01 2.228e-01 9.508e-01 -2.872e-01 9.059e-02"
@ -120,18 +120,20 @@ do
if [[ $1 == "thor" ]] if [[ $1 == "thor" ]]
then then
echo_band_noUTF=$(echo $echo_band| echo_band_noUTF=$(echo $echo_band|
sed 's|𝛌||g'| #sed 's|𝛌||g'|
sed 's|(|_|g'| #sed 's|(|_|g'|
sed 's|)|_|g'| #sed 's|)|_|g'|
sed 's|||g'| sed 's|||g'|
sed 's|Å|A|g') sed 's|Å|A|g')
outputfile_noUTF=$(echo $outputfile| outputfile_noUTF=$(echo $outputfile|
sed 's|𝛌||g'| #sed 's|𝛌||g'|
sed 's|(|_|g'| #sed 's|(|_|g'|
sed 's|)|_|g'| #sed 's|)|_|g'|
sed 's|||g'| sed 's|||g'|
sed 's|[{}]|_|g'|
sed 's|;|_|'|
sed 's|Å|A|g'| sed 's|Å|A|g'|
sed 's|≺|_|g'| sed 's|__|_|g'|
sed 's|σ∊|err|') sed 's|σ∊|err|')
argsfile="thor/arguments/$echo_band_noUTF.args" argsfile="thor/arguments/$echo_band_noUTF.args"
submitscript="thor/${echo_band_noUTF}.pbs" submitscript="thor/${echo_band_noUTF}.pbs"

View File

@ -1,13 +1,20 @@
#!/usr/bin/env bash #!/usr/bin/env bash
for analysis in analyses/* for analysis in analyses/*A_*
do do
if [[ $analysis == "analyses/*A_*" ]]; then continue; fi
echo Restoring unicode characters to $analysis.
new_name=$(basename $analysis| new_name=$(basename $analysis|
sed 's|A_|Å\)|g'| #sed 's|_\([0-9]\+\)|\(𝛌=\1|g'|
sed 's|_\([0-9]\+\)|\(𝛌=\1|g'| sed 's|_|≺|'|
sed 's|_|_≺_|'| sed 's|_|{|'|
sed 's|_|;|'|
#sed 's|_|}|'|
sed 's|A|Å|'|
sed 's|A|Å_|'|
sed 's|≺|_≺_|'|
sed 's|Δt|Δt|'| sed 's|Δt|Δt|'|
sed 's|err|σ∊|')_σ∊MC sed 's|err|σ∊|')}
mv $analysis analyses/$new_name mv $analysis analyses/$new_name
done done

View File

@ -1,13 +1,17 @@
for table in analyses/tables/*_σ∊MC_timelag* for table in analyses/tables/timelag*MC}.tab
do do
ref_band=$(basename $table|sed 's|\([^≺]*\)_≺_[^≺_]*_[^_]*_[^_]*\.tab|\1|') #ref_band=$(basename $table|sed 's|\([^≺]*\)_≺_[^≺_]*_[^_]*_[^_]*\.tab|\1|')
echo_band=$(basename $table|sed 's|[^≺]*_≺_\([^≺_]*\)_[^_]*_[^_]*\.tab|\1|') #echo_band=$(basename $table|sed 's|[^≺]*_≺_\([^≺_]*\)_[^_]*_[^_]*\.tab|\1|')
if [[ $ref_band == $echo_band ]]; then continue; fi
err_str=$(basename $table|sed 's|[^≺]*_≺_[^≺_]*_\(σ∊[CLM][MFC]\)\_[^_]*.tab|\1|')
CMtable=$(echo $table|sed 's|∊MC|∊CM|') CMtable=$(echo $table|sed 's|∊MC|∊CM|')
plotfile=analyses/plots/${echo_band}_error_compare.png ref_band=$(basename $table|sed 's|timelag_\([^≺]*\)[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*}.tab|\1|')
echo_band=$(basename $table|sed 's|timelag_[^≺]*[_ ]≺[_ ]\([^≺_ ]*\)[_ ]{[^_ ]*}.tab|\1|')
if [[ $ref_band == $echo_band ]]; then continue; fi
err_str=$(basename $table|sed 's|timelag_[^≺]*[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*\(σ∊[CLM][MFC]\)}.tab|\1|')
echo Plotting timelag error fit comparison for $echo_band.
plotfile=analyses/plots/timelag_${echo_band}_error_compare.png
echo_band_noUTF=$(echo $echo_band| echo_band_noUTF=$(echo $echo_band|
sed 's|𝛌|λ|g'| sed 's|𝛌|λ|g'|
@ -24,12 +28,54 @@ do
sed 's|Å|A|g') sed 's|Å|A|g')
cat scripts/templates/timelag_compare.gp| cat scripts/templates/timelag_compare.gp|
sed "s|%TITLE|Error Fit Comparison for Time Lag of $echo_band_noUTF|"| sed "s|%TITLE|Error Fit Comparison for Time Lag of $echo_band|"|
sed "s|%SUBTITLE|referred to ${ref_band_noUTF}, as reported by Fausnaugh et. al, STORM III, 2016|"| sed "s|%SUBTITLE|referred to ${ref_band}, as reported by Fausnaugh et. al, STORM III, 2016|"|
sed "s|%FILE1|$table|"| sed "s|%FILE1|$table|"|
sed "s|%LABEL1|${echo_band_noUTF} with Monte Carlo Fit|"| sed "s|%LABEL1|${echo_band} Delay with Monte Carlo Fit|"|
sed "s|%FILE2|$CMtable|"| sed "s|%FILE2|$CMtable|"|
sed "s|%LABEL2|${echo_band_noUTF} with Covariance Matrix Fit|"| sed "s|%LABEL2|${echo_band} Delay with Covariance Matrix Fit|"|
sed "s|%YMIN|$ymin|"|sed "s|%YMAX|$ymax|"|
sed "s|%OUTPUTFILE|$plotfile|" > tmp.gp
gnuplot tmp.gp
done
for table in analyses/tables/PSD*MC}.tab
do
#ref_band=$(basename $table|sed 's|\([^≺]*\)_≺_[^≺_]*_[^_]*_[^_]*\.tab|\1|')
#echo_band=$(basename $table|sed 's|[^≺]*_≺_\([^≺_]*\)_[^_]*_[^_]*\.tab|\1|')
CMtable=$(echo $table|sed 's|∊MC|∊CM|')
echo_band=$(basename $table|sed 's|PSD[_ ]\([0-9]\{4\}\)Å[_ ]{[^_ ]*}.tab|\1Å|')
if [[ $ref_band == $echo_band ]]; then continue; fi
err_str=$(basename $table|sed 's|PSD[ _]\([0-9]\{4\}\)Å[_ ]{[^_ ]*\(σ∊[CLM][MFC]\)}.tab|\1|')
echo Plotting PSD error fit comparison for $echo_band.
plotfile=analyses/plots/PSD_${echo_band}_error_compare.png
echo_band_noUTF=$(echo $echo_band|
sed 's|𝛌|λ|g'|
#sed 's|(|_|g'|
#sed 's|)|_|g'|
sed 's||=|g'|
sed 's|Å|A|g')
ref_band_noUTF=$(echo $ref_band|
sed 's|𝛌|λ|g'|
#sed 's|(|_|g'|
#sed 's|)|_|g'|
sed 's||=|g'|
sed 's|Å|A|g')
cat scripts/templates/psd_freq.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|"|
sed "s|%LABEL1|${echo_band} PSD with Monte Carlo Fit|"|
sed "s|%FILE2|$CMtable|"|
sed "s|%LABEL2|${echo_band} PSD with Covariance Matrix Fit|"|
sed "s|%YMIN|$ymin|"|sed "s|%YMAX|$ymax|"| sed "s|%YMIN|$ymin|"|sed "s|%YMAX|$ymax|"|
sed "s|%OUTPUTFILE|$plotfile|" > tmp.gp sed "s|%OUTPUTFILE|$plotfile|" > tmp.gp
gnuplot tmp.gp gnuplot tmp.gp

View File

@ -19,21 +19,26 @@ mkdir -p analyses/tables
mkdir -p analyses/plots mkdir -p analyses/plots
# Restore the proper naming conventions for any files stripped
# of their unicode characters.
scripts/fix_thor_names.sh
# Create tables and plot the power spectra distributions and time lags.
for analysis in analyses/* for analysis in analyses/*
do do
# Grab and determine labels of analyses, skip if over the same band. # Grab and determine labels of analyses, skip if over the same band.
ref_band=$(basename $analysis|sed 's@\([^≺]*\)[_ ]≺[_ ][^≺_ ]*[_ ][^_ ]*[_ ][^_ ]*@\1@') ref_band=$(basename $analysis|sed 's|\([^≺]*\)[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*}|\1|')
echo_band=$(basename $analysis|sed 's@[^≺]*[_ ]≺[_ ]\([^≺_ ]*\)[_ ][^_ ]*[_ ][^_ ]*@\1@') echo_band=$(basename $analysis|sed 's|[^≺]*[_ ]≺[_ ]\([^≺_ ]*\)[_ ]{[^_ ]*}|\1|')
if [[ $ref_band == $echo_band ]]; then continue; fi if [[ $ref_band == $echo_band ]]; then continue; fi
err_type=$(basename $analysis|sed 's@[^≺]*[_ ]≺[_ ][^≺_ ]*[_ ][^_ ]*[_ ]\(σ∊[CLM][MFC]\)@\1@') err_str=$(basename $analysis|sed 's|[^≺]*[_ ]≺[_ ][^≺_ ]*[_ ]{[^_ ]*;\(σ∊[CLM][MFC]\)}|\1|')
# Prepare files # Prepare files
echo "Plotting PSD and time lags for $echo_band, referred to ${ref_band}." echo "Plotting PSD and time lags for $echo_band, referred to ${ref_band}."
echoPSD_tabfile=analyses/tables/${echo_band}_${err_type}_PSD.tab echoPSD_tabfile=analyses/tables/PSD_${echo_band}_\{${err_str}\}.tab
refPSD_tabfile=analyses/tables/${ref_band}_${err_type}_PSD.tab refPSD_tabfile=analyses/tables/PSD_${ref_band}_\{${err_str}\}.tab
timelag_tabfile=analyses/tables/${ref_band}_≺_${echo_band}_${err_type}_timelag.tab timelag_tabfile=analyses/tables/timelag_${ref_band}_≺_${echo_band}_\{${err_str}\}.tab
PSD_plotfile=analyses/plots/${ref_band}_≺_${echo_band}_${err_type}_PSD.png PSD_plotfile=analyses/plots/PSD_${ref_band}_≺_${echo_band}_\{${err_str}\}.png
timelag_plotfile=analyses/plots/${ref_band}_≺_${echo_band}_${err_type}_timelag.png timelag_plotfile=analyses/plots/timelag_${ref_band}_≺_${echo_band}_\{${err_str}\}.png
# Output curves to temporary files using perl script, move tables to # Output curves to temporary files using perl script, move tables to
# permanent location. This just assumes there are no conflicts. # permanent location. This just assumes there are no conflicts.

View File

@ -18,6 +18,10 @@ set xrange [0.005:0.620]
set logscale x set logscale x
set ylabel "log_{10} PSD" set ylabel "log_{10} PSD"
#set yrange [%YMIN:%YMAX] #set yrange [%YMIN:%YMAX]
set yrange [-5.5:0.5] #set yrange [-5.5:0.5]
set key outside
set key center bottom
plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1", \ plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1", \
'%FILE2' using 1:2:3:4 with xyerrorbars title "%LABEL2" '%FILE2' using 1:2:3:4 with xyerrorbars title "%LABEL2"

View File

@ -11,9 +11,11 @@ set logscale x
set ylabel "Lag [days]" set ylabel "Lag [days]"
#set yrange [%YMIN:%YMAX] #set yrange [%YMIN:%YMAX]
set key outside
set key center bottom
# Draw line at origin # Draw line at origin
set arrow from 0.005,0 to 0.620,0 nohead lt 3 lc rgb 'black' set arrow from 0.005,0 to 0.620,0 nohead lt 3 lc rgb 'black'
set pointsize 0
plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1", \ plot '%FILE1' using 1:2:3:4 with xyerrorbars title "%LABEL1", \
"%FILE2" using 1:2:3:4 with xyerrorbars title "%LABEL2" "%FILE2" using 1:2:3:4 with xyerrorbars title "%LABEL2"