IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.