#! /bin/bash #Apply a band-pass filter to a real datacube. if test $# -ne 4 then echo 'Usage: '$0' Input_Datacube(FITS) Freq1 Freq2 Filtered_Datacube_Name' if test $# -eq 0 then exit 0 else exit 1 fi fi INPUT=$1 FREQ1=$2 FREQ2=$3 OUTNAME=$4 #Transpose the input datacube so that the x-axis is time: rm -f BPF_TMP01.fits switch_y_z $INPUT BPF_TMP01.fits rm -f BPF_TMP02.fits switch_x_y BPF_TMP01.fits BPF_TMP02.fits #Apply the Fourier transform in the x-direction: rm -f BPF_TMP03.fits rfourier_x BPF_TMP02.fits BPF_TMP03.fits #Reverse the foregoing transpose on the Fourier transform. rm -f BPF_TMP04.fits switch_x_y BPF_TMP03.fits BPF_TMP04.fits rm -f TFT.fits switch_y_z BPF_TMP04.fits TFT.fits #Write the band-pass profile: NZ=`print_head TFT.fits | grep NAXIS3 | awk '{print $3;}'` DZ=`print_head TFT.fits | grep DAXIS3 | awk '{print $3;}'` echo 'NZ = '$NZ echo 'DZ = '$DZ rm -f ZPROFILE.txt echo $FREQ1 $FREQ2 $DZ $NZ | awk '{ ind1 = int($1/$3 + 0.5); ind2 = int($2/$3 + 0.5); for (i = 0; i < $4; i++) if (i < ind1 || i > ind2) print 0.0; else print 1.0; }' > ZPROFILE.txt #Apply the band-pass profile to the temporal Fourier transform: zmult_datacube TFT.fits ZPROFILE.txt rm -f BPF_TMP05.fits switch_y_z TFT.fits BPF_TMP05.fits rm -f BPF_TMP06.fits switch_x_y BPF_TMP05.fits BPF_TMP06.fits rm -f BPF_TMP07.fits rfourier_x BPF_TMP06.fits BPF_TMP07.fits -i rm -f BPF_TMP08.fits switch_x_y BPF_TMP07.fits BPF_TMP08.fits rm -f $OUTNAME switch_y_z BPF_TMP08.fits $OUTNAME #Cleanup rm -f BPF_TMP0[1-8].fits ZPROFILE.txt #rm -f TFT.fits