IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12043


Ignore:
Timestamp:
Feb 23, 2007, 6:07:01 PM (19 years ago)
Author:
Paul Price
Message:

Getting scripts to talk to ippTools. warp_overlap.pl and warp_imfile.pl both cooperate (i.e., work with --no-op). Haven't tried diff or stack yet.

Location:
trunk/ippScripts/scripts
Files:
3 edited

Legend:

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

    r12021 r12043  
    6565my $files;
    6666{
    67     my $command = "$difftool -inputscfile -diff_id $diff_id";
     67    my $command = "$difftool -inputskyfile -diff_id $diff_id";
    6868    $command .= " -dbname $dbname" if defined $dbname;
    6969    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    7171    unless ($success) {
    7272        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    73         &my_die("Unable to perform difftool -inputscfile: $error_code", $diff_id, $error_code);
     73        &my_die("Unable to perform difftool -inputskyfile: $error_code", $diff_id, $error_code);
    7474    }
    7575
     
    160160    # Add the subtraction result
    161161    {
    162         my $command = "$difftool -adddiffscfile -diff_id $diff_id -uri $outputName -b1_uri $outputRoot";
     162        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -b1_uri $outputRoot";
    163163        $command .= " -bg $bg -bg_stdev $bg_stdev";
    164164        $command .= " -dbname $dbname" if defined $dbname;
     
    168168        unless ($success) {
    169169            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    170             &my_die("Unable to perform difftool -adddiffscfile: $error_code", $diff_id, $error_code);
     170            &my_die("Unable to perform difftool -adddiffskyfile: $error_code", $diff_id, $error_code);
    171171        }
    172172       
  • trunk/ippScripts/scripts/warp_imfile.pl

    r12021 r12043  
    1616use PS::IPP::Metadata::Config;
    1717use PS::IPP::Metadata::Stats;
     18use PS::IPP::Metadata::List qw( parse_md_list );
    1819
    1920use PS::IPP::Config qw(
     
    3233use Pod::Usage qw( pod2usage );
    3334
    34 my ($warp_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($warp_id, $skycell_id, $tess_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3536GetOptions(
    3637    'warp_id|i=s'       => \$warp_id, # Warp identifier
    3738    'skycell_id|s=s'    => \$skycell_id, # Skycell identifier
     39    'tess_id|s=s'       => \$tess_id, # Tesselation identifier
    3840    'camera|c=s'        => \$camera, # Camera name
    3941    'dbname|d=s'        => \$dbname, # Database name
     
    4547pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4648pod2usage(
    47     -msg => "Required options: --warp_id --skycell_id --camera",
     49    -msg => "Required options: --warp_id --skycell_id --tess_id --camera",
    4850    -exitval => 3,
    4951) unless defined $warp_id
    5052    and defined $skycell_id
     53    and defined $tess_id
    5154    and defined $camera;
    5255
     
    6669my $imfiles;
    6770{
    68     my $command = "$warptool -imfile -warp_id $warp_id -skycell_id $skycell_id";
     71    my $command = "$warptool -scmap -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id";
    6972    $command .= " -dbname $dbname" if defined $dbname;
    7073    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    7275    unless ($success) {
    7376        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    74         &my_die("Unable to perform warptool -imfile: $error_code", $warp_id, $skycell_id, $error_code);
     77        &my_die("Unable to perform warptool -scmap: $error_code", $warp_id, $skycell_id, $tess_id, $error_code);
    7578    }
    7679
    7780    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    78         &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     81        &my_die("Unable to parse metadata config doc", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    7982    $imfiles = parse_md_list($metadata) or
    80         &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     83        &my_die("Unable to parse metadata list", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    8184}
    8285
     
    8588    $workdir = $ipprc->convert_filename_absolute( $workdir );
    8689} else {
    87     my ($vol, $dir, $file) = File::Spec->splitpath( $$imfiles[0]->{uri} );
     90    my $example = $ipprc->convert_filename_absolute( $$imfiles[0]->{uri} );
     91    my ($vol, $dir, $file) = File::Spec->splitpath( $example );
    8892    $workdir = $dir;
    8993}
     
    97101
    98102# Get list of filenames
    99 open my $listFile, '>' . $listName;
     103open my $listFile, "> $listName" or &my_die("Unable to open $listName", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR);
    100104foreach my $imfile (@$imfiles) {
    101105    my $uri = $ipprc->convert_filename_absolute( $imfile->{uri} );
     
    115119        &my_die("Unable to perform pswarp: $error_code", $warp_id, $skycell_id, $error_code);
    116120    }
    117     &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
    118     &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
    119     &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
    120     &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
     121    &my_die("Couldn't find expected output file: $outputImage", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage;
     122    &my_die("Couldn't find expected output file: $outputStats", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
     123    &my_die("Couldn't find expected output file: $outputBin1", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
     124    &my_die("Couldn't find expected output file: $outputBin2", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
    121125
    122126    # Get the statistics on the warped image
     
    126130    close $statsFile;
    127131    my $metadata = $mdcParser->parse(join "", @contents)
    128         or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    129     $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $PS_EXIT_PROG_ERROR);
     132        or &my_die("Unable to parse metadata config", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
     133    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $warp_id, $skycell_id, $tess_id, $PS_EXIT_PROG_ERROR);
    130134}
    131135
     
    140144# Add the processed file to the database
    141145unless ($no_update) {
    142     my $command = "$warptool -warped -warp_id $warp_id -skycell_id $skycell_id" .
    143         " -uri $outputImage -b1_uri $outputRoot";  # Command to run dettool
     146    my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id" .
     147        " -uri $outputImage"; # -b1_uri $outputRoot";  # Command to run dettool
    144148    $command .= " -bg $bg -bg_stdev $bg_stdev";
    145149    $command .= " -dbname $dbname" if defined $dbname;
     
    149153    unless ($success) {
    150154        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    151         warn("Unable to perform warptool -addwarpedimfile: $error_code\n");
     155        warn("Unable to perform warptool -addwarped: $error_code\n");
    152156        exit($error_code);
    153157    }
     
    161165    my $warp_id = shift;        # Warp identifier
    162166    my $skycell_id = shift;     # Skycell identifier
     167    my $tess_id = shift;        # Tesselation identifier
    163168    my $exit_code = shift;      # Exit code to add
    164169
    165170    warn($msg);
    166     if ($warp_id and $skycell_id and not $no_update) {
    167         my $command = "$warptool -warped -warp_id $warp_id -skycell_id $skycell_id -code $exit_code";
     171    if ($warp_id and $skycell_id and $tess_id and not $no_update) {
     172        my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
    168173        $command .= " -dbname $dbname" if defined $dbname;
    169174        system ($command);
  • trunk/ippScripts/scripts/warp_overlap.pl

    r12021 r12043  
    1616use PS::IPP::Metadata::Config;
    1717use PS::IPP::Metadata::Stats;
     18use PS::IPP::Metadata::List qw( parse_md_list );
    1819
    1920use PS::IPP::Config qw(
     
    8485        $imfile->{skycell_id} = 'default';
    8586        $imfile->{tess_id} = 'default';
     87        $imfile->{fault} = 0;
    8688    }
    8789}
    88    
     90
     91if (defined $workdir) {
     92    $workdir = $ipprc->convert_filename_absolute( $workdir );
     93} else {
     94    my $example = $ipprc->convert_filename_absolute( $$imfiles[0]->{uri} );
     95    my ($vol, $dir, $file) = File::Spec->splitpath( $example );
     96    $workdir = $dir;
     97}
    8998
    9099# Generate a MDC file with the overlaps
    91 $workdir = $ipprc->convert_filename_absolute( $workdir );
    92 my $overlapName = File::Spec->catfile( $workdir, $warp_id . '.overlap.mdc' );
    93 open my $overlapFile, "> $overlapName" or
    94     &my_die("Unable to open mdc file $overlapName", $warp_id, $PS_EXIT_DATA_ERROR);
     100my $overlapName = File::Spec->catfile( $workdir, $warp_id . '.overlap.mdc' );
     101open my $overlapFile, "> $overlapName" or die "Unable to open mdc file $overlapName";
    95102print $overlapFile "warpSkyCellMap MULTI\n\n";
    96103foreach my $imfile (@$imfiles) {
    97     print $overlapFile "warp_id\t\tS32\t" . $imfile->{warp_id} . "\n";
    98     print $overlapFile "skycell_id\tSTR\t" . $imfile->{skycell_id} . "\n";
    99     print $overlapFile "tess_id\t\tSTR\t" . $imfile->{tess_id} . "\n";
    100     print $overlapFile "exp_tag\t\tSTR\t" . $imfile->{exp_tag} . "\n";
    101     print $overlapFile "p3_version\tS32\t" . $imfile->{p3_version} . "\n";
    102     print $overlapFile "class_id\t\tSTR\t" . $imfile->{class_id} . "\n";
     104    print $overlapFile "warpSkyCellMap\tMETADATA\n";
     105    print $overlapFile "\twarp_id\tS32\t" . $warp_id . "\n";
     106    print $overlapFile "\tskycell_id\tSTR\t" . $imfile->{skycell_id} . "\n";
     107    print $overlapFile "\ttess_id\t\tSTR\t" . $imfile->{tess_id} . "\n";
     108    print $overlapFile "\texp_tag\t\tSTR\t" . $imfile->{exp_tag} . "\n";
     109    print $overlapFile "\tcam_version\tS32\t" . $imfile->{cam_version} . "\n";
     110    print $overlapFile "\tclass_id\t\tSTR\t" . $imfile->{class_id} . "\n";
     111    print $overlapFile "\tfault\tS16\t" . $imfile->{fault} . "\n";
     112    print $overlapFile "END\n\n";
    103113}
    104114close $overlapFile;
     
    106116# Add the processed file to the database
    107117unless ($no_update) {
    108     my $command = "$warptool -addoverlap -warp_id $warp_id -info $overlapName"; # Command to run warptool
     118    my $command = "$warptool -addoverlap -mapfile $overlapName"; # Command to run warptool
    109119    $command .= " -dbname $dbname" if defined $dbname;
    110120
     
    129139
    130140    warn($msg);
    131     if ($warp_id and not $no_update) {
    132         my $command = "$warptool -addoverlap -warp_id $warp_id -code $exit_code";
    133         $command .= " -dbname $dbname" if defined $dbname;
    134         system ($command);
    135     }
     141
     142    # No failure option on warptool for this mode, so just die.
    136143    exit $exit_code;
    137144}
Note: See TracChangeset for help on using the changeset viewer.