#!/usr/bin/perl -w # Rotates the angles in the given Qsst (and implied Usst) files to galactic Q # and U. use DRAORed; use Getopt::Std; $use = q { Use: qussttoqugal qsstfile1 qsstfile2 ... qsstfilen Rotates the angles in the given Qsst (and implied Usst) files to galactic Q and U. }; unless(@ARGV > 0) { die $use; } foreach my $qsstf (@ARGV) { my $usstf = $qsstf; $usstf =~ s/MQ21/MU21/; my $qgalf = $qsstf; if($qgalf =~ /CORR/){ $qgalf =~ s/CORR/QGAL/; } else{ $qgalf += ".QGAL"; } my $ugalf = $qgalf; $ugalf =~ s/QGAL/UGAL/; $ugalf =~ s/MQ21/MU21/; my $qssti = fileindex($qsstf); my $ussti = fileindex($usstf); open(QUC, "|QU_convert > /dev/null 2> /dev/null") or die "Could not open \"|QU_convert > /dev/null 2> /dev/null\""; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "$qssti\n"; print QUC "$ussti\n"; print QUC "G\n"; print QUC "\n"; print QUC "$qgalf\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "$ugalf\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; print QUC "\n"; close(QUC) or die "Error closing \"|QU_convert > /dev/null 2> /dev/null\""; }