IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33054


Ignore:
Timestamp:
Jan 9, 2012, 1:47:47 PM (14 years ago)
Author:
bills
Message:

reorganize the processing so that the postage stamp sever can remove background correction
without a chipBackgroundRun or warpBackgroundRun

Location:
trunk/ippScripts/scripts
Files:
2 edited

Legend:

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

    r28536 r33054  
    4242# Parse the command-line arguments
    4343my ( $chip_bg_id, $class_id, $camera, $outroot, $dbname, $reduction, $verbose,
    44      $threads, $no_update, $save_temps, $no_op, $redirect, $deburned );
     44     $threads, $no_update, $save_temps, $no_op, $redirect, $chip_path_base, $magicked );
    4545GetOptions(
    4646    'chip_bg_id=s'      => \$chip_bg_id,    # chipBackgroundRun identifier
     
    5151    'reduction=s'       => \$reduction, # Reduction class
    5252    'threads=s'         => \$threads,   # Number of threads to use
     53    'chip_path_base=s'  => \$chip_path_base, # optional chip_path_base
     54    'magicked=s'        => \$magicked,  # magicked status of input
    5355    'verbose'           => \$verbose,   # Print to stdout
    5456    'no-update'         => \$no_update, # Don't update the database?
     
    8890# Get inputs
    8991my $in_path;                    # Input path
    90 my $magicked;                   # Input is magicked?
    91 {
     92my $do_stats;
     93my $dump_config;
     94if ($chip_path_base and $no_update) {
     95    # we are running outside of a chip_bg_run (perhaps by the postage stamp server) don't dump config
     96    # or do stats. Get path to input from command line.
     97    $in_path = $chip_path_base;
     98    $magicked = 0 if !defined $magicked;
     99    $do_stats = 0;
     100    $dump_config = 0;
     101} else {
     102    # normal operation. Get input parameters from the database
     103    $do_stats = 1;
     104    $dump_config = 1;
    92105    my $command = "bgtool -chipinputs -chip_bg_id $chip_bg_id -class_id $class_id";
    93106    $command .= " -dbname $dbname" if defined $dbname;
     
    153166    $command .= " -image $in_image";
    154167    $command .= " -mask $in_mask";
    155     $command .= " -stats $out_stats";
     168    $command .= " -stats $out_stats" if $do_stats;
    156169    $command .= " -background $in_bg" if $apply_bg;
    157170    $command .= " -pattern $in_pattern" if $apply_pattern;
    158171    $command .= " -recipe PPBACKGROUND $recipe_ppBackground";
    159     $command .= " -recipe PPSTATS CHIPSTATS";
     172    $command .= " -recipe PPSTATS CHIPSTATS" if $do_stats;
    160173    $command .= " -dbname $dbname" if defined $dbname;
    161     $command .= " -dumpconfig $out_config";
     174    $command .= " -dumpconfig $out_config" if $dump_config;
    162175    $command .= " -tracedest $traceDest -log $logDest";
    163176
     
    171184
    172185# Gather command-line arguments from statistics
    173 my $cmdflags;                   # Command-line flags to add
    174 my $quality;                    # Quality flag
    175 {
     186my $cmdflags = "";                  # Command-line flags to add
     187my $quality = 0;                    # Quality flag
     188if ($do_stats) {
    176189    &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_stats);
    177190
     
    191204
    192205if (!$quality and !$no_op) {
    193     &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_image);
    194     &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_mask);
    195     &my_die("Couldn't find expected output file: $out_stats", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_config);
     206    &my_die("Couldn't find expected output file: $out_image", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_image);
     207    &my_die("Couldn't find expected output file: $out_mask", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($out_mask);
     208    &my_die("Couldn't find expected output file: $out_config", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR) unless !$dump_config or $ipprc->file_exists($out_config);
    196209
    197210}
  • trunk/ippScripts/scripts/background_warp.pl

    r28544 r33054  
    3838
    3939my ($warp_bg_id, $skycell_id, $tess_dir, $reduction, $camera, $dbname, $outroot, $threads, $verbose, $no_update, $no_op, $redirect, $save_temps);
     40my ($astrometry, $imageName, $maskName, $magicked);
    4041GetOptions(
    4142    'warp_bg_id|i=s'      => \$warp_bg_id, # Warp identifier
     
    4647    'reduction=s'         => \$reduction, # Reduction class
    4748    'outroot=s'           => \$outroot, # Output root name
     49    'image-list=s'        => \$imageName, # list of input image files
     50    'mask-list=s'         => \$maskName, # list of input mask files
     51    'astrometry=s'        => \$astrometry,
     52    'magicked=s'          => \$magicked,
    4853    'threads=s'           => \$threads,   # Number of threads to use for pswarp
    4954    'verbose'             => \$verbose,   # Print to stdout
     
    6469    and defined $outroot;
    6570
    66 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
     71if ($imageName) {
     72    # we have been invoked in a special mode where the caller tells us all about the inputs
     73    # This is used by the postage stamp server to make non-background corrected images without
     74    # the existence of a warpBackgroundRun (or chipBackgroundRun)
     75    # Make sure all of the inputs were supplied
     76    if (!(defined $maskName and defined $astrometry and defined $magicked)) {
     77        print STDERR "mask-list, astrometry, and magicked must be supplied if image-list is used\n";
     78        if ($warp_bg_id) {
     79            my_die( "invalid argument list.", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR );
     80        }
     81        exit $PS_EXIT_CONFIG_ERROR;
     82    }
     83}
     84
     85my $ipprc = PS::IPP::Config->new( $camera ) or
     86my_die( "Unable to set up", $warp_bg_id, $skycell_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6787
    6888my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR );
     
    97117# Get list of filenames
    98118my $tempOutRoot = "/tmp/background.warp.$warp_bg_id.$skycell_id";
    99 my ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
    100 my ($maskFile, $maskName) = tempfile( "$tempOutRoot.mask.list.XXXX",   UNLINK => !$save_temps);
    101 my $astrometry;                 # Astrometry filename
    102 my $magicked;                   # Magicked status
    103 {
     119if (!defined $imageName) {
     120    # go find our inputs
     121    my ($imageFile, $maskFile);
     122    ($imageFile, $imageName) = tempfile( "$tempOutRoot.image.list.XXXX",  UNLINK => !$save_temps);
     123    ($maskFile, $maskName) = tempfile( "$tempOutRoot.mask.list.XXXX",   UNLINK => !$save_temps);
    104124    my $command = "$bgtool -warpinputs";
    105125    $command .= " -warp_bg_id $warp_bg_id";
     
    132152        $astrometry = $astrom;
    133153    }
    134 }
    135 close $imageFile;
    136 close $maskFile;
     154    close $imageFile;
     155    close $maskFile;
     156}
    137157
    138158&my_die("Can't find input astrometry: $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($astrometry);
Note: See TracChangeset for help on using the changeset viewer.