Changeset 31439 for branches/eam_branches/ipp-20110404/ippScripts
- Timestamp:
- May 5, 2011, 10:05:10 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110404/ippScripts
- Files:
-
- 9 edited
- 1 copied
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
scripts/addstar_run.pl (modified) (5 diffs)
-
scripts/diff_skycell.pl (modified) (3 diffs)
-
scripts/ipp_apply_burntool_single.pl (modified) (1 prop)
-
scripts/lap_science.pl (copied) (copied from trunk/ippScripts/scripts/lap_science.pl )
-
scripts/magic_destreak.pl (modified) (1 diff)
-
scripts/nightly_science.pl (modified) (1 diff)
-
scripts/stack_skycell.pl (modified) (5 diffs)
-
scripts/staticsky.pl (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110404/ippScripts/Build.PL
r30373 r31439 117 117 scripts/skycell_jpeg.pl 118 118 scripts/diffphot.pl 119 scripts/lap_science.pl 119 120 )], 120 121 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
branches/eam_branches/ipp-20110404/ippScripts/MANIFEST
r30049 r31439 45 45 scripts/ipp_cluster_load_monitor.pl 46 46 scripts/skycell_jpeg.pl 47 scripts/lap_science.pl 47 48 t/00_distribution.t -
branches/eam_branches/ipp-20110404/ippScripts/scripts/addstar_run.pl
r30326 r31439 37 37 } 38 38 my $minidvodb_path; 39 my ( $ exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update,39 my ( $add_id, $camera, $stage, $outroot, $stageroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update, 40 40 $no_op, $redirect, $save_temps); 41 41 GetOptions( 42 'exp_tag=s' => \$exp_tag, # Exposure identifier43 42 'add_id=s' => \$add_id, # Camtool identifier 44 43 'camera|c=s' => \$camera, # Camera 44 'stage|s=s' => \$stage, # Camera 45 45 46 'dbname|d=s' => \$dbname, # Database name 46 47 'outroot|w=s' => \$outroot, # output file base name 47 ' camroot|w=s' => \$camroot, # camerastage root name.48 'stageroot|w=s' => \$stageroot, # stage root name. 48 49 'reduction=s' => \$reduction, # Reduction class 49 50 'dvodb|w=s' => \$dvodb, # output DVO database … … 61 62 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 62 63 pod2usage( 63 -msg => "Required options: -- exp_tag --add_id --camera --outroot --dvodb --camroot",64 -msg => "Required options: --add_id --camera --outroot --dvodb --stageroot --stage", 64 65 -exitval => 3, 65 66 ) unless 66 defined $ exp_tagand67 defined $stage and 67 68 defined $add_id and 68 69 defined $outroot and 69 defined $ camroot and70 defined $stageroot and 70 71 defined $dvodb and 71 72 defined $camera; … … 86 87 # Recipes to use based on reduction class 87 88 $reduction = 'DEFAULT' unless defined $reduction; 88 89 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); 89 90 # XXX This is now not used: do we still need it? 90 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 91 if ($stage =~/cam/) { 92 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 93 } 94 if ($stage =~/stack/) { 95 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STACK'); # Recipe to use 96 } 97 #if ($stage =~/staticsky/) { 98 # $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STATICSKY'); # Recipe to use 99 #} 91 100 &my_die("Unrecognised ADDSTAR recipe", $add_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar; 92 101 … … 97 106 98 107 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs 99 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $camroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 108 109 # it was PSASTRO.OUTPUT 110 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $stageroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 111 112 if (($stage =~/staticsky/) || ($stage =~/stack/)) { 113 $fpaObjects =~ s/smf$/cmf/; 114 115 } 100 116 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 101 117 … … 173 189 $command .= " $realFile"; 174 190 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 175 $command .= " -image" if $image_only; 176 191 $command .= " -image" if $image_only; 192 if ($stage = ~/staticsky/) { 193 $command .= " -accept-astrom "; 194 } 177 195 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 178 196 -
branches/eam_branches/ipp-20110404/ippScripts/scripts/diff_skycell.pl
r30843 r31439 31 31 my $ppSub = can_run('ppSub') or (warn "Can't find ppSub" and $missing_tools = 1); 32 32 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 33 my $nebInsert = can_run('neb-insert') or (warn "Can't find neb-insert" and $missing_tools = 1); 33 34 if ($missing_tools) { 34 35 warn("Can't find required tools."); … … 265 266 my $do_photom = 1; 266 267 my $dump_config = 1; 268 if ($reduction eq 'NOCONVDIFF') { 269 $do_photom = 0; 270 } 267 271 if ($run_state eq 'new') { 268 272 $configuration = prepare_output("PPSUB.CONFIG", $outroot, 1); … … 380 384 } 381 385 } 386 if ($reduction eq 'NOCONVDIFF') { 387 my $refConv = prepare_output("PPSUB.REF.CONV", $outroot, 0); 388 my $templateFile = $ipprc->file_resolve($template,0); 389 $command = "$nebInsert $refConv $templateFile"; 390 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 391 run(command => $command, verbose => $verbose); 392 unless ($success) { 393 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 394 &my_die("Unable to perform neb-insert: $error_code", $diff_id, $skycell_id, $error_code); 395 } 396 } 397 398 382 399 } elsif ($run_state eq 'update') { 383 400 &my_die("Update resulted in poor quality image: $quality", $diff_id, $skycell_id, $PS_EXIT_SYS_ERROR); -
branches/eam_branches/ipp-20110404/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed
/trunk/ippScripts/scripts/ipp_apply_burntool_single.pl merged: 31377
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110404/ippScripts/scripts/magic_destreak.pl
r30694 r31439 360 360 $command .= " -chip_mask $ch_mask" if defined $ch_mask; 361 361 $command .= " -weight $weight" if defined $weight; 362 $command .= " -sources $sources" if defined $sources; 362 if ((defined($sources))&&($ipprc->file_exists($sources))) { 363 $command .= " -sources $sources" if defined $sources; 364 } 365 else { 366 print "Did not add sources because they do not appear to exist. This may be an error.\n"; 367 } 363 368 $command .= " -skycelllist $skycell_list" if defined $skycell_list; 364 369 $command .= " -replace" if $replace; -
branches/eam_branches/ipp-20110404/ippScripts/scripts/nightly_science.pl
r30688 r31439 996 996 $cmd .= " -min_num 4"; 997 997 $cmd .= " -select_good_frac_min 0.05"; 998 $cmd .= " -set_reduction NIGHTLY_STACK "; 998 999 $cmd .= " $select "; 999 1000 if ($debug == 1) { -
branches/eam_branches/ipp-20110404/ippScripts/scripts/stack_skycell.pl
r30842 r31439 73 73 PPSTACK.OUTPUT.EXPNUM 74 74 PPSTACK.OUTPUT.EXPWT 75 PPSTACK.TARGET.PSF76 75 PPSTACK.OUTPUT.JPEG1 77 76 PPSTACK.OUTPUT.JPEG2 … … 84 83 # extra outputs when convolving 85 84 my @outputListUnconv = qw( 85 PPSTACK.TARGET.PSF 86 86 PPSTACK.UNCONV 87 87 PPSTACK.UNCONV.MASK … … 181 181 my $recipe_psphot = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot 182 182 my $recipe_ppstats = 'STACKSTATS'; 183 if ($run_state eq 'update') { 184 $recipe_ppstats = 'WARPSTATS'; 183 if ($ 184 run_state eq 'update') { 185 $recipe_ppstats = 'WARPSTATS'; 185 186 } 186 187 unless ($recipe_ppStack and $recipe_ppSub and $recipe_psphot) { … … 208 209 &my_die("Unable to not compress and logflux compress simultaneously. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR); 209 210 } 211 my $stack_type = metadataLookupStr($recipe, 'STACK.TYPE'); 212 &my_die("STACK.TYPE not found in recipe. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR) unless $stack_type; 210 213 211 214 # Generate MDC file with the inputs … … 281 284 $command .= " -recipe PSPHOT $recipe_psphot"; 282 285 $command .= " -recipe PPSTATS $recipe_ppstats" if $do_stats;; 286 $command .= " -stack-type $stack_type"; 283 287 $command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE"; 284 288 $command .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF"; -
branches/eam_branches/ipp-20110404/ippScripts/scripts/staticsky.pl
r31164 r31439 32 32 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); 33 33 my $psphotStack = can_run('psphotStack') or (warn "Can't find psphotStack" and $missing_tools = 1); 34 my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1); 34 35 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 36 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 35 37 if ($missing_tools) { 36 38 warn("Can't find required tools."); … … 96 98 } 97 99 100 # Recipes to use based on reduction class 101 $reduction = 'DEFAULT' unless defined $reduction; 102 103 98 104 # generate the input 99 105 print $listFile "INPUT MULTI\n"; 100 106 my $nInputs = @$files; 101 107 102 my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot); 103 104 foreach my $file (@$files) { 105 print $listFile "INPUT METADATA\n"; 106 107 # XXX if we take the input from 'warp', we will need to make different selections here 108 my $path_base = $file->{path_base}; 109 print "input: $path_base\n"; 110 111 my $imageCnv = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 112 my $maskCnv = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 113 my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 114 115 my $imageRaw = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name 116 my $maskRaw = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 117 my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 118 119 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 120 121 # XXX is this the correct PSF file? 122 my $psfCnv = $ipprc->filename("PPSTACK.TARGET.PSF", $path_base ); # PSF name 123 124 # XXX we could make some different choices if some inputs do not exist... 125 &my_die("Couldn't find input: $imageRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw"); 126 &my_die("Couldn't find input: $maskRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw"); 127 &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw"); 128 &my_die("Couldn't find input: $imageCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv"); 129 &my_die("Couldn't find input: $maskCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv"); 130 &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv"); 131 &my_die("Couldn't find input: $psfCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv"); 132 &my_die("Couldn't find input: $sources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources"); 133 134 print $listFile " RAW:IMAGE STR " . $imageRaw . "\n"; 135 print $listFile " RAW:MASK STR " . $maskRaw . "\n"; 136 print $listFile " RAW:VARIANCE STR " . $weightRaw . "\n"; 137 138 print $listFile " CNV:IMAGE STR " . $imageCnv . "\n"; 139 print $listFile " CNV:MASK STR " . $maskCnv . "\n"; 140 print $listFile " CNV:VARIANCE STR " . $weightCnv . "\n"; 141 print $listFile " CNV:PSF STR " . $psfCnv . "\n"; 142 143 print $listFile " SOURCES STR " . $sources . "\n"; 144 145 print $listFile "END\n\n"; 146 } 147 148 # Recipes to use based on reduction class 149 $reduction = 'DEFAULT' unless defined $reduction; 150 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot 151 my $recipe_ppsub = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub 152 my $recipe_ppstack = $ipprc->reduction($reduction, 'STACKPHOT_PPSTACK'); # Recipe to use for ppstack 153 unless ($recipe_psphot) { 154 &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $sky_id, $PS_EXIT_CONFIG_ERROR); 155 } 156 157 print "reduction: $reduction\n"; 158 print "recipe_psphot: $recipe_psphot\n"; 159 print "recipe_ppsub: $recipe_ppsub\n"; 160 print "recipe_ppstack: $recipe_ppstack\n"; 161 162 # my $cmdflags; 163 164 # Perform stack photometry analysis 165 { 166 my $command = "$psphotStack $outroot"; 167 $command .= " -input $listName"; 168 $command .= " -threads $threads" if defined $threads; 169 $command .= " -recipe PSPHOT $recipe_psphot"; 170 $command .= " -recipe PPSUB $recipe_ppsub"; 171 $command .= " -recipe PPSTACK $recipe_ppstack"; 172 $command .= " -dumpconfig $configuration"; 173 $command .= " -tracedest $traceDest -log $logDest"; 174 # $command .= " -dbname $dbname" if defined $dbname; 175 # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; 176 # $command .= " -source_id $source_id" if defined $source_id; 177 178 unless ($no_op) { 179 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 180 unless ($success) { 181 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 182 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 183 } 184 185 # my $outputStatsReal = $ipprc->file_resolve($outputStats); 186 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 187 188 # measure chip stats 189 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 190 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 # run(command => $command, verbose => $verbose); 192 # unless ($success) { 193 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 194 # &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code); 195 # } 196 # foreach my $line (@$stdout_buf) { 197 # $cmdflags .= " $line"; 198 # } 199 # chomp $cmdflags; 200 201 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 202 203 my $quality = 0; 204 if (!$quality) { 205 206 # Get the output filenames 207 # we have one set of output files per input file set 208 for (my $i = 0; $i < @$files; $i++) { 209 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 210 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 211 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 212 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 213 214 # XXX these are optional and not generated by default 215 # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 216 # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 217 # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance); 218 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 219 } 220 221 #my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 222 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 223 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 224 225 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); 226 my $chisqMask = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot); 227 my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot); 228 229 # XXX check the recipe -- should we expect these to exist? 230 # &my_die("Couldn't find expected output file: $chisqName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName); 231 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 232 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 233 } 234 } else { 235 print "Not executing: $command\n"; 236 } 108 if ($nInputs > 1) { 109 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot 110 my $recipe_ppsub = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub 111 my $recipe_ppstack = $ipprc->reduction($reduction, 'STACKPHOT_PPSTACK'); # Recipe to use for ppstack 112 unless ($recipe_psphot) { 113 &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $sky_id, $PS_EXIT_CONFIG_ERROR); 114 } 115 116 print "reduction: $reduction\n"; 117 print "recipe_psphot: $recipe_psphot\n"; 118 print "recipe_ppsub: $recipe_ppsub\n"; 119 print "recipe_ppstack: $recipe_ppstack\n"; 120 my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot); 121 122 foreach my $file (@$files) { 123 print $listFile "INPUT METADATA\n"; 124 125 # XXX if we take the input from 'warp', we will need to make different selections here 126 my $path_base = $file->{path_base}; 127 print "input: $path_base\n"; 128 129 my $imageCnv = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 130 my $maskCnv = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 131 my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 132 133 my $imageRaw = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name 134 my $maskRaw = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 135 my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 136 137 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 138 139 # XXX is this the correct PSF file? 140 my $psfCnv = $ipprc->filename("PPSTACK.TARGET.PSF", $path_base ); # PSF name 141 142 # XXX we could make some different choices if some inputs do not exist... 143 &my_die("Couldn't find input: $imageRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw"); 144 &my_die("Couldn't find input: $maskRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw"); 145 &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw"); 146 &my_die("Couldn't find input: $imageCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv"); 147 &my_die("Couldn't find input: $maskCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv"); 148 &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv"); 149 &my_die("Couldn't find input: $psfCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv"); 150 &my_die("Couldn't find input: $sources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources"); 151 152 print $listFile " RAW:IMAGE STR " . $imageRaw . "\n"; 153 print $listFile " RAW:MASK STR " . $maskRaw . "\n"; 154 print $listFile " RAW:VARIANCE STR " . $weightRaw . "\n"; 155 156 print $listFile " CNV:IMAGE STR " . $imageCnv . "\n"; 157 print $listFile " CNV:MASK STR " . $maskCnv . "\n"; 158 print $listFile " CNV:VARIANCE STR " . $weightCnv . "\n"; 159 print $listFile " CNV:PSF STR " . $psfCnv . "\n"; 160 161 print $listFile " SOURCES STR " . $sources . "\n"; 162 163 print $listFile "END\n\n"; 164 } 165 166 # my $cmdflags; 167 168 # Perform stack photometry analysis 169 { 170 my $command = "$psphotStack $outroot"; 171 $command .= " -input $listName"; 172 $command .= " -threads $threads" if defined $threads; 173 $command .= " -recipe PSPHOT $recipe_psphot"; 174 $command .= " -recipe PPSUB $recipe_ppsub"; 175 $command .= " -recipe PPSTACK $recipe_ppstack"; 176 $command .= " -dumpconfig $configuration"; 177 $command .= " -tracedest $traceDest -log $logDest"; 178 # $command .= " -dbname $dbname" if defined $dbname; 179 180 unless ($no_op) { 181 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 182 unless ($success) { 183 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 184 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 185 } 186 187 # my $outputStatsReal = $ipprc->file_resolve($outputStats); 188 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 189 190 # measure chip stats 191 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 192 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 193 # run(command => $command, verbose => $verbose); 194 # unless ($success) { 195 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 196 # &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code); 197 # } 198 # foreach my $line (@$stdout_buf) { 199 # $cmdflags .= " $line"; 200 # } 201 # chomp $cmdflags; 202 203 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 204 205 my $quality = 0; 206 if (!$quality) { 207 208 # Get the output filenames 209 # we have one set of output files per input file set 210 for (my $i = 0; $i < @$files; $i++) { 211 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 212 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 213 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 214 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 215 216 # XXX these are optional and not generated by default 217 # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 218 # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 219 # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance); 220 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 221 } 222 223 #my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 224 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 225 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 226 227 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); 228 my $chisqMask = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot); 229 my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot); 230 231 # XXX check the recipe -- should we expect these to exist? 232 # &my_die("Couldn't find expected output file: $chisqName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName); 233 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 234 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 235 } 236 } else { 237 print "Not executing: $command\n"; 238 } 239 } 240 } else { 241 # single input. Run psphot 242 # find the recipe 243 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_SINGLE_PSPHOT'); # Recipe to use for psphot 244 unless ($recipe_psphot) { 245 &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $sky_id, $PS_EXIT_CONFIG_ERROR); 246 } 247 248 print "reduction: $reduction\n"; 249 print "recipe_psphot: $recipe_psphot\n"; 250 251 my $configuration = $ipprc->filename("PSPHOT.SKY.CONFIG", $outroot); 252 253 my $file = $files->[0]; 254 255 # XXX if we take the input from 'warp', we will need to make different selections here 256 my $path_base = $file->{path_base}; 257 print "input: $path_base\n"; 258 259 # examine the recipe to determine whether to analyze the "raw" or convolved images 260 my $command = "$ppConfigDump -camera $camera -dump-recipe PSPHOT -recipe PSPHOT $recipe_psphot -"; 261 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 262 run(command => $command, verbose => 0); 263 unless ($success) { 264 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 265 &my_die("Unable to perform ppConfigDump: $error_code", $sky_id, $PS_EXIT_SYS_ERROR); 266 } 267 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 268 &my_die("Unable to parse metadata config doc", $sky_id, $PS_EXIT_SYS_ERROR); 269 270 my $use_raw = metadataLookupBool($recipeData, 'PSPHOT.STACK.USE.RAW'); 271 272 my ($image, $mask, $variance); 273 if ($use_raw) { 274 $image = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name 275 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 276 $variance = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 277 } else { 278 $image = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 279 $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 280 $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 281 } 282 283 my $output_sources_filerule = "PSPHOT.OUT.CMF.MEF"; 284 my $output_psf_filerule = "PSPHOT.PSF.SKY.SAVE"; 285 286 # XXX we could make some different choices if some inputs do not exist... 287 &my_die("Couldn't find input: $image", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$image"); 288 &my_die("Couldn't find input: $mask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask"); 289 &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance"); 290 291 # Perform stack photometry analysis 292 { 293 my $command = "$psphot $outroot"; 294 $command .= " -file $image"; 295 $command .= " -mask $mask"; 296 $command .= " -variance $variance"; 297 $command .= " -threads $threads" if defined $threads; 298 $command .= " -recipe PSPHOT $recipe_psphot"; 299 $command .= " -dumpconfig $configuration" if $configuration; 300 $command .= " -tracedest $traceDest -log $logDest"; 301 $command .= " -F PSPHOT.OUTPUT $output_sources_filerule"; 302 $command .= " -F PSPHOT.PSF.SAVE $output_psf_filerule"; 303 304 unless ($no_op) { 305 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 306 unless ($success) { 307 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 308 &my_die("Unable to perform psphot: $error_code", $sky_id, $error_code); 309 } 310 311 my $quality = 0; 312 if (!$quality) { 313 my $outputSources = $ipprc->filename($output_sources_filerule, $outroot); 314 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 315 my $outputPSF = $ipprc->filename($output_psf_filerule, $outroot); 316 &my_die("Couldn't find expected output file: $outputPSF", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputPSF); 317 } 318 319 &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR) 320 unless $ipprc->file_exists($configuration); 321 } else { 322 print "Not executing: $command\n"; 323 } 324 } 237 325 } 238 326
Note:
See TracChangeset
for help on using the changeset viewer.
