IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42099


Ignore:
Timestamp:
Feb 28, 2022, 4:35:35 PM (4 years ago)
Author:
eugene
Message:

move JPEGS to list of files produced with or without convolution; add recipe option to select a DEEP exposure output format; do not fail on invalid warp inputs if SKIP.MISSING.INPUTS is true

Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r37833 r42099  
    6666    and defined $run_state;
    6767
    68 # lists of file rules which we expect to produce output output
     68# lists of file rules which we expect to produce output when convolving
    6969my @outputList = qw(
    7070PPSTACK.OUTPUT
     
    7474PPSTACK.OUTPUT.EXPNUM       
    7575PPSTACK.OUTPUT.EXPWT
    76 PPSTACK.OUTPUT.JPEG1       
    77 PPSTACK.OUTPUT.JPEG2       
    78 PPSTACK.CONFIG             
     76PPSTACK.TARGET.PSF         
    7977);
     78
    8079# produced if we run photometry
    8180my @outputListPhotom = qw(
    8281PSPHOT.OUT.CMF.MEF
    8382);
    84 # extra outputs when convolving
     83
     84# list of file rules produced if convolution is false
    8585my @outputListUnconv = qw(
    86 PPSTACK.TARGET.PSF         
    8786PPSTACK.UNCONV
    8887PPSTACK.UNCONV.MASK
     
    9190PPSTACK.UNCONV.EXPNUM       
    9291PPSTACK.UNCONV.EXPWT
     92PPSTACK.OUTPUT.JPEG1       
     93PPSTACK.OUTPUT.JPEG2       
     94PPSTACK.CONFIG             
    9395);
    9496
     
    207209my $output_nocomp = metadataLookupBool($recipe, 'OUTPUT.NOCOMP'); # change filerules to produced uncompressed output images
    208210my $output_logflux = metadataLookupBool($recipe, 'OUTPUT.LOGFLUX'); # change filerules to produce logflux compressed output images.
     211my $output_deepexp = metadataLookupBool($recipe, 'OUTPUT.DEEPEXP'); # change filerules to produce exptime map with more depth
    209212my $replicate_outputs = (defined($neb) and metadataLookupBool($recipe, 'OUTPUT.REPLICATE')); # replicate output images
     213my $skip_missing_inputs = metadataLookupBool($recipe, 'SKIP.MISSING.INPUTS'); # ignore missing inputs
    210214if ($output_nocomp and $output_logflux) {
    211215    &my_die("Unable to not compress and logflux compress simultaneously. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR);
     216}
     217if ($output_nocomp and $output_deepexp) {
     218    &my_die("Unable to not compress and use deepexp simultaneously. Check config.",$stack_id, $PS_EXIT_CONFIG_ERROR);
    212219}
    213220my $stack_type = metadataLookupStr($recipe, 'STACK.TYPE');
     
    222229    if ($file->{ignored}) { next; }
    223230
     231    # check for the input files
     232    my $image    = $ipprc->filename("PSWARP.OUTPUT", $file->{path_base} ); # Image name
     233    my $mask     = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name
     234    my $weight   = $ipprc->filename( "PSWARP.OUTPUT.VARIANCE", $file->{path_base} ); # Weight name
     235    my $psf      = $convolve ? $ipprc->filename( "PSPHOT.PSF.SKY.SAVE", $file->{path_base} ) : undef; # PSF name
     236    my $sources  = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base}); # Sources name
     237    my $bkgmodel = $ipprc->filename("PSWARP.OUTPUT.BKGMODEL", $file->{path_base});
     238
     239    my $have_image   = $ipprc->file_exists( $image );
     240    my $have_mask    = $ipprc->file_exists( $mask );
     241    my $have_weight  = $ipprc->file_exists( $weight );
     242    my $have_sources = $ipprc->file_exists( $sources );
     243    my $have_psf;
     244    if ($convolve) { $have_psf = $ipprc->file_exists( $psf ); }
     245
     246    if ($skip_missing_inputs) {
     247        my $missing_inputs = 0;
     248        unless ($have_image)  { print "WARNING: MISSING INPUT $image  \n"; $missing_inputs = 1; }
     249        unless ($have_mask)   { print "WARNING: MISSING INPUT $mask   \n"; $missing_inputs = 1; }
     250        unless ($have_weight) { print "WARNING: MISSING INPUT $weight \n"; $missing_inputs = 1; }
     251        unless ($have_sources){ print "WARNING: MISSING INPUT $sources\n"; $missing_inputs = 1; }
     252        if ($convolve) { unless ($have_psf) { print "WARNING: MISSING INPUT $psf\n"; $missing_inputs = 1;}}
     253        if ($missing_inputs) { next; }
     254    } else {
     255        &my_die("Image $image does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_image;
     256        &my_die("Mask $mask does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_mask;
     257        &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_weight;
     258        &my_die("Sources $sources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $have_sources;
     259        &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) if ($convolve and not $have_psf);
     260    }
     261
    224262    print $listFile "INPUT$num\tMETADATA\n";
     263
     264    print $listFile "\tIMAGE\tSTR\t"    . $image    . "\n";
     265    print $listFile "\tMASK\tSTR\t"     . $mask     . "\n";
     266    print $listFile "\tVARIANCE\tSTR\t" . $weight   . "\n";
     267    print $listFile "\tPSF\tSTR\t"      . $psf      . "\n" if $convolve;
     268    print $listFile "\tSOURCES\tSTR\t"  . $sources  . "\n";
     269    print $listFile "\tBKGMODEL\tSTR\t" . $bkgmodel . "\n" if $ipprc->file_exists( $bkgmodel );
     270
     271    print $listFile "END\n\n";
    225272    $num++;
    226 
    227 #    my $image = $file->{uri};   # Image name
    228     my $image = $ipprc->filename("PSWARP.OUTPUT", $file->{path_base} ); # Image name
    229     my $mask = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name
    230     my $weight = $ipprc->filename( "PSWARP.OUTPUT.VARIANCE", $file->{path_base} ); # Weight name
    231     my $psf = $convolve ? $ipprc->filename( "PSPHOT.PSF.SKY.SAVE", $file->{path_base} ) : undef; # PSF name
    232     my $sources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base}); # Sources name
    233 
    234     my $bkgmodel = $ipprc->filename("PSWARP.OUTPUT.BKGMODEL", $file->{path_base});
    235 
    236     &my_die("Image $image does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $image );
    237     &my_die("Mask $mask does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $mask );
    238     &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $weight );
    239     &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) if ($convolve and not $ipprc->file_exists( $psf ));
    240     &my_die("Sources $sources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $sources );
    241 
    242     print $listFile "\tIMAGE\tSTR\t" . $image . "\n";
    243     print $listFile "\tMASK\tSTR\t" . $mask . "\n";
    244     print $listFile "\tVARIANCE\tSTR\t" . $weight . "\n";
    245     print $listFile "\tPSF\tSTR\t" . $psf . "\n" if $convolve;
    246     print $listFile "\tSOURCES\tSTR\t" . $sources . "\n";
    247     print $listFile "\tBKGMODEL\tSTR\t" . $bkgmodel . "\n" if $ipprc->file_exists( $bkgmodel );
    248 
    249     print $listFile "END\n\n";
    250273}
    251274close($listFile);
     
    255278# Prepare the output files
    256279my @outputFiles;
    257 prepare_outputs(\@outputFiles, \@outputList, $outroot);
     280prepare_outputs(\@outputFiles, \@outputList,       $outroot) if $convolve;
    258281prepare_outputs(\@outputFiles, \@outputListPhotom, $outroot) if $photometry;
    259 prepare_outputs(\@outputFiles, \@outputListUnconv, $outroot) if $convolve;
     282prepare_outputs(\@outputFiles, \@outputListUnconv, $outroot); # unconvolved output always go here
    260283
    261284# we need the output image name for the database
     
    309332    }
    310333    if ($output_logflux) {
    311         $command .= " -R PPSTACK.OUTPUT FITS.TYPE COMP_STACK "; # Just this one output component?
    312         $command .= " -R PPSTACK.OUTPUT.VARIANCE FITS.TYPE COMP_STACK ";
    313 #       $command .= " -R PPSTACK.OUTPUT.EXPWT FITS.TYPE COMP_STACK ";
    314         $command .= " -R PPSTACK.UNCONV FITS.TYPE COMP_STACK ";
    315         $command .= " -R PPSTACK.UNCONV.VARIANCE FITS.TYPE COMP_STACK ";
    316 #       $command .= " -R PPSTACK.UNCONV.EXPWT FITS.TYPE COMP_STACK ";
     334        $command .= " -R PPSTACK.OUTPUT          FITS.TYPE STK_UNIONS_COMP";
     335        $command .= " -R PPSTACK.OUTPUT.VARIANCE FITS.TYPE STK_UNIONS_COMP";
     336        $command .= " -R PPSTACK.UNCONV          FITS.TYPE STK_UNIONS_COMP";
     337        $command .= " -R PPSTACK.UNCONV.VARIANCE FITS.TYPE STK_UNIONS_COMP";
     338    }
     339    # if the total exposure time is long (> 6500 sec), need to use
     340    # a different compression options.
     341    if ($output_deepexp) {
     342        $command .= " -R PPSTACK.OUTPUT.EXP FITS.TYPE EXP_UNIONS ";
     343        $command .= " -R PPSTACK.UNCONV.EXP FITS.TYPE EXP_UNIONS ";
    317344    }
    318345    $command .= " -threads $threads" if defined $threads;
  • trunk/ippScripts/scripts/warp_overlap.pl

Note: See TracChangeset for help on using the changeset viewer.