Changeset 16320 for trunk/ippScripts/scripts/warp_overlap.pl
- Timestamp:
- Feb 5, 2008, 3:56:08 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/warp_overlap.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/warp_overlap.pl
r16310 r16320 38 38 my $ipprc = PS::IPP::Config->new(); # IPP configuration 39 39 40 my ($warp_id, $camera, $ dbname, $workdir, $verbose, $no_update, $no_op);40 my ($warp_id, $camera, $tess_id, $dbname, $workdir, $verbose, $no_update, $no_op); 41 41 GetOptions( 42 42 'warp_id|i=s' => \$warp_id, # Warp identifier 43 43 'camera|c=s' => \$camera, # Camera name 44 'tess_id=s' => \$tess_id, # Tessellation identifier 44 45 'dbname|d=s' => \$dbname, # Database name 45 46 'workdir|w=s' => \$workdir, # Working directory, for output files … … 51 52 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 52 53 pod2usage( 53 -msg => "Required options: --warp_id --camera -- workdir",54 -msg => "Required options: --warp_id --camera --tess_id --workdir", 54 55 -exitval => 3, 55 56 ) unless defined $warp_id 56 57 and defined $camera 58 and defined $tess_id 57 59 and defined $workdir; 58 60 … … 113 115 unless ($no_op) { 114 116 # Calculate the overlaps between imfiles and skycells 115 116 my $tessellations = $ipprc->tessellations(); # Hash of defined tessellations 117 foreach my $tess_id ( keys %$tessellations ) { 118 ### Because DVO doesn't use psModules, it doesn't understand Nebulous --- check 119 my $scheme = file_scheme($$tessellations{$tess_id}); # The scheme, e.g., file, path, neb 120 if (defined $scheme and lc($scheme) eq 'neb') { 121 &my_die("Tessellation $tess_id refers to a Nebulous path: $$tessellations{$tess_id}", $warp_id, $PS_EXIT_CONFIG_ERROR); 117 118 my $tess_dir = $ipprc->tessellation_catdir( $tess_id ); # Tessellation catdir for DVO 119 $tess_dir = $ipprc->convert_filename_absolute( $tess_dir ); 120 121 122 my %unique_skycells = (); # Identified skycells (all unique by virtue of hash property) 123 124 # XXX this is a bit too hard wired: the concept is that astrometry comes from the MOSAIC vs CHIP output 125 if ($astromSource eq 'PSASTRO.OUTPUT.MEF') { 126 # We have a MEF astrometry file from psastro 127 my $imfile = $imfiles->[0]; 128 my $camRoot = $imfile->{cam_path_base}; 129 my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file 130 131 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 132 if (! @matchlist) { 133 &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR); 134 } 135 # Match each of the imfiles to this list 136 foreach my $imfile (@$imfiles) { 137 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 122 138 } 123 124 my $tess_dir = $ipprc->convert_filename_absolute( $$tessellations{$tess_id} ); # Catdir for DVO 125 126 my %unique_skycells = (); # Identified skycells (all unique by virtue of hash property) 127 128 # XXX this is a bit too hard wired: the concept is that astrometry comes from the MOSAIC vs CHIP output 129 if ($astromSource eq 'PSASTRO.OUTPUT.MEF') { 130 # We have a MEF astrometry file from psastro 131 my $imfile = $imfiles->[0]; 132 my $camRoot = $imfile->{cam_path_base}; 133 my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file 139 } else { 140 # We have per-imfile astrometry 141 foreach my $imfile (@$imfiles) { 142 my $astromFile; 143 if ($astromSource eq 'PSASTRO.OUTPUT') { 144 my $chipRoot = $imfile->{chip_path_base}; 145 my $classID = $imfile->{class_id}; 146 $astromFile = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file 147 } else { 148 $astromFile = $imfile->{chip_uri}; # Astrometry file 149 } 150 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 151 if (! @matchlist and $verbose) { 152 print "skipping $astromFile\n"; 153 } 134 154 135 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 136 if (! @matchlist) { 137 &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR); 138 } 139 # Match each of the imfiles to this list 140 foreach my $imfile (@$imfiles) { 141 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 142 } 143 } else { 144 # We have per-imfile astrometry 145 foreach my $imfile (@$imfiles) { 146 my $astromFile; 147 if ($astromSource eq 'PSASTRO.OUTPUT') { 148 my $chipRoot = $imfile->{chip_path_base}; 149 my $classID = $imfile->{class_id}; 150 $astromFile = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file 151 } else { 152 $astromFile = $imfile->{chip_uri}; # Astrometry file 153 } 154 my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps 155 if (! @matchlist and $verbose) { 156 print "skipping $astromFile\n"; 157 } 158 159 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 160 } 155 extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells); 161 156 } 162 163 # Extract the skycells to images, used as warp templates. 164 my @skycells = keys %unique_skycells; 165 generate_skycells($ipprc, $tess_id, \@skycells, $workdir) or 166 &my_die("Unable to generate skycells for tessellation $tess_id", $warp_id, $PS_EXIT_SYS_ERROR); 167 } 157 } 158 159 # Extract the skycells to images, used as warp templates. 160 my @skycells = keys %unique_skycells; 161 generate_skycells($ipprc, $tess_id, \@skycells, $workdir) or 162 &my_die("Unable to generate skycells for tessellation $tess_id", $warp_id, $PS_EXIT_SYS_ERROR); 163 168 164 } else { 169 165 # create an overlap with an entry for each skycell:imfile match
Note:
See TracChangeset
for help on using the changeset viewer.
