IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 5, 2009, 4:22:57 PM (17 years ago)
Author:
Paul Price
Message:

Adding symbolic products to get both forward and inverse subtractions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/diff_outputs.pl

    r23933 r24075  
    1212use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
    1313
     14# List of products
     15use constant PRODUCTS => { 'REGULAR' => [ 'IMAGE', 'MASK', 'VARIANCE',
     16                                          'SOURCES', 'JPEG1', 'JPEG2',
     17                                          'KERNEL' ],
     18                           'ALL' => [ 'IMAGE', 'MASK', 'VARIANCE',
     19                                      'SOURCES', 'JPEG1', 'JPEG2',
     20                                      'KERNEL', 'INVERSE.IMAGE',
     21                                      'INVERSE.MASK', 'INVERSE.VARIANCE',
     22                                      'INVERSE.SOURCES' ],
     23                           'INVERSE' => [ 'INVERSE.IMAGE', 'INVERSE.MASK',
     24                                          'INVERSE.VARIANCE',
     25                                          'INVERSE.SOURCES' ],
     26                       };
     27
     28# Extensions to add to path_base
    1429use constant EXTENSIONS => { 'IMAGE' => '.fits', # Image
    1530                             'MASK' => '.mask.fits', # Mask
     
    1934                             'JPEG2' => '.b2.jpg', # Binned JPEG
    2035                             'KERNEL' => '.subkernel', # Convolution kernel
     36                             'INVERSE.IMAGE' => '.inv.fits', # Image
     37                             'INVERSE.MASK' => '.inv.mask.fits', # Mask
     38                             'INVERSE.VARIANCE' => '.inv.wt.fits', # Variance
     39                             'INVERSE.SOURCES' => '.inv.cmf', # Sources
    2140                         };
    2241
     
    2544my ($input);                    # Input list
    2645my ($products);                 # Products of interest
     46my ($inverse);                  # Get inverse products too?
    2747
    2848GetOptions(
     
    3454           'skycell_id=s' => \$skycell_id, # Skycell identifier
    3555           'products=s' => \$products, # Products of interest
     56           'inverse' => \$inverse, # Get inverse products?
    3657           ) or die "Unable to parse arguments.\n";
    3758die "Unknown option: @ARGV\n" if @ARGV;
     
    5071                       ) or die "Unable to connect to database: $DBI::errstr";
    5172
     73
    5274# Query to run
    5375my $sql = "SELECT path_base FROM diffSkyfile WHERE diff_id = $diff_id";
     
    6183my @products;                   # Array of products
    6284if (defined $products) {
    63     @products = split /,/, $products;
     85  PRODUCT_SEARCH: foreach my $product ( split /,/, $products ) {
     86      foreach my $key ( keys %${EXTENSIONS()} ) {
     87          if ($product eq $key) {
     88              push @products, ${PRODUCTS()}->{$key};
     89              next PRODUCT_SEARCH;
     90          }
     91      }
     92      push @products, $product;
     93  }
    6494} else {
    65     @products = keys %{EXTENSIONS()};
     95    @products = @{${PRODUCTS()}{'REGULAR'}};
    6696}
    6797
    6898foreach my $diff ( @$diffs ) {
    6999    foreach my $product ( @products ) {
     100        print "$product ==> ";
    70101        copy_extension( $diff, ${EXTENSIONS()}{$product} );
    71102    }
Note: See TracChangeset for help on using the changeset viewer.