mirror of
				https://asciireactor.com/otho/psdlag-agn.git
				synced 2025-10-31 21:48:04 +00:00 
			
		
		
		
	renaming files as the project develops
This commit is contained in:
		
							parent
							
								
									ae2c7ca347
								
							
						
					
					
						commit
						fa40af3ce9
					
				| @ -1,12 +1,50 @@ | ||||
| #!/usr/local/bin/bash | ||||
| 
 | ||||
| mkdir -p analyses/tables | ||||
| mkdir -p analyses/plots | ||||
| 
 | ||||
| 
 | ||||
| for analysis in analyses/* | ||||
| do | ||||
|     driving_name=$(basename $analysis|sed 's@[^≻]*≻\([^≻_]*\)_[^_]*@\1@') | ||||
|     reproc_name=$(basename $analysis|sed 's@\([^≻]*\)≻[^≻_]*_[^_]*@\1@') | ||||
|     # scripts/power_lag_plot.pl $analysis | ||||
|     # mv tmp.sourcePSD analyses/tables/$reproc_namePSD.tab | ||||
|     echo $driving_name with $reproc_name | ||||
|     # 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 | ||||
| 
 | ||||
|     # Prepare files | ||||
|     echo "Plotting PSD and time lags for $echo_band, referred to ${ref_band}." | ||||
|     echoPSD_tabfile=analyses/tables/${echo_band}PSD.tab | ||||
|     refPSD_tabfile=analyses/tables/${ref_band}PSD.tab | ||||
|     PSD_plotfile=analyses/plots/${echo_band}_≻_${ref_band}_PSD.png | ||||
|     timelag_plotfile=analyses/plots/${echo_band}_≻_${ref_band}_timelag.png | ||||
| 
 | ||||
|     # Output curves to temporary files using perl script, move tables to | ||||
|     # permanent location. This just assumes there are no conflicts. | ||||
|     scripts/power_lag_plot.pl $analysis | ||||
|     mv tmp.echoPSD $echoPSD_tabfile | ||||
|     mv tmp.refPSD $refPSD_tabfile | ||||
|     mv  | ||||
| 
 | ||||
|     # Plot PSD and save using gnuplot | ||||
|     cat scripts/templates/psd_freq.gp| | ||||
|         sed "s@%TITLE@Power Spectrum for Lightcurves $echo_band & $ref_band@"| | ||||
|         sed "s@%SUBTITLE@as reported by Fausnaugh et. al, STORM III, 2016@"| | ||||
|         sed "s@%FILE1@$refPSD_tabfile@"| | ||||
|         sed "s@%FILE2@$echoPSD_tabfile@"| | ||||
|         sed "s@%OUTPUTFILE@$PSD_plotfile@" > | ||||
|             tmp.gp | ||||
|     gnuplot tmp.gp | ||||
| 
 | ||||
|     # Plot time lags and save using gnuplot | ||||
|     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@$refPSD_tabfile@"| | ||||
|         sed "s@%FILE2@$echoPSD_tabfile@"| | ||||
|         sed "s@%OUTPUTFILE@$PSD_plotfile@" > | ||||
|             tmp.gp | ||||
|     gnuplot tmp.gp | ||||
| done | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -105,7 +105,7 @@ increments to designate the data being captured. | ||||
| if ($verbose) { | ||||
|     say encode($charset,""); | ||||
|     say encode($charset, | ||||
|         "           New Curve -- Source PSD"); | ||||
|         "           New Curve -- Reference Curve PSD"); | ||||
|     say encode($charset, | ||||
|         "──────────────────────────────────────────────────"); | ||||
| } | ||||
| @ -118,8 +118,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) { | ||||
| #        $μ = abs($μ); | ||||
| #        $function_bin{$_}{"φdiff_μ"} = PI; | ||||
| #    } | ||||
|     $function_bin{$_}{"source_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"source_PSD_σ"} = $σ; | ||||
|     $function_bin{$_}{"ref_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"ref_PSD_σ"} = $σ; | ||||
|     if ($verbose) { | ||||
|         say encode($charset, | ||||
|             "freq = " . | ||||
| @ -134,7 +134,7 @@ foreach ( sort { $a <=> $b } keys %function_bin ) { | ||||
| if ($verbose) { | ||||
|     say encode($charset,""); | ||||
|     say encode($charset, | ||||
|         "          New Curve -- Reprocessed PSD"); | ||||
|         "          New Curve -- Reverberating Curve PSD"); | ||||
|     say encode($charset, | ||||
|         "──────────────────────────────────────────────────"); | ||||
| } | ||||
| @ -146,8 +146,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) { | ||||
| #        $μ = abs($μ); | ||||
| #        $function_bin{$_}{"φdiff_μ"} = PI; | ||||
| #    } | ||||
|     $function_bin{$_}{"reproc_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"reproc_PSD_σ"} = $σ; | ||||
|     $function_bin{$_}{"echo_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"echo_PSD_σ"} = $σ; | ||||
|     if ($verbose) { | ||||
|         say encode($charset, | ||||
|             "freq = " . | ||||
| @ -163,7 +163,7 @@ foreach ( sort { $a <=> $b } keys %function_bin ) { | ||||
| if ($verbose) { | ||||
|     say encode($charset,""); | ||||
|     say encode($charset, | ||||
|         "          New Curve -- Cross Spectra PSD"); | ||||
|         "          New Curve -- Cross Spectrum PSD"); | ||||
|     say encode($charset, | ||||
|         "──────────────────────────────────────────────────"); | ||||
| } | ||||
| @ -175,8 +175,8 @@ foreach ( sort { $a <=> $b } keys %function_bin ) { | ||||
| #        $μ = abs($μ); | ||||
| #        $function_bin{$_}{"φdiff_μ"} = PI; | ||||
| #    } | ||||
|     $function_bin{$_}{"cc_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"cc_PSD_σ"} = $σ; | ||||
|     $function_bin{$_}{"crsspctrm_PSD_μ"} = $μ; | ||||
|     $function_bin{$_}{"crsspctrm_PSD_σ"} = $σ; | ||||
|     if ($verbose) { | ||||
|         say encode($charset, | ||||
|             "freq = " . | ||||
| @ -241,33 +241,33 @@ if($debug) { | ||||
| 
 | ||||
| close($outputfile); | ||||
| 
 | ||||
| open($datafile,'>',"tmp.sourcePSD") or die $!; | ||||
| open($datafile,'>',"tmp.refPSD") or die $!; | ||||
| while( each %function_bin) { | ||||
|     say $datafile | ||||
|         $_ . " " . | ||||
|         $function_bin{$_}{"source_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"ref_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"Δ"} . " " . | ||||
|         $function_bin{$_}{"source_PSD_σ"}; | ||||
|         $function_bin{$_}{"ref_PSD_σ"}; | ||||
| } | ||||
| close($datafile); | ||||
| 
 | ||||
| open($datafile,'>',"tmp.reprocPSD") or die $!; | ||||
| open($datafile,'>',"tmp.echoPSD") or die $!; | ||||
| while( each %function_bin) { | ||||
|     say $datafile | ||||
|         $_ . " " . | ||||
|         $function_bin{$_}{"reproc_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"echo_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"Δ"} . " " . | ||||
|         $function_bin{$_}{"reproc_PSD_σ"}; | ||||
|         $function_bin{$_}{"echo_PSD_σ"}; | ||||
| } | ||||
| close($datafile); | ||||
| 
 | ||||
| open($datafile,'>',"tmp.ccPSD") or die $!; | ||||
| open($datafile,'>',"tmp.crsspctrmPSD") or die $!; | ||||
| while( each %function_bin) { | ||||
|     say $datafile | ||||
|         $_ . " " . | ||||
|         $function_bin{$_}{"cc_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"crsspctrm_PSD_μ"} . " " . | ||||
|         $function_bin{$_}{"Δ"} . " " . | ||||
|         $function_bin{$_}{"cc_PSD_σ"}; | ||||
|         $function_bin{$_}{"crsspctrm_PSD_σ"}; | ||||
| } | ||||
| close($datafile); | ||||
| 
 | ||||
| @ -282,4 +282,4 @@ while( each %function_bin) { | ||||
| close($datafile); | ||||
| 
 | ||||
| 
 | ||||
| #open($datafile,'>',"tmp.reprocPSD") or die $!; | ||||
| #open($datafile,'>',"tmp.echoPSD") or die $!; | ||||
| @ -1,11 +1,10 @@ | ||||
| # This method assumes y values are in logarithm units already. | ||||
| 
 | ||||
| set title "%TITLE" | ||||
| set terminal png | ||||
| set output "tmp.png" | ||||
| set output "%OUTPUTFILE" | ||||
| 
 | ||||
| set title "Yo" | ||||
| set xlabel "Temporal Frequency [1/days]" | ||||
| set title "%TITLE\n{/*0.5 %SUBTITLE}" | ||||
| set xlabel "Temporal Frequency [days^{-1}]" | ||||
| set xrange [0.005:0.603] | ||||
| 
 | ||||
| # Use this if you want to show PSD directly on a log axis | ||||
| @ -20,4 +19,4 @@ set logscale x | ||||
| set ylabel "log_{10} PSD" | ||||
| set yrange [-5.5:0.5] | ||||
| plot '%FILE1' using 1:2:3:4 with xyerrorbars, \ | ||||
| '%FILE2' using 1:2:3:4 with xyerrorbars | ||||
| '%FILE2' using 1:2:3:4 with xyerrorbars | ||||
|  | ||||
| @ -1,5 +1,6 @@ | ||||
| set terminal png | ||||
| set termoption dash | ||||
| set output "%OUTPUTFILE" | ||||
| 
 | ||||
| 
 | ||||
| plot 'tables/timelag_lc1.dat' using 1:2:3:4 with xyerrorbars, \ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user