IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 12, 2009, 1:02:53 PM (17 years ago)
Author:
Paul Price
Message:

Diffs are now produced containing a WCS, so we don't have to get a
skycell template. Adding option so that it gets the correct file
(forward vs inverse).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_magic/ippScripts/scripts/magic_tree.pl

    r23688 r24147  
    7373my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    7474
    75 ### Get a list of warpSkyfiles
    76 ### This is a workaround to allow processing with older diffSkyfiles that don't have
    77 ### a wcs. If warp_id is provided, we get the wcs from there
    78 my %warpSkyfiles;                   # hash of warps
    79 if ($warp_id) {
    80     my $command = "$warptool -warped -warp_id $warp_id"; # Command to run
    81     $command .= " -dbname $dbname" if defined $dbname;
    82     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    83         run(command => $command, verbose => $verbose);
    84     unless ($success) {
    85         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    86         &my_die("Unable to perform warptool -warped: $error_code", $magic_id, $error_code);
    87     }
    88 
    89     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    90         &my_die("Unable to parse metadata config doc", $magic_id, $PS_EXIT_PROG_ERROR);
    91 
    92     my $warps = parse_md_list($metadata) or
    93         &my_die("Unable to parse metadata list", $magic_id, $PS_EXIT_PROG_ERROR);
    94 
    95     # make a hash indexed by skycell_id
    96     foreach my $warp ( @$warps ) {
    97         my $skycell_id = $warp->{skycell_id};
    98         die "failed to lookup skycell_id from warp" if !$skycell_id;
    99         $warpSkyfiles{$skycell_id} = $warp;
    100     }
    101 }
    10275### Get a list of skycells
    10376my @skycells;                   # List of skycells
     
    12699my @fields;
    127100foreach my $input ( @skycells ) {
    128     # the filename method doesn't add the $skycell_id
    129 
    130     # my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id );
    131     #my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id );
    132 
    133 #    my $skycellBase = "$outroot/$skycell_id";
    134 #    my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $skycellBase);
    135 #    $ipprc->skycell_file($tess_id, $skycell_id, $skyfile, $verbose) or &my_die("Unable to generate skycells $skycell_id", $magic_id, $PS_EXIT_PROG_ERROR);
    136 
    137     my $skyfile;
    138     my $skycell_id = $input->{node};
    139     if ($warp_id) {
    140         # Applying the workaround
    141         my $warp = $warpSkyfiles{$skycell_id};
    142         die "warpSkyfile for $skycell_id not found" if !$warp;
    143         my $skyfileBase = $warp->{path_base};
    144         $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $skyfileBase);
    145     } else {
    146         # using the diffSkyfile
    147         $skyfile = $input->{uri};
    148     }
    149     my $skyfileResolved = $ipprc->file_resolve( $skyfile );
    150 
    151 #    my ($header, $status) = Astro::FITS::CFITSIO::fits_read_header( $skyfileResolved );
    152 #    &my_die("Unable to read skycell header: $status", $magic_id, $PS_EXIT_SYS_ERROR) if $status;
     101    # We use the WCS in the diff image
     102    my $name = $input->{inverse} ? "PPSUB.INVERSE" : "PPSUB.OUTPUT"; # Name of file
     103    my $skycell_id = $input->{node}; # Name of skycell
     104    my $skyfile = $ipprc->filename($name, $input->{path_base}, $skycell_id); # Filename for diff
     105    my $skyfileResolved = $ipprc->file_resolve( $skyfile ); # Resolved filename
    153106
    154107    my ($header, $status) = (undef, 0);
     
    162115
    163116    # Get the useful header keywords
    164 #    my $naxis1 = $$header{'NAXIS1'} or &my_die("Can't find NAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);
    165117    my $naxis1 = $$header{'NAXIS1'};
    166118    my $naxis2;
Note: See TracChangeset for help on using the changeset viewer.