#!/usr/bin/perl -w # Bulent did not allow the beam to be copied to the definition of many (all?) # of his final images. This looks for the beam's axis lengths and orientation # in another madr definition (hopefully one with the same beam as the target # image, but that is not checked for and the definition need not even # correspond to an existing file. use DRAORed; my $use = q { Use: copybeam defind targetfn Give targetfn the same beam as defind. }; if($#ARGV == 1) { $defind = $ARGV[0]; $targetfn = $ARGV[1]; } else { die $use; } my ($majax, $minax, $bpa) = getbeam($defind); my $outind = -1; # This seems unlikely enough. $outind = fileindex($targetfn); if($outind < 1){ die "${outind}: Index for $targetfn not found."; } open(MADR, "|madr > /dev/null"); 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]: print MADR "y\n"; # Are "undefined" data allowed? [N]: print MADR "-9999.0\n"; # Value to indicate "undefined" data [0.000]: 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] print MADR "\n"; # Sky projection (SEGTVACF) [S]: print MADR "\n"; # Epoch for projection (1950 or 2000) [2000]: print MADR "\n"; # Select velocity-like coordinate print MADR "\n"; # RA of reference element print MADR "\n"; # DEC of reference record print MADR "\n"; # Reference ELEMENT for RA [513.000]: print MADR "\n"; # Reference RECORD for DEC [513.000]: print MADR "\n"; # DELTA "RA" per element [0' 20.000"]: print MADR "\n"; # DELTA "DEC" per record [0' 20.000"]: print MADR "n\n"; # Define file (3rd dimension) coordinate? [N]: print MADR "y\n"; # Define resolution (beam and velocity) print MADR "$majax\'\n"; # Major width [1' 12.84"]: print MADR "$minax\'\n"; # Minor width [1' 12.84"]: print MADR "${bpa}d\n"; # Orientation angle [-91.541D]: print MADR "\n"; # Frequency (MHz) resolution [0.000]: print MADR "y\n"; # Define auxiliary astronomical parameters?[Y]: print MADR "\n"; # Central heliocentric frequency (MHz) print MADR "\n"; # Stokes parameter [Usst] ("/?" = help): print MADR "\n"; # Data-set bandwidth (MHz) [7.500]: print MADR "\n"; # Observation epoch (e.g. 1984.6) print MADR "y\n"; # Are the entered astrophysical parameters print MADR "n\n"; # Do you want a comment? [N]: print MADR "exit\n"; close(MADR) or die "copybeam: error copying the beam in $defind to $targetfn ($outind).";