| 
									
										
										
										
											2016-07-12 20:24:21 +00:00
										 |  |  | #!/usr/local/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  | mkdir -p analyses/tables | 
					
						
							|  |  |  | mkdir -p analyses/plots | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-12 20:24:21 +00:00
										 |  |  | for analysis in analyses/* | 
					
						
							|  |  |  | do | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  |     # 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 | 
					
						
							| 
									
										
										
										
											2016-07-13 03:31:47 +00:00
										 |  |  |     timelag_tabfile=analyses/tables/${echo_band}_≻_${ref_band}_delay.tab | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  |     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. | 
					
						
							| 
									
										
										
										
											2016-07-13 03:31:47 +00:00
										 |  |  |     scripts/create_tables.pl $analysis | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  |     mv tmp.echoPSD $echoPSD_tabfile | 
					
						
							|  |  |  |     mv tmp.refPSD $refPSD_tabfile | 
					
						
							| 
									
										
										
										
											2016-07-13 03:31:47 +00:00
										 |  |  |     mv tmp.timelag $timelag_tabfile | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # 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 | 
					
						
							| 
									
										
										
										
											2016-07-12 20:24:21 +00:00
										 |  |  | done | 
					
						
							| 
									
										
										
										
											2016-07-12 20:37:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-07-13 03:28:11 +00:00
										 |  |  | 
 |