#!/usr/bin/perl -w # When adding fields to an existing mosaic, supertile requires the new fields # to have the exact same frequency as the existing mosaic. This is a hack to # "fix" them within a Hubble time. use DRAORed; my $use = q { Use: matchfreq file1 file2 Give file2 the same frequency as file1. }; if($#ARGV == 1) { $inna = $ARGV[0]; $outna = $ARGV[1]; } else { die $use; } my $freq = freq_out($inna); #print "Out freq.: $freq\n"; my $outind = -1; # This seems unlikely enough. $outind = fileindex($outna); #print "outind: $outind\n"; if($outind < 1){ die "${outind}: Index for $outna not found."; } my %outdefn = readdef($outind); #open(MADR, "|madr > /dev/null"); open(MADR, "|madr > ${outind}.matchfreq.log"); print MADR "def f$outind\n"; print MADR "\n"; # File name print MADR "\n"; # Data type (IRD) [R]: print MADR "\n"; # Dimensions: print MADR "\n"; # Subset [NONE]: if($outdefn{NODATA}){ print MADR "Y\n"; # Are "undefined" data allowed? [N]: print MADR "$outdefn{NODATA}\n"; } else{ print MADR "N\n"; # Are "undefined" data allowed? [N]: } print MADR "\n"; # Data-unit type [1]: print MADR "\n"; # Scaling factor [10.000 E-4]: print MADR "\n"; # Are the parameters that print MADR "\n"; # Define coordinates print MADR "\n"; # Type of file (RD,RV,VD,UV,XY) [RD] if($outdefn{FILETYPE} eq "UV"){ print MADR "\n"; # UV type [4] } else{ print MADR "$outdefn{SKYPROJ}\n"; # Sky projection (SEGTVACF) [S]: if($outdefn{SKYPROJ} eq "S"){ print MADR "$outdefn{CEPOCH}\n"; # Epoch for projection (1950 or 2000): } } print MADR "f\n"; # Select velocity-like coordinate print MADR "\n"; # RA of reference element print MADR "\n"; # DEC of reference record if($outdefn{FILETYPE} eq "UV"){ print MADR "\n"; # Epoch for phase-center coordinates print MADR "$freq\n"; # Frequency (MHz) for UV data print MADR "\n"; # HA of reference element [-6H 0M 0.00S]: } print MADR "\n"; # Reference ELEMENT for RA [513.000]: if($outdefn{FILETYPE} ne "UV"){ print MADR "\n"; # Reference RECORD for DEC [513.000]: } print MADR "\n"; # DELTA "RA" per element [0' 20.000"]: if($outdefn{FILETYPE} ne "UV"){ print MADR "\n"; # DELTA "DEC" per record [0' 20.000"]: } print MADR "N\n"; # Define file (3rd dimension) coordinate? [N]: if ($outdefn{BPA}) { print MADR "Y\n"; # Define resolution (beam and velocity) print MADR "\n"; # Major width [1' 12.84"]: print MADR "\n"; # Minor width [1' 12.84"]: print MADR "\n"; # Orientation angle [-91.541D]: print MADR "\n"; # Frequency (MHz) resolution [0.000]: } else { print MADR "N\n"; } print MADR "Y\n"; # Define auxiliary astronomical parameters?[Y]: print MADR "$freq\n"; # Central heliocentric frequency (MHz) print MADR "$outdefn{POLARIZATION}\n"; # Stokes parameter print MADR "\n"; # Data-set bandwidth (MHz) [7.500]: print MADR "\n"; # Observation epoch (e.g. 1984.6) print MADR "\n"; # Are the entered astrophysical parameters print MADR "n\n"; # Do you want a comment? [N]: print MADR "exit\n"; close(MADR) or die "matchfreq: error setting $outna ($outind) freq to ${freq}.";