IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18055


Ignore:
Timestamp:
Jun 10, 2008, 10:03:19 AM (18 years ago)
Author:
eugene
Message:

input astrometry is only MEF; tess_id to tess_dir; remove astromDepth

File:
1 edited

Legend:

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

    r17897 r18055  
    2727my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2828
    29 my ($warp_id, $camera, $tess_id, $dbname, $verbose, $no_update, $no_op, $save_temps);
     29my ($warp_id, $camera, $tess_dir, $dbname, $verbose, $no_update, $no_op, $save_temps);
    3030GetOptions(
    3131    'warp_id|i=s'       => \$warp_id, # Warp identifier
    3232    'camera|c=s'        => \$camera, # Camera name
    33     'tess_id=s'         => \$tess_id, # Tessellation identifier
     33    'tess_dir=s'        => \$tess_dir, # Tessellation directory
    3434    'dbname|d=s'        => \$dbname, # Database name
    3535    'verbose'           => \$verbose,   # Print to stdout
     
    4141pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4242pod2usage(
    43     -msg => "Required options: --warp_id --camera --tess_id",
     43    -msg => "Required options: --warp_id --camera --tess_dir",
    4444    -exitval => 3,
    4545) unless defined $warp_id
    4646    and defined $camera
    47     and defined $tess_id;
     47    and defined $tess_dir;
    4848
    4949$ipprc->define_camera($camera);
     
    7979}
    8080
    81 # Where do we get the astrometry source from?
    82 my $astromSource;               # The astrometry source
     81# Where do we get the astrometry source from? 
     82my $astromSource;               # The astrometry source filerule (eg, PSASTRO.OUTPUT, PSASTRO.OUTPUT.MEF)
    8383my $astromAccept;               # Accept the astrometry unconditionally?
    84 my $astromDepth;                # File level of the astrometry source (SPLIT or MEF)?
    8584{
    8685    my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -";
     
    9594    $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
    9695    $astromAccept = metadataLookupBool($metadata, 'ASTROM.ACCEPT');
    97     $astromDepth  = metadataLookupStr($metadata, 'ASTROM.DEPTH');
    98 }
    99 
    100 
     96}
    10197
    10298# Determine the imfile/skycell overlaps
     
    105101    # Calculate the overlaps between imfiles and skycells
    106102
    107     my $tess_dir = $ipprc->tessellation_catdir( $tess_id ); # Tessellation catdir for DVO
    108     $tess_dir = $ipprc->convert_filename_absolute( $tess_dir );
     103    # tess_dir is the DVO db holding the tessalations
     104    # this may be an abstract name in site.config:TESSELLATIONS, a URI, or an absolute path.
     105    # convert this to an absolute path
     106    my $tess_dir_abs = $ipprc->tessellation_catdir( $tess_dir ); # Tessellation catdir for DVO
     107    $tess_dir_abs = $ipprc->convert_filename_absolute( $tess_dir_abs );
    109108
    110109    my %unique_skycells = (); # Identified skycells (all unique by virtue of hash property)
    111110
    112     # XXX this is a bit too hard wired: the concept is that astrometry comes from the MOSAIC vs CHIP output
    113     # XXX we have moved the astrometry analysis to the camera stage only: we should always have the source be MEF
    114     if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
    115         # We have a MEF astrometry file from psastro
    116         my $imfile = $imfiles->[0];
    117         my $camRoot = $imfile->{cam_path_base};
    118         my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file
    119 
    120         my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps
    121         if (! @matchlist) {
    122             &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR);
    123         }
    124         # Match each of the imfiles to this list
    125         foreach my $imfile (@$imfiles) {
    126             extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells);
    127         }
    128     } else {
    129         # We have per-imfile astrometry
    130         foreach my $imfile (@$imfiles) {
    131             my $astromFile;
    132             if ($astromSource eq 'PSASTRO.OUTPUT') {
    133                 my $chipRoot = $imfile->{chip_path_base};
    134                 my $classID = $imfile->{class_id};
    135                 $astromFile = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
    136             } else {
    137                 $astromFile = $imfile->{chip_uri}; # Astrometry file
    138             }
    139             my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps
    140             if (! @matchlist and $verbose) {
    141                 print "skipping $astromFile\n";
    142             }
    143 
    144             extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells);
    145         }
     111    # astrometry is always determined at the camera stage; we have a MEF astrometry file from psastro
     112    my $imfile = $imfiles->[0];
     113    my $camRoot = $imfile->{cam_path_base};
     114    my $astromFile = $ipprc->filename($astromSource, $camRoot); # Astrometry file
     115
     116    my @matchlist = get_overlaps($astromFile, $tess_dir_abs, $astromAccept); # List of overlaps
     117    if (! @matchlist) {
     118        &my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR);
     119    }
     120    # Match each of the imfiles to this list (the input images may be split, but the astrometry is not)
     121    # tess_dir (not tess_dir_abs) is supplied here so it may be written to the db
     122    foreach my $imfile (@$imfiles) {
     123        extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_dir, \@overlaps, \%unique_skycells);
    146124    }
    147125} else {
     
    150128        my %overlap = ();
    151129        $overlap{skycell_id} = 'default';
    152         $overlap{tess_id}    = 'default';
     130        $overlap{tess_dir}   = 'default';
    153131        $overlap{cam_id}     = $imfile->{cam_id};
    154132        $overlap{class_id}   = $imfile->{class_id};
     
    170148    print $overlapFile "  warp_id        S32    $warp_id\n";
    171149    print $overlapFile "  skycell_id     STR    $overlap->{skycell_id}\n";
    172     print $overlapFile "  tess_id        STR    $overlap->{tess_id}\n";
     150    # XXX convert tess_id here to tess_dir when db scheme is updated
     151    print $overlapFile "  tess_id        STR    $overlap->{tess_dir}\n";
    173152    print $overlapFile "  cam_id         S32    $overlap->{cam_id}\n";
    174153    print $overlapFile "  class_id       STR    $overlap->{class_id}\n";
     
    215194{
    216195    my $filename = shift;       # Filename on which to run dvoImageOverlaps
    217     my $tess_dir = shift;       # Tessellation directory
     196    my $tess_dir_abs = shift;       # Tessellation directory
    218197    my $accept = shift;         # Do we use the -accept-astrom flag?
    219198
    220     my $command = "$dvoImageOverlaps -D CATDIR $tess_dir " . $ipprc->file_resolve($filename);
     199    my $command = "$dvoImageOverlaps -D CATDIR $tess_dir_abs " . $ipprc->file_resolve($filename);
    221200    $command .= ' -accept-astrom' if $accept;
    222201    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    248227    my $imfile = shift;         # Imfile information
    249228    my $filename = shift;       # Filename used with dvoImageOverlaps
    250     my $tess_id = shift;        # Tessellation identifier
     229    my $tess_dir = shift;        # Tessellation identifier
    251230    my $overlaps = shift;       # Reference to list of overlaps
    252231    my $unique_skycells = shift; # Reference to hash of found skycells
     
    259238    my $fileLevel = $imfile->{filelevel};
    260239    my $entry;  # How to identify this imfile in the dvoImageOverlaps output
    261     if ((lc($fileLevel) eq "chip") && (lc($astromDepth) eq "mef")) {
     240    if (lc($fileLevel) eq "chip") {
    262241        my $class_id = $imfile->{class_id};
    263242        my $chipRoot = $ipprc->file_resolve( $imfile->{chip_path_base} );
    264243        my $extname = $ipprc->extname_rule("CMF.HEAD", $class_id); # MEF psastro output
    265 
    266244
    267245        $entry = $filename . '\[' . $extname . '\]';
     
    278256        my %overlap = ();       # Overlap information for warptool
    279257        $overlap{skycell_id} = $skycell;
    280         $overlap{tess_id}    = $tess_id;
     258        $overlap{tess_dir}   = $tess_dir;
    281259        $overlap{cam_id}     = $imfile->{cam_id};
    282260        $overlap{class_id}   = $imfile->{class_id};
Note: See TracChangeset for help on using the changeset viewer.