IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 8, 2003, 3:19:39 AM (23 years ago)
Author:
eugene
Message:

megacam updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/perl/src/imclean.cfht

    r17 r70  
    11#!/usr/bin/env perl
     2
     3$config = "";
     4@tARGV = ();
     5for (; @ARGV > 0; ) {
     6    if ($ARGV[0] eq "-C") {
     7        $config = "-C $ARGV[1]";
     8        shift; shift; next;
     9    }
     10    if ($ARGV[0] eq "-c") {
     11        $config = "-c $ARGV[1]";
     12        shift; shift; next;
     13    }
     14    if ($ARGV[0] eq "-D") {
     15        $config = "-D $ARGV[1] $ARGV[2]";
     16        shift; shift; shift; next;
     17    }
     18    @tARGV = (@tARGV, $ARGV[0]);
     19    shift;
     20}
     21@ARGV = @tARGV;
     22
     23if (@ARGV < 3) {
     24    print STDERR "ERROR: USAGE: USAGE: imclean.cfht (fits) (obj) (cmp) [option]\n";
     25    print STDERR "  corrects for errors with CD1_1, CRPIX1 on 12k for 51400 < MJD < 51540\n";
     26    print STDERR "  also determines and inserts the photcode for the image\n";
     27    exit 2;
     28}
     29
     30# input image must already be in SPLIT mode
     31
     32# determine the photcode of this image:
     33$photcode=`photcode $config -quiet $ARGV[0] 0 split`; chop $photcode;
     34if ($?) { die "ERROR: cannot find photcode\n"; }
     35
     36# check if we need to correct the WCS terms (only CFH12K)
     37($name, $id, $mjd) = split (" ", `echo $ARGV[0] | fields IMAGEID MJD-OBS`);
     38
     39$fix="";
     40if (($mjd > 51400) && ($mjd < 51540) && (($id == 2) || ($id == 6))) {
     41    $line = `echo $ARGV[0] | fields CD1_1 CRPIX1 NAXIS1`;
     42    ($name, $cd11, $crpix1, $nx) = split (" ", $line, 4);
     43    $crpix1 = $nx - $crpix1;
     44    $cd11 = -$cd11;
     45    $fix = "-key CD1_1 %f $cd11  -key CRPIX1 %f $crpix1";
     46}
     47
     48vsystem ("imclean $config @ARGV -p $photcode $fix");
     49
     50exit 0;
     51
     52############
    253
    354sub vsystem {
     
    1263}
    1364
    14 if (@ARGV < 3) {
    15     print STDERR "ERROR: USAGE: USAGE: imclean.cfht (fits) (obj) (cmp) [option]\n";
    16     print STDERR "  corrects for errors with CD1_1, CRPIX1 on 12k for 51400 < MJD < 51540\n";
    17     print STDERR "  also determines and inserts the photcode for the image\n";
    18     exit 2;
    19 }
    20 
    21 # input image must already be in SPLIT mode
    22 # determine the photcode of this image:
    23 $photcode=`photcode -quiet $ARGV[0] 0 split`;
    24 if ($?) {
    25     print STDERR "ERROR: cannot find photcode\n";
    26     exit 1;
    27 }
    28 chop ($photcode);
    29 
    30 # check if we need to correct the WCS terms
    31 $line = `echo $ARGV[0] | fields IMAGEID MJD-OBS`;
    32 chop ($line);
    33 ($name, $id, $mjd) = split (" ", $line);
    34 $fix="";
    35 
    36 print STDERR "mjd $mjd, $id $id\n";
    37 if (($mjd > 51400) && ($mjd < 51540) && (($id == 2) || ($id == 6))) {
    38     $line = `echo $ARGV[0] | fields CD1_1 CRPIX1 NAXIS1`;
    39     ($name, $cd11, $crpix1, $nx) = split (" ", $line, 4);
    40     $crpix1 = $nx - $crpix1;
    41     $cd11 = -$cd11;
    42     $fix = "-key CD1_1 %f $cd11  -key CRPIX1 %f $crpix1";
    43 }
    44 
    45 vsystem ("imclean @ARGV -p $photcode $fix");
    46 
    47 exit 0;
    48 
Note: See TracChangeset for help on using the changeset viewer.