Changeset 13112
- Timestamp:
- May 1, 2007, 2:46:23 PM (19 years ago)
- Location:
- trunk/ippScripts
- Files:
-
- 1 added
- 5 edited
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
scripts/ipp_serial_warp.pl (added)
-
scripts/ipp_simulation_data.pl (modified) (3 diffs)
-
scripts/warp_overlap.pl (modified) (8 diffs)
-
scripts/warp_skycell.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/Build.PL
r12936 r13112 47 47 scripts/ipp_serial_chip.pl 48 48 scripts/ipp_serial_camera.pl 49 scripts/ipp_serial_warp.pl 49 50 scripts/ipp_simulation_data.pl 50 51 )], -
trunk/ippScripts/MANIFEST
r12936 r13112 30 30 scripts/ipp_serial_chip.pl 31 31 scripts/ipp_serial_camera.pl 32 scripts/ipp_serial_warp.pl 32 33 scripts/ipp_simulation_data.pl 33 34 t/00_distribution.t -
trunk/ippScripts/scripts/ipp_simulation_data.pl
r13020 r13112 121 121 ( $basename, $counter ) = filename( $name, $counter ); 122 122 my $filename = File::Spec->catfile( $workdir, $basename ) if defined $workdir; # File name 123 run( command => "$ppSim -camera $camera -type BIAS $filename",124 verbose => 1 ) or die "Unable to run ppSim";125 run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " .126 "--dbname $dbname $basename",127 verbose => 1 ) or die "Unable to inject file.";123 # run( command => "$ppSim -camera $camera -type BIAS $filename", 124 # verbose => 1 ) or die "Unable to run ppSim"; 125 # run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " . 126 # "--dbname $dbname $basename", 127 # verbose => 1 ) or die "Unable to inject file."; 128 128 } 129 129 … … 133 133 ( $basename, $counter ) = filename( $name, $counter ); 134 134 my $filename = File::Spec->catfile( $workdir, $basename ) if defined $workdir; # File name 135 run ( command => "$ppSim -camera $camera -type DARK -exptime $exptime $filename",136 verbose => 1 ) or die "Unable to run ppSim";137 run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " .138 "--dbname $dbname $basename",139 verbose => 1 ) or die "Unable to inject file.";135 # run ( command => "$ppSim -camera $camera -type DARK -exptime $exptime $filename", 136 # verbose => 1 ) or die "Unable to run ppSim"; 137 # run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " . 138 # "--dbname $dbname $basename", 139 # verbose => 1 ) or die "Unable to inject file."; 140 140 } 141 141 … … 147 147 ( $basename, $counter ) = filename( $name, $counter ); 148 148 my $filename = File::Spec->catfile( $workdir, $basename ) if defined $workdir; # File name 149 run( command => "$ppSim -camera $camera -type FLAT -filter $filter -exptime $exptime $filename",150 verbose => 1 ) or die "Unable to run ppSim";151 run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " .152 "--dbname $dbname $basename",153 verbose => 1 ) or die "Unable to inject file.";149 # run( command => "$ppSim -camera $camera -type FLAT -filter $filter -exptime $exptime $filename", 150 # verbose => 1 ) or die "Unable to run ppSim"; 151 # run( command => "$inject --camera $camera --telescope $telescope --workdir $workdir " . 152 # "--dbname $dbname $basename", 153 # verbose => 1 ) or die "Unable to inject file."; 154 154 } 155 155 } 156 157 156 158 157 # Generate object images -
trunk/ippScripts/scripts/warp_overlap.pl
r13085 r13112 91 91 } 92 92 93 # determine the imfile/skycell overlaps 93 # Set output directory 94 if (defined $workdir) { 95 $workdir = $ipprc->convert_filename_absolute( $workdir ); 96 } else { 97 my $example = $ipprc->convert_filename_absolute( $$imfiles[0]->{uri} ); 98 my ($vol, $dir, $file) = File::Spec->splitpath( $example ); 99 $workdir = $dir; 100 } 101 system "mkdir -p $workdir" unless -d $workdir; 102 103 104 # Determine the imfile/skycell overlaps 94 105 my @overlaps = (); 95 106 96 107 unless ($no_op) { 97 # #Calculate the overlaps between imfiles and skycells98 99 # the tess_id is the catdir used to define the tessalation108 # Calculate the overlaps between imfiles and skycells 109 110 # The tess_id is the catdir used to define the tessalation 100 111 my $command = "ppConfigDump -camera $camera -dump-recipe PSWARP -"; 101 112 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 107 118 my $parser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 108 119 my $recipe = $parser->parse( join '', @$stdout_buf); 109 my $tess_id = metadataLookupStr($recipe, 'DVO.TESSALATION'); 110 print STDERR "tessalation: $tess_id\n"; 111 112 # we have two options for the astrometry file: 113 # - saved by chiptool, in which case there may be a different one for each imfile 114 # - saved by camtool, in which case there may only be a single astrom file 115 my $psastroFile; 116 117 # XXX select this value from the recipe files (psastro? maybe not...?) 118 my $camAstrom = 1; 119 if ($camAstrom) { 120 my @tesselations = split(/\s+/, metadataLookupStr($recipe, 'DVO.TESSALATION')); # List of tesselations 121 foreach my $tess_id ( @tesselations ) { 122 print STDERR "tessalation: $tess_id\n"; 123 120 124 my $imfile = $imfiles->[0]; 121 125 my $camRoot = $ipprc->convert_filename_absolute( $imfile->{cam_path_base} ); 122 $psastroFile = $ipprc->filename("PSASTRO.OUTPUT", $camRoot); # MEF psastro output123 126 my $psastroFile = $ipprc->filename("PSASTRO.OUTPUT", $camRoot); # MEF psastro output 127 124 128 my @dirlist = File::Spec->splitdir( $psastroFile ); 125 129 my $psastroRootFile = pop @dirlist; 126 130 print STDERR "psastroRootFile: $psastroRootFile\n"; 127 131 128 132 # run the dvoImageOverlaps program to get the overlaps with this image 129 133 my $command = "dvoImageOverlaps -D CATDIR $tess_id $psastroFile"; … … 135 139 } 136 140 my @matchlist = split ('\n', (join "", @$stdout_buf)); 137 138 #my $Nmatch = @matchlist; 139 #print STDERR "Nmatch: $Nmatch\n"; 140 #foreach my $line (@matchlist) { 141 # print STDERR "line: $line\n"; 142 #} 143 144 # dvoImageOverlaps -D CATDIR tessalation (megacam) :: returns: 141 142 # The command "dvoImageOverlaps -D CATDIR tessalation (megacam)" returns: 145 143 # 729534pa.cmf[ccd00.hdr] : skycell.051.fits 146 144 # PSASTRO.OUTPUT[CMF.HEAD] : SKYCELL 147 145 # [CMF.HEAD] is optionally used for MEF files (SIMPLE or MOSAIC) 148 146 149 147 # now match the imfiles to this list 150 148 my @unique_skycells = (); … … 159 157 160 158 print STDERR "class: $class_id, chiproot: $chipRoot, extname: $extname\n"; 161 159 162 160 $entry = "$psastroRootFile\[$extname\]"; 163 161 } else { … … 173 171 $overlap{fault} = $imfile->{fault}; 174 172 push @overlaps, \%overlap; 175 173 176 174 printf STDERR "overlap: %s : %s\n", $skycell, $imfile->{cam_id}; 177 175 178 176 # generate a unique list of the skycells 179 177 unless ($found_skycells{$skycell}) { … … 184 182 } 185 183 186 # extract the skycells to names of the form $camRoot.skycell... 187 # with calls to dvoImageExtract 188 my $skycellDir = "$camRoot/skycells"; 189 system "mkdir -p $skycellDir" unless -d $skycellDir; 190 191 foreach my $skycell (@unique_skycells) { 192 vsystem ("dvoImageExtract -D CATDIR $tess_id $skycell -o $skycellDir/$skycell"); 193 } 194 195 } else { 196 foreach my $imfile (@$imfiles) { 197 my $class_id = $imfile->{class_id}; 198 my $chipRoot = $ipprc->convert_filename_absolute( $imfile->{chip_path_base} ); 199 my $psastroFile = $ipprc->filename("PSASTRO.OUTPUT", $chipRoot, $class_id); # SPLIT psastro output 200 201 # run the dvoImageOverlaps program to get the overlaps with this image 202 my $command = "dvoImageOverlaps -D CATDIR $tess_id $psastroFile"; 184 # Extract the skycells to images, used as warp templates. 185 foreach my $skycell_id (@unique_skycells) { 186 my $skyDir = File::Spec->catdir($workdir, "tess_" . $tess_id, "sky_" . $skycell_id ); 187 system "mkdir -p $skyDir" unless -d $skyDir; 188 my $skyFile = File::Spec->catfile( $skyDir , $skycell_id ); 189 my $command = "dvoImageExtract -D CATDIR $tess_id $skycell_id -o $skyFile"; 203 190 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 204 191 run(command => $command, verbose => 1); 205 192 unless ($success) { 206 193 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 207 &my_die("Unable to perform dvoImageOverlaps: $error_code", $warp_id, $error_code); 208 } 209 my @matchlist = split ('\n', $stdout_buf); 210 211 # dvoImageOverlaps -D CATDIR tessalation (megacam) :: returns: 212 # 729534pa.ccd00.cmf : skycell.051.fits 213 # 729534pa.ccd00.cmf : skycell.052.fits 214 # PSASTRO.OUTPUT : SKYCELL 215 216 # now match the imfiles to this list 217 my @skycells = &select_skycells ($psastroFile, @matchlist); 218 # XXX should I check and warn if int(@skycells) != int(@matchlist) ? 219 foreach my $skycell (@skycells) { 220 my %overlap = (); 221 $overlap{skycell_id} = $skycell; 222 $overlap{tess_id} = $tess_id; 223 $overlap{cam_id} = $imfile->{cam_id}; 224 $overlap{class_id} = $imfile->{class_id}; 225 $overlap{fault} = $imfile->{fault}; 226 push @overlaps, \%overlap; 227 228 print STDERR "overlap: $skycell -> $imfile->{cam_id}\n"; 194 &my_die("Unable to perform dvoImageExtract: $error_code", $warp_id, $error_code); 229 195 } 230 196 } … … 243 209 } 244 210 245 if (defined $workdir) {246 $workdir = $ipprc->convert_filename_absolute( $workdir );247 $workdir = File::Spec->catdir( $workdir, $exp_tag );248 } else {249 my $example = $ipprc->convert_filename_absolute( $$imfiles[0]->{uri} );250 my ($vol, $dir, $file) = File::Spec->splitpath( $example );251 $workdir = $dir;252 }253 system "mkdir -p $workdir" unless -d $workdir;254 255 211 # Generate a MDC file with the overlaps 256 my $overlapName = File::Spec->catfile( $workdir, 'overlap .mdc' );212 my $overlapName = File::Spec->catfile( $workdir, 'overlaps.wrp' . $warp_id . '.mdc' ); 257 213 open my $overlapFile, "> $overlapName" or die "Unable to open mdc file $overlapName"; 258 214 print $overlapFile "warpSkyCellMap MULTI\n\n"; … … 314 270 } 315 271 316 sub vsystem {317 print STDERR "@_\n";318 my $status = system ("@_");319 $status;320 }321 322 272 END { 323 273 my $status = $?; -
trunk/ippScripts/scripts/warp_skycell.pl
r12800 r13112 101 101 my $outputBin2 = $ipprc->filename("PSWARP.BIN2", $outputRoot, $skycell_id ); 102 102 my $outputStats = $outputRoot . '.stats'; 103 my $skyFile = File::Spec->catfile( $workdir, $skycell_id ); # Target sky cell file 103 104 my $listName = $outputRoot . '.list'; 104 105 … … 115 116 my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 116 117 unless ($no_op) { 117 my $command = "$pswarp -list $listName $outputRoot -stat $outputStats"; # Command to run pswarp118 my $command = "$pswarp -list $listName $outputRoot $skyFile -stat $outputStats"; # Command to run pswarp 118 119 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 119 120 run(command => $command, verbose => 1); … … 124 125 &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage; 125 126 &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 126 &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;127 &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;127 # &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 128 # &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 128 129 129 130 # Get the statistics on the warped image
Note:
See TracChangeset
for help on using the changeset viewer.
