#!/usr/bin/perl -w # Old versions of madr, especially when rgetting, mistakenly replaced [QU]gal # with Q or U. This is a hack to easily correct that, assuming that you know # what you're doing. # NOTE: This only relabels madr definitions. It does NOT really convert # coordinate systems for the file contents! use DRAORed; my $use = q { Use: qugalize file }; if($#ARGV == 0) { $filn = $ARGV[0]; } else { die $use; } @retvals = fileindex($filn); $filind = $retvals[0]; my %origdefn = readdef($filind); if ($origdefn{POLARIZATION} eq "Q" || $origdefn{POLARIZATION} eq "U") { open(MADR, "|madr > ${filind}.qugalize.log"); print MADR "def f$filind\n"; print MADR "\n"; # File name print MADR "\n"; # Data type (IRD) [R]: print MADR "\n"; # Dimensions: print MADR "\n"; # Subset [NONE]: print MADR "N\n"; # Are "undefined" data allowed? [N]: # print MADR "-9999.0\n"; print MADR "\n"; # Data-unit type [1]: print MADR "\n"; # Scaling factor [10.000 E-4]: print MADR "y\n"; # Are the parameters that print MADR "y\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]: if ($origdefn{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 "\n"; # Central heliocentric frequency (MHz) print MADR "$origdefn{POLARIZATION}gal\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"; # Do you want a comment? [N]: print MADR "exit\n"; close(MADR) or die "qugalize: error setting $filn ($filind) to $origdefn{POLARIZATION}gal"; } else { print "Left $filn ($filind) as $origdefn{POLARIZATION}.\n"; }