Changeset 18055 for trunk/ippScripts/scripts/warp_overlap.pl
- Timestamp:
- Jun 10, 2008, 10:03:19 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_overlap.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_overlap.pl
r17897 r18055 27 27 my $ipprc = PS::IPP::Config->new(); # IPP configuration 28 28 29 my ($warp_id, $camera, $tess_ id, $dbname, $verbose, $no_update, $no_op, $save_temps);29 my ($warp_id, $camera, $tess_dir, $dbname, $verbose, $no_update, $no_op, $save_temps); 30 30 GetOptions( 31 31 'warp_id|i=s' => \$warp_id, # Warp identifier 32 32 'camera|c=s' => \$camera, # Camera name 33 'tess_ id=s' => \$tess_id, # Tessellation identifier33 'tess_dir=s' => \$tess_dir, # Tessellation directory 34 34 'dbname|d=s' => \$dbname, # Database name 35 35 'verbose' => \$verbose, # Print to stdout … … 41 41 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 42 42 pod2usage( 43 -msg => "Required options: --warp_id --camera --tess_ id",43 -msg => "Required options: --warp_id --camera --tess_dir", 44 44 -exitval => 3, 45 45 ) unless defined $warp_id 46 46 and defined $camera 47 and defined $tess_ id;47 and defined $tess_dir; 48 48 49 49 $ipprc->define_camera($camera); … … 79 79 } 80 80 81 # Where do we get the astrometry source from? 82 my $astromSource; # The astrometry source 81 # Where do we get the astrometry source from? 82 my $astromSource; # The astrometry source filerule (eg, PSASTRO.OUTPUT, PSASTRO.OUTPUT.MEF) 83 83 my $astromAccept; # Accept the astrometry unconditionally? 84 my $astromDepth; # File level of the astrometry source (SPLIT or MEF)?85 84 { 86 85 my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -"; … … 95 94 $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE'); 96 95 $astromAccept = metadataLookupBool($metadata, 'ASTROM.ACCEPT'); 97 $astromDepth = metadataLookupStr($metadata, 'ASTROM.DEPTH'); 98 } 99 100 96 } 101 97 102 98 # Determine the imfile/skycell overlaps … … 105 101 # Calculate the overlaps between imfiles and skycells 106 102 107 my $tess_dir = $ipprc->tessellation_catdir( $tess_id ); # Tessellation catdir for DVO 108 $tess_dir = $ipprc->convert_filename_absolute( $tess_dir ); 103 # tess_dir is the DVO db holding the tessalations 104 # this may be an abstract name in site.config:TESSELLATIONS, a URI, or an absolute path. 105 # convert this to an absolute path 106 my $tess_dir_abs = $ipprc->tessellation_catdir( $tess_dir ); # Tessellation catdir for DVO 107 $tess_dir_abs = $ipprc->convert_filename_absolute( $tess_dir_abs ); 109 108 110 109 my %unique_skycells = (); # Identified skycells (all unique by virtue of hash property) 111 110 112 # XXX this is a bit too hard wired: the concept is that astrometry comes from the MOSAIC vs CHIP output 113 # XXX we have moved the astrometry analysis to the camera stage only: we should always have the source be MEF 114 if ($astromSource eq 'PSASTRO.OUTPUT.MEF') { 115 # We have a MEF astrometry file from psastro 116 my $imfile = $imfiles->[0]; 117 my $camRoot = $imfile->{cam_path_base}; 118 my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file 119 120 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 121 if (! @matchlist) { 122 &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR); 123 } 124 # Match each of the imfiles to this list 125 foreach my $imfile (@$imfiles) { 126 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 127 } 128 } else { 129 # We have per-imfile astrometry 130 foreach my $imfile (@$imfiles) { 131 my $astromFile; 132 if ($astromSource eq 'PSASTRO.OUTPUT') { 133 my $chipRoot = $imfile->{chip_path_base}; 134 my $classID = $imfile->{class_id}; 135 $astromFile = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file 136 } else { 137 $astromFile = $imfile->{chip_uri}; # Astrometry file 138 } 139 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 140 if (! @matchlist and $verbose) { 141 print "skipping $astromFile\n"; 142 } 143 144 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 145 } 111 # astrometry is always determined at the camera stage; we have a MEF astrometry file from psastro 112 my $imfile = $imfiles->[0]; 113 my $camRoot = $imfile->{cam_path_base}; 114 my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file 115 116 my @matchlist = get_overlaps($astromFile, $tess_dir_abs, $astromAccept); # List of overlaps 117 if (! @matchlist) { 118 &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR); 119 } 120 # Match each of the imfiles to this list (the input images may be split, but the astrometry is not) 121 # tess_dir (not tess_dir_abs) is supplied here so it may be written to the db 122 foreach my $imfile (@$imfiles) { 123 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_dir, \@overlaps, \%unique_skycells); 146 124 } 147 125 } else { … … 150 128 my %overlap = (); 151 129 $overlap{skycell_id} = 'default'; 152 $overlap{tess_ id}= 'default';130 $overlap{tess_dir} = 'default'; 153 131 $overlap{cam_id} = $imfile->{cam_id}; 154 132 $overlap{class_id} = $imfile->{class_id}; … … 170 148 print $overlapFile " warp_id S32 $warp_id\n"; 171 149 print $overlapFile " skycell_id STR $overlap->{skycell_id}\n"; 172 print $overlapFile " tess_id STR $overlap->{tess_id}\n"; 150 # XXX convert tess_id here to tess_dir when db scheme is updated 151 print $overlapFile " tess_id STR $overlap->{tess_dir}\n"; 173 152 print $overlapFile " cam_id S32 $overlap->{cam_id}\n"; 174 153 print $overlapFile " class_id STR $overlap->{class_id}\n"; … … 215 194 { 216 195 my $filename = shift; # Filename on which to run dvoImageOverlaps 217 my $tess_dir = shift; # Tessellation directory196 my $tess_dir_abs = shift; # Tessellation directory 218 197 my $accept = shift; # Do we use the -accept-astrom flag? 219 198 220 my $command = "$dvoImageOverlaps -D CATDIR $tess_dir " . $ipprc->file_resolve($filename);199 my $command = "$dvoImageOverlaps -D CATDIR $tess_dir_abs " . $ipprc->file_resolve($filename); 221 200 $command .= ' -accept-astrom' if $accept; 222 201 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 248 227 my $imfile = shift; # Imfile information 249 228 my $filename = shift; # Filename used with dvoImageOverlaps 250 my $tess_ id= shift; # Tessellation identifier229 my $tess_dir = shift; # Tessellation identifier 251 230 my $overlaps = shift; # Reference to list of overlaps 252 231 my $unique_skycells = shift; # Reference to hash of found skycells … … 259 238 my $fileLevel = $imfile->{filelevel}; 260 239 my $entry; # How to identify this imfile in the dvoImageOverlaps output 261 if ( (lc($fileLevel) eq "chip") && (lc($astromDepth) eq "mef")) {240 if (lc($fileLevel) eq "chip") { 262 241 my $class_id = $imfile->{class_id}; 263 242 my $chipRoot = $ipprc->file_resolve( $imfile->{chip_path_base} ); 264 243 my $extname = $ipprc->extname_rule("CMF.HEAD", $class_id); # MEF psastro output 265 266 244 267 245 $entry = $filename . '\[' . $extname . '\]'; … … 278 256 my %overlap = (); # Overlap information for warptool 279 257 $overlap{skycell_id} = $skycell; 280 $overlap{tess_ id} = $tess_id;258 $overlap{tess_dir} = $tess_dir; 281 259 $overlap{cam_id} = $imfile->{cam_id}; 282 260 $overlap{class_id} = $imfile->{class_id};
Note:
See TracChangeset
for help on using the changeset viewer.
