Changeset 25027 for branches/pap/tools/diff_outputs.pl
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tools/diff_outputs.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/tools/diff_outputs.pl
r23933 r25027 12 12 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 13 13 14 # List of products 15 use 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 14 29 use constant EXTENSIONS => { 'IMAGE' => '.fits', # Image 15 30 'MASK' => '.mask.fits', # Mask … … 19 34 'JPEG2' => '.b2.jpg', # Binned JPEG 20 35 '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 21 40 }; 22 41 … … 50 69 ) or die "Unable to connect to database: $DBI::errstr"; 51 70 71 52 72 # Query to run 53 my $sql = "SELECT path_base FROM diffSkyfile WHERE diff_id = $diff_id";73 my $sql = "SELECT path_base, bothways FROM diffSkyfile JOIN diffRun USING(diff_id) WHERE diff_id = $diff_id AND fault = 0 AND quality = 0"; 54 74 $sql .= " AND skycell_id = '$skycell_id'" if defined $skycell_id; 55 75 56 76 # List of diffs 57 my $diffs = $db->selectcol_arrayref( $sql, 58 { Columns => [1] } 77 my $diffs = $db->selectall_arrayref( $sql, { Slice => {} } 59 78 ) or die "Unable to execute SQL: $DBI::errstr"; 60 79 61 80 my @products; # Array of products 62 81 if (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 } 64 91 } else { 65 @products = keys %{EXTENSIONS()};92 @products = @{${PRODUCTS()}{'ALL'}}; 66 93 } 67 94 68 95 foreach my $diff ( @$diffs ) { 69 96 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} ); 71 99 } 72 100 }
Note:
See TracChangeset
for help on using the changeset viewer.
