Changeset 24147 for branches/pap_magic/ippScripts/scripts/magic_tree.pl
- Timestamp:
- May 12, 2009, 1:02:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_magic/ippScripts/scripts/magic_tree.pl
r23688 r24147 73 73 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 74 74 75 ### Get a list of warpSkyfiles76 ### This is a workaround to allow processing with older diffSkyfiles that don't have77 ### a wcs. If warp_id is provided, we get the wcs from there78 my %warpSkyfiles; # hash of warps79 if ($warp_id) {80 my $command = "$warptool -warped -warp_id $warp_id"; # Command to run81 $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) or90 &my_die("Unable to parse metadata config doc", $magic_id, $PS_EXIT_PROG_ERROR);91 92 my $warps = parse_md_list($metadata) or93 &my_die("Unable to parse metadata list", $magic_id, $PS_EXIT_PROG_ERROR);94 95 # make a hash indexed by skycell_id96 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 }102 75 ### Get a list of skycells 103 76 my @skycells; # List of skycells … … 126 99 my @fields; 127 100 foreach 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 153 106 154 107 my ($header, $status) = (undef, 0); … … 162 115 163 116 # Get the useful header keywords 164 # my $naxis1 = $$header{'NAXIS1'} or &my_die("Can't find NAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);165 117 my $naxis1 = $$header{'NAXIS1'}; 166 118 my $naxis2;
Note:
See TracChangeset
for help on using the changeset viewer.
