{{{ #!/usr/bin/env perl use strict; use warnings; # program that uses STILTS to add colums to a PSPS query from ForcedMeanObjectView # usage: enhance.pl input [output] # If output is blank the results go to stdout in text format. my $verbose; my $in = shift; my $out = shift; die "need input file!\n" unless $in; my $ofmt = 'fits'; if (!$out) { $ofmt = 'text'; $out = '-'; } # Set this to the location of the stilts jar file on your system # This is where I put it on my Mac. my $HOME = $ENV{HOME}; my $stilts = "java -jar ${HOME}/tools/stilts.jar"; # If you want a subset of columns output build the list here and uncomment the keepcols command # below #my $keeplist = "\"objID gFPSFMag\""; # Get rid of these distracting columns at the beginning of the list my $dellist = '"objName uniquePspsOBid"'; # build the stilts command. We have to be careful about quoting here. # In particular that all of the arguments to the cmd= argument are within a single ' ' sequence # This way it gets passed to the shell as one word # cmd='the list of filter commands that have spaces in them' my $command = "$stilts tpipe in=$in out=$out ofmt=$ofmt" . " cmd='" . "delcols $dellist;" # . "addcol -after objID extended qualityFlag&1;" . "addcol -before ippObjID gFPSFMag 8.9-2.5*log10(gFPSFFlux);" . "addcol -before ippObjID gFKronMag 8.9-2.5*log10(gFKronFlux);" . "addcol -before ippObjID rFPSFMag 8.9-2.5*log10(rFPSFFlux);" . "addcol -before ippObjID rFKronMag 8.9-2.5*log10(rFKronFlux);" . "addcol -before ippObjID iFPSFMag 8.9-2.5*log10(iFPSFFlux);" . "addcol -before ippObjID iFKronMag 8.9-2.5*log10(iFKronFlux);" . "addcol -before ippObjID zFPSFMag 8.9-2.5*log10(zFPSFFlux);" . "addcol -before ippObjID zFKronMag 8.9-2.5*log10(zFKronFlux);" . "addcol -before ippObjID yFPSFMag 8.9-2.5*log10(yFPSFFlux);" . "addcol -before ippObjID yFKronMag 8.9-2.5*log10(yFKronFlux);" # . "keepcols $keeplist;" . "'" ; print "$command\n" if $verbose; my $rc = system "$command"; if ($rc) { my $status = $rc >> 8; die "failed $status $rc\n"; } }}}