From 8f390445b90348e4c8396c90e0bfeb6c53872502 Mon Sep 17 00:00:00 2001 From: caes Date: Wed, 25 Jan 2017 01:19:52 -0500 Subject: [PATCH] changed to htings --- plot.sh | 2 +- run_analysis.sh | 22 +++++++++++++-------- scripts/analyze_lightcurve.py | 7 ++++--- scripts/extract_tables.pl | 36 ++++++++++++++++++++++------------ scripts/templates/psd_atlas.gp | 7 ++++++- 5 files changed, 49 insertions(+), 25 deletions(-) diff --git a/plot.sh b/plot.sh index cb4ee1a..43bf1c4 100755 --- a/plot.sh +++ b/plot.sh @@ -4,7 +4,7 @@ # document-rady plots. # Only analyses with this error type will be represented in the atlas -errtype="LF" +errtype=$(cat err_type) ref_band="1367Å" case $1 in diff --git a/run_analysis.sh b/run_analysis.sh index b60cbac..ad4d65d 100755 --- a/run_analysis.sh +++ b/run_analysis.sh @@ -5,22 +5,27 @@ # dataset(lightcurve directory), more? ref_band=$(cat ref_band) -ref_curve="/lightcurves/${ref_band}.lc" +ref_curve="lightcurves/${ref_band}.lc" err_str=$(cat err_type) mkdir -p analyses/tables -#for analysis in analyses/* -for echo_curve in "lightcurves/*" +for echo_curve in lightcurves/* do # Grab and determine labels of analyses, skip if over the same band. echo_band=$(basename $echo_curve|sed 's|\(.*\)\.lc|\1|') if [[ $ref_band == $echo_band ]]; then continue; fi -echo "Running analysis for $echo_band ≺ $ref_band" +echo "Analysing $echo_band ≺ $ref_band." - python scripts/analyze_lightcurve.py "$ref_curve $echo_curve" >> "analyses/${ref_band}_≺_${echo_band}" - scripts/extract_tables.pl + if [[ -e "analyses/${ref_band}_≺_${echo_band}/" ]]; then + echo "Results already exists. Create tables from stored results." + cp analyses/${ref_band}_≺_${echo_band}/*.out . + else + python scripts/analyze_lightcurve.py $ref_curve $echo_curve >> /dev/null + mkdir -p "analyses/${ref_band}_≺_${echo_band}" + cp *.out analyses/${ref_band}_≺_${echo_band}/ + fi echo "Tabling PSD and time lags referred to ${ref_band} for $echo_band{${err_str}}." @@ -31,10 +36,11 @@ echo "Tabling PSD and time lags referred to ${ref_band} for $echo_band{${err_str # 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 + scripts/extract_tables.pl mv tmp.echoPSD $echoPSD_tabfile mv tmp.refPSD $refPSD_tabfile mv tmp.timelag $timelag_tabfile + rm *.out done -rm tmp.* \ No newline at end of file +rm tmp.* diff --git a/scripts/analyze_lightcurve.py b/scripts/analyze_lightcurve.py index 56f67ed..617bfa4 100644 --- a/scripts/analyze_lightcurve.py +++ b/scripts/analyze_lightcurve.py @@ -47,11 +47,12 @@ lc1_strength_err = [lc1_table[i, 2] for i in index] #### Get the psd for the first light curve #### # These bin values determined summer 2016 for STORM III optical/UV lightcurves -fqL = np.array([0.0049999999, 0.018619375, 0.044733049, 0.069336227, 0.10747115, 0.16658029, 0.25819945, 0.40020915, 0.62032418]) +# fqL = np.array([0.0049999999, 0.018619375, 0.044733049, 0.069336227, 0.10747115, 0.16658029, 0.25819945, 0.40020915, 0.62032418]) # using utilities to set up frequency bins # -# fqL = np.logspace(np.log10(1.1/seg_length),np.log10(.5/dt),7) -# fqL = np.concatenate(([0.5/seg_length], fqL)) +seg_length = 256; +fqL = np.logspace(np.log10(1.1/seg_length),np.log10(.5/dt),7) +fqL = np.concatenate(([0.5/seg_length], fqL)) nfq = len(fqL) - 1 diff --git a/scripts/extract_tables.pl b/scripts/extract_tables.pl index 68c07f8..9b98157 100755 --- a/scripts/extract_tables.pl +++ b/scripts/extract_tables.pl @@ -16,6 +16,8 @@ use constant PI => 4 * atan2(1, 1); our $verbose=1; our $debug=0; +if ($debug) { $verbose=1; } + # This section locates the output data of interest in a # psdlab output file. @@ -68,19 +70,19 @@ foreach (@bin_bounds) { #say ($μ,":",$Δ); # push(@freq_coords_mean,$μ); # push(@freq_coords_σ,$Δ); - $function_bin{$μ} = {"Δ" => $Δ}; - $function_bin{$μ}{"ref_PSD_μ"} = $ref_psd[$count]; - $function_bin{$μ}{"ref_PSD_σ"} = $ref_psd_σ[$count]; - $function_bin{$μ}{"echo_PSD_μ"} = $echo_psd[$count]; - $function_bin{$μ}{"echo_PSD_σ"} = $echo_psd_σ[$count]; - $function_bin{$μ}{"crsspctrm_μ"} = $crosssp_psd[$count]; - $function_bin{$μ}{"crsspctrm_σ"} = $crosssp_psd_σ[$count]; + $function_bin{$μ} = {"Δ" => $Δ, + "ref_PSD_μ" => $ref_psd[$count], + "ref_PSD_σ" => $ref_psd_σ[$count], + "echo_PSD_μ" => $echo_psd[$count], + "echo_PSD_σ" => $echo_psd_σ[$count], + "crsspctrm_μ" => $crosssp_psd[$count], + "crsspctrm_σ" => $crosssp_psd_σ[$count], + "timelag_μ" => $timelag[$count], + "timelag_σ" => $timelag_σ[$count]}; # $function_bin{$μ}{"φdiff_μ"} = $μ; # $function_bin{$μ}{"φdiff_σ"} = $σ; # $μ = $μ/(2*PI*$μ); # $σ = $σ/(2*PI*$μ); - $function_bin{$μ}{"timelag_μ"} = $timelag[$count]; - $function_bin{$μ}{"timelag_σ"} = $timelag_σ[$count]; $count = $count + 1; } @@ -94,10 +96,20 @@ $numbins = keys %function_bin; say encode($charset,"$numbins frequency bins captured in output."); if($verbose) { - say encode($charset,"freq μ freq σ"); - while (each %function_bin ) { + say encode($charset,"freq μ freq σ ref_PSD_μ ref_PSD_σ echo_PSD_μ echo_PSD_σ timelag_μ timelag_σ"); + + foreach (sort { $a <=> $b } keys %function_bin) { say encode($charset, - sprintf("%f %f",$_,$function_bin{$_}{"Δ"})); + sprintf("%f %f %f %f %f %f %f %f ", + $_, + $function_bin{$_}{"Δ"}, + $function_bin{$_}{"ref_PSD_μ"}, + $function_bin{$_}{"ref_PSD_σ"}, + $function_bin{$_}{"echo_PSD_μ"}, + $function_bin{$_}{"echo_PSD_σ"}, + $function_bin{$_}{"timelag_μ"}, + $function_bin{$_}{"timelag_σ"} + )); } } diff --git a/scripts/templates/psd_atlas.gp b/scripts/templates/psd_atlas.gp index 416d3ed..fa7cbc4 100644 --- a/scripts/templates/psd_atlas.gp +++ b/scripts/templates/psd_atlas.gp @@ -35,9 +35,14 @@ 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]; + +# xrange from 2016 REU freq bins +#set xrange [0.005:0.620]; set yrange [-5.5:0.5] +# xrange pulled from example.py from first version of clag +set xrange [0.001:5] +set yrange [-5.5:0.5] set multiplot layout 6,3 rowsfirst