IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changes between Initial Version and Version 1 of forcedFluxToMagsExaample


Ignore:
Timestamp:
Aug 14, 2015, 1:28:47 PM (11 years ago)
Author:
bills
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • forcedFluxToMagsExaample

    v1 v1  
     1
     2{{{
     3#!/usr/bin/env perl
     4
     5use strict;
     6use warnings;
     7
     8# program that uses STILTS to add colums to a PSPS query from ForcedMeanObjectView
     9
     10# usage: enhance.pl input [output]
     11# If output is blank the results go to stdout in text format.
     12
     13my $verbose;
     14
     15my $in = shift;
     16my $out = shift;
     17
     18die "need input file!\n" unless $in;
     19
     20my $ofmt = 'fits';
     21if (!$out) {
     22    $ofmt = 'text';
     23    $out = '-';
     24}
     25
     26
     27# Set this to the location of the stilts jar file on your system
     28# This is where I put it on my Mac.
     29my $HOME = $ENV{HOME};
     30my $stilts = "java -jar ${HOME}/tools/stilts.jar";
     31
     32   
     33# If you want a subset of columns output build the list here and uncomment the keepcols command
     34# below
     35#my $keeplist = "\"objID gFPSFMag\"";
     36
     37# Get rid of these distracting columns at the beginning of the list
     38my $dellist   = '"objName uniquePspsOBid"';
     39
     40# build the stilts command. We have to be careful about quoting here.
     41# In particular that all of the arguments to the cmd=  argument are within a single ' ' sequence
     42# This way it gets passed to the shell as one word
     43#    cmd='the list of filter commands that  have spaces in them'
     44
     45my $command = "$stilts tpipe in=$in out=$out ofmt=$ofmt"
     46    . " cmd='"
     47    . "delcols $dellist;"
     48#    . "addcol -after objID extended qualityFlag&1;"
     49    . "addcol -before ippObjID gFPSFMag  8.9-2.5*log10(gFPSFFlux);"
     50    . "addcol -before ippObjID gFKronMag 8.9-2.5*log10(gFKronFlux);"
     51    . "addcol -before ippObjID rFPSFMag  8.9-2.5*log10(rFPSFFlux);"
     52    . "addcol -before ippObjID rFKronMag 8.9-2.5*log10(rFKronFlux);"
     53    . "addcol -before ippObjID iFPSFMag  8.9-2.5*log10(iFPSFFlux);"
     54    . "addcol -before ippObjID iFKronMag 8.9-2.5*log10(iFKronFlux);"
     55    . "addcol -before ippObjID zFPSFMag  8.9-2.5*log10(zFPSFFlux);"
     56    . "addcol -before ippObjID zFKronMag 8.9-2.5*log10(zFKronFlux);"
     57    . "addcol -before ippObjID yFPSFMag  8.9-2.5*log10(yFPSFFlux);"
     58    . "addcol -before ippObjID yFKronMag 8.9-2.5*log10(yFKronFlux);"
     59#    . "keepcols $keeplist;"
     60    . "'"
     61    ;
     62
     63print "$command\n" if $verbose;
     64
     65my $rc = system "$command";
     66if ($rc) {
     67    my $status = $rc >> 8;
     68    die "failed $status $rc\n";
     69}
     70
     71}}}