IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 7, 2009, 4:08:25 PM (17 years ago)
Author:
Paul Price
Message:

Merging trunk (r25026) to get up-to-date on old branch.

Location:
branches/pap
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap

  • branches/pap/tools/diff_outputs.pl

    r23933 r25027  
    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
     
    5069                       ) or die "Unable to connect to database: $DBI::errstr";
    5170
     71
    5272# Query to run
    53 my $sql = "SELECT path_base FROM diffSkyfile WHERE diff_id = $diff_id";
     73my $sql = "SELECT path_base, bothways FROM diffSkyfile JOIN diffRun USING(diff_id) WHERE diff_id = $diff_id AND fault = 0 AND quality = 0";
    5474$sql .= " AND skycell_id = '$skycell_id'" if defined $skycell_id;
    5575
    5676# List of diffs
    57 my $diffs = $db->selectcol_arrayref( $sql,
    58                                      { Columns => [1] }
     77my $diffs = $db->selectall_arrayref( $sql, { Slice => {} }
    5978                                     ) or die "Unable to execute SQL: $DBI::errstr";
    6079
    6180my @products;                   # Array of products
    6281if (defined $products) {
    63     @products = split /,/, $products;
     82  PRODUCT_SEARCH: foreach my $product ( split(/,/, $products) ) {
     83      foreach my $key ( keys %{PRODUCTS()} ) {
     84          if ($product eq $key) {
     85              push @products, @{${PRODUCTS()}{$key}};
     86              next PRODUCT_SEARCH;
     87          }
     88      }
     89      push @products, $product;
     90  }
    6491} else {
    65     @products = keys %{EXTENSIONS()};
     92    @products = @{${PRODUCTS()}{'ALL'}};
    6693}
    6794
    6895foreach my $diff ( @$diffs ) {
    6996    foreach my $product ( @products ) {
    70         copy_extension( $diff, ${EXTENSIONS()}{$product} );
     97        next if (not defined $diff->{bothways} or $diff->{bothways} eq 'NULL' or not $diff->{bothways}) and $product =~ /INVERSE/;
     98        copy_extension( $diff->{path_base}, ${EXTENSIONS()}{$product} );
    7199    }
    72100}
Note: See TracChangeset for help on using the changeset viewer.