IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 25519


Ignore:
Timestamp:
Sep 23, 2009, 3:58:48 PM (17 years ago)
Author:
Paul Price
Message:

Don't require the PSF model inputs if we're not convolving.

Location:
trunk
Files:
2 edited

Legend:

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

    r25299 r25519  
    112112print "I've loaded my inputs: $stack_id\n";
    113113
     114# Recipes to use based on reduction class
     115$reduction = 'DEFAULT' unless defined $reduction;
     116my $recipe_ppStack = $ipprc->reduction($reduction, 'STACK_PPSTACK'); # Recipe to use for ppStack
     117my $recipe_ppSub = $ipprc->reduction($reduction, 'STACK_PPSUB'); # Recipe to use for ppSub
     118my $recipe_psphot  = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot
     119unless ($recipe_ppStack and $recipe_ppSub and $recipe_psphot) {
     120    &my_die("Couldn't find selected reduction for STACK_PPSTACK, STACK_PPSUB and STACK_PSPHOT: $reduction\n", $stack_id, $PS_EXIT_CONFIG_ERROR);
     121}
     122
    114123# Parse the list of input files to get the tesselation, skycell identifiers and camera
    115124my $skycell_id;                 # Skycell identifier
     
    141150$ipprc->define_camera($camera);
    142151
    143 # Recipes to use based on reduction class
    144 $reduction = 'DEFAULT' unless defined $reduction;
    145 my $recipe_ppStack = $ipprc->reduction($reduction, 'STACK_PPSTACK'); # Recipe to use for ppStack
    146 my $recipe_ppSub = $ipprc->reduction($reduction, 'STACK_PPSUB'); # Recipe to use for ppSub
    147 my $recipe_psphot  = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot
    148 unless ($recipe_ppStack and $recipe_ppSub and $recipe_psphot) {
    149     &my_die("Couldn't find selected reduction for STACK_PPSTACK, STACK_PPSUB and STACK_PSPHOT: $reduction\n", $stack_id, $PS_EXIT_CONFIG_ERROR);
    150 }
     152my $recipe;
     153{
     154    my $command = "$ppConfigDump -camera $camera -recipe PPSTACK $recipe_ppStack -dump-recipe PPSTACK -";
     155    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     156        run(command => $command, verbose => $verbose);
     157    unless ($success) {
     158        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     159        &my_die("Unable to perform ppConfigDump: $error_code", $stack_id, $error_code);
     160    }
     161    my $recipe = $mdcParser->parse(join "", @$stdout_buf) or
     162        &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
     163}
     164my $convolve = metadataLookupBool($recipe, 'CONVOLVE'); # Convolve inputs?
     165
    151166
    152167print "I've configured everything: $stack_id\n";
     
    166181    my $mask = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name
    167182    my $weight = $ipprc->filename( "PSWARP.OUTPUT.VARIANCE", $file->{path_base} ); # Weight name
    168     my $psf = $ipprc->filename( "PSPHOT.PSF.SKY.SAVE", $file->{path_base} ); # PSF name
     183    my $psf = $convolve ? $ipprc->filename( "PSPHOT.PSF.SKY.SAVE", $file->{path_base} ) : undef; # PSF name
    169184    my $sources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base}); # Sources name
    170185
     
    172187    &my_die("Mask $mask does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $mask );
    173188    &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $weight );
    174     &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $psf );
     189    &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) if ($convolve and not $ipprc->file_exists( $psf ));
    175190    &my_die("Sources $sources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $sources );
    176191
     
    178193    print $listFile "\tMASK\tSTR\t" . $mask . "\n";
    179194    print $listFile "\tVARIANCE\tSTR\t" . $weight . "\n";
    180     print $listFile "\tPSF\tSTR\t" . $psf . "\n";
     195    print $listFile "\tPSF\tSTR\t" . $psf . "\n" if $convolve;
    181196    print $listFile "\tSOURCES\tSTR\t" . $sources . "\n";
    182 
    183     ### XXX NEED TO UPDATE THESE appropriately
    184     print $listFile "\tWEIGHTING\tF32\t" . 1.0 . "\n";
    185197
    186198    print $listFile "END\n\n";
     
    274286#       &my_die("Couldn't find expected output file: $bin2Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
    275287    }
    276    
     288
    277289    print "I've stacked $listName: $stack_id\n";
    278290}
     
    352364
    353365    print "Ensuring temporary images are deleted.\n";
    354     my $command = "$ppConfigDump -camera $camera -recipe PPSTACK $recipe_ppStack -dump-recipe PPSTACK -";
    355     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    356         run(command => $command, verbose => $verbose);
    357     unless ($success) {
    358         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    359         &my_die("Unable to perform ppConfigDump: $error_code", $stack_id, $error_code);
    360     }
    361     my $md = $mdcParser->parse(join "", @$stdout_buf) or
    362         &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
    363 
    364     my $temp_delete = metadataLookupBool($md, 'TEMP.DELETE'); # Delete temporary files?
     366
     367    my $temp_delete = defined($recipe) and metadataLookupBool($recipe, 'TEMP.DELETE'); # Delete temp files?
    365368    if ($temp_delete) {
    366         my $temp_dir = metadataLookupStr($md, 'TEMP.DIR'); # Directory with temporary files
    367         my $temp_image = metadataLookupStr($md, 'TEMP.IMAGE'); # Suffix for image
    368         my $temp_mask = metadataLookupStr($md, 'TEMP.MASK'); # Suffix for mask
    369         my $temp_weight = metadataLookupStr($md, 'TEMP.VARIANCE'); # Suffix for weight
     369        my $temp_dir = metadataLookupStr($recipe, 'TEMP.DIR'); # Directory with temporary files
     370        my $temp_image = metadataLookupStr($recipe, 'TEMP.IMAGE'); # Suffix for image
     371        my $temp_mask = metadataLookupStr($recipe, 'TEMP.MASK'); # Suffix for mask
     372        my $temp_weight = metadataLookupStr($recipe, 'TEMP.VARIANCE'); # Suffix for weight
    370373        my $temp_root = basename($outroot); # Root name for temporary files
    371374
  • trunk/ppStack/src/ppStackCamera.c

    r23576 r25519  
    8585        psFree(runVars);
    8686
    87         psArray *runPSF = pmFPAfileDefineMultipleFromRun(&status, runImages, config,
    88                                                          "PPSTACK.INPUT.PSF"); // Input PSFs
    89         if (!status) {
    90             psError(PS_ERR_UNKNOWN, false, "Unable to define input PSFs from RUN metadata.");
    91             psFree(runImages);
    92             return false;
    93         }
    94         if (runPSF) {
    95             havePSFs = true;
    96         }
    97         psFree(runPSF);
    98 
    9987        psArray *runSrc = pmFPAfileDefineMultipleFromRun(&status, runImages, config,
    10088                                                         "PPSTACK.INPUT.SOURCES"); // Input sources
     
    112100
    113101        if (convolve) {
    114             psArray *runKernel = pmFPAfileDefineMultipleFromRun(&status, runImages, config,
    115                                                                 "PPSTACK.CONV.KERNEL"); // Convolution kernels
    116             if (!status) {
    117                 psError(PS_ERR_UNKNOWN, false, "Unable to define convolution kernels from RUN metadata.");
    118                 psFree(runImages);
    119                 return false;
    120             }
    121             if (!runKernel) {
    122                 psError(PS_ERR_UNEXPECTED_NULL, true,
    123                         "Unable to define convolution kernels from RUN metadata.");
    124                 psFree(runImages);
    125                 return false;
    126             }
    127             psFree(runKernel);
     102            {
     103                psArray *runPSF = pmFPAfileDefineMultipleFromRun(&status, runImages, config,
     104                                                         "PPSTACK.INPUT.PSF"); // Input PSFs
     105                if (!status) {
     106                    psError(PS_ERR_UNKNOWN, false, "Unable to define input PSFs from RUN metadata.");
     107                    psFree(runImages);
     108                    return false;
     109                }
     110                if (runPSF) {
     111                    havePSFs = true;
     112                }
     113                psFree(runPSF);
     114            }
     115            {
     116
     117                psArray *runKernel = pmFPAfileDefineMultipleFromRun(&status, runImages, config,
     118                                                                    "PPSTACK.CONV.KERNEL"); // Conv'n kernels
     119                if (!status) {
     120                    psError(PS_ERR_UNKNOWN, false, "Unable to define convolution kernels from RUN metadata.");
     121                    psFree(runImages);
     122                    return false;
     123                }
     124                if (!runKernel) {
     125                    psError(PS_ERR_UNEXPECTED_NULL, true,
     126                            "Unable to define convolution kernels from RUN metadata.");
     127                    psFree(runImages);
     128                    return false;
     129                }
     130                psFree(runKernel);
     131            }
    128132        }
    129133
Note: See TracChangeset for help on using the changeset viewer.