IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 11, 2011, 3:36:56 PM (15 years ago)
Author:
bills
Message:

For single input, use new recipe STACKPHOT_SINGLE_PSPHOT instead of STACKPHOT_PSHOT.
Tweak the filerules so that MEF rules are used for sources and psf output files.
Check for existence of output files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/staticsky.pl

    r31247 r31271  
    100100# Recipes to use based on reduction class
    101101$reduction = 'DEFAULT' unless defined $reduction;
    102 my $recipe_psphot  = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot
    103 my $recipe_ppsub   = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub
    104 my $recipe_ppstack = $ipprc->reduction($reduction, 'STACKPHOT_PPSTACK'); # Recipe to use for ppstack
    105 unless ($recipe_psphot) {
    106     &my_die("Couldn't find selected reduction for STACKPHOT: $reduction\n", $sky_id, $PS_EXIT_CONFIG_ERROR);
    107 }
    108 
    109 print "reduction:      $reduction\n";
    110 print "recipe_psphot:  $recipe_psphot\n";
    111 print "recipe_ppsub:   $recipe_ppsub\n";
    112 print "recipe_ppstack: $recipe_ppstack\n";
    113102
    114103
     
    118107
    119108if ($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";
    120120        my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
    121121
     
    177177            $command .= " -tracedest $traceDest -log $logDest";
    178178            # $command .= " -dbname $dbname" if defined $dbname;
    179             # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id;
    180             # $command .= " -source_id $source_id" if defined $source_id;
    181179
    182180            unless ($no_op) {
     
    242240} else {
    243241        # single input. Run psphot
    244         my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);
     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);
    245252
    246253        my $file = $files->[0];
     
    274281        }
    275282
    276         my $sources   = $ipprc->filename("PSPHOT.OUT.CMF.MEF",      $path_base ); # Sources name
    277 
    278         # XXX is this the correct PSF file?
    279         my $psfCnv    = $ipprc->filename("PPSTACK.TARGET.PSF",      $path_base ); # PSF name
     283        my $output_sources_filerule = "PSPHOT.OUT.CMF.MEF";
     284        my $output_psf_filerule = "PSPHOT.PSF.SKY.SAVE";
    280285
    281286        # XXX we could make some different choices if some inputs do not exist...
     
    283288        &my_die("Couldn't find input: $mask",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask");
    284289        &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance");
    285         &my_die("Couldn't find input: $psfCnv",    $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");
    286         &my_die("Couldn't find input: $sources",   $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");
    287 
    288         # my $cmdflags;
    289290
    290291        # Perform stack photometry analysis
     
    298299            $command .= " -dumpconfig $configuration" if $configuration;
    299300            $command .= " -tracedest $traceDest -log $logDest";
     301            $command .= " -F PSPHOT.OUTPUT $output_sources_filerule";
     302            $command .= " -F PSPHOT.PSF.SAVE $output_psf_filerule";
    300303
    301304            unless ($no_op) {
     
    303306                unless ($success) {
    304307                    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    305                     &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code);
     308                    &my_die("Unable to perform psphot: $error_code", $sky_id, $error_code);
    306309                }
    307310
    308                 # my $outputStatsReal = $ipprc->file_resolve($outputStats);
    309                 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal);
    310 
    311                 # measure chip stats
    312                 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL";
    313                 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    314                 #     run(command => $command, verbose => $verbose);
    315                 # unless ($success) {
    316                 #     $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    317                 #     &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code);
    318                 # }
    319                 # foreach my $line (@$stdout_buf) {
    320                 #     $cmdflags .= " $line";
    321                 # }
    322                 # chomp $cmdflags;
    323 
    324                 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag
    325 
    326311                my $quality = 0;
    327                 if (0 and !$quality) {
    328 
    329                     # Get the output filenames
    330                     # we have one set of output files per input file set
    331                     for (my $i = 0; $i < @$files; $i++) {
    332                         my $outputName     = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i);
    333                         my $outputMask     = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i);
    334                         my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i);
    335                         my $outputSources  = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i);
    336 
    337                         # XXX these are optional and not generated by default
    338                         # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
    339                         # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    340                         # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance);
    341                         &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
    342                     }
    343 
    344                     #my $configuration  = $ipprc->filename("PPSUB.CONFIG", $outroot);
    345                     #my $outputStats    = $ipprc->filename("SKYCELL.STATS", $outroot);
    346                     #my $traceDest      = $ipprc->filename("TRACE.EXP", $outroot);
    347 
    348                     my $chisqName     = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot);
    349                     my $chisqMask     = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot);
    350                     my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot);
    351 
    352                     # XXX check the recipe -- should we expect these to exist?
    353                     # &my_die("Couldn't find expected output file: $chisqName",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName);
    354                     # &my_die("Couldn't find expected output file: $chisqMask",           $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask);
    355                     # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance);
     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);
    356317                }
     318
     319                &my_die("Couldn't find expected output file: $configuration", $sky_id, $PS_EXIT_SYS_ERROR)
     320                    unless $ipprc->file_exists($configuration);
    357321            } else {
    358322                print "Not executing: $command\n";
Note: See TracChangeset for help on using the changeset viewer.