IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 23, 2007, 3:12:46 PM (19 years ago)
Author:
Paul Price
Message:

More fixes following the name change.

File:
1 edited

Legend:

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

    r12013 r12021  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($p5_id, $camera, $dbname, $workdir, $no_update, $no_op);
     35my ($diff_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3636GetOptions(
    37     'p5_id|d=s'         => \$p5_id, # Phase 5 identifier
     37    'diff_id|d=s'       => \$diff_id, # Diff identifier
    3838    'camera|c=s'        => \$camera, # Camera name
    3939    'dbname|d=s'        => \$dbname, # Database name
     
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4646pod2usage(
    47     -msg => "Required options: --p5_id --camera",
     47    -msg => "Required options: --diff_id --camera",
    4848    -exitval => 3,
    49 ) unless defined $p5_id
     49) unless defined $diff_id
    5050    and defined $camera;
    5151
     
    5454# Look for programs we need
    5555my $missing_tools;
    56 my $difftool = can_run('p5tool') or (warn "Can't find p5tool" and $missing_tools = 1);
     56my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1);
    5757my $pois = can_run('pois') or (warn "Can't find pois" and $missing_tools = 1);
    5858if ($missing_tools) {
     
    6565my $files;
    6666{
    67     my $command = "$difftool -inputscfile -p5_id $p5_id";
     67    my $command = "$difftool -inputscfile -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", $p5_id, $error_code);
     73        &my_die("Unable to perform difftool -inputscfile: $error_code", $diff_id, $error_code);
    7474    }
    7575
    7676    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    77         &my_die("Unable to parse metadata config doc", $p5_id, $PS_EXIT_PROG_ERROR);
     77        &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
    7878    $files = parse_md_list($metadata) or
    79         &my_die("Unable to parse metadata list", $p5_id, $PS_EXIT_PROG_ERROR);
    80 }
    81 
    82 &my_die("Subtraction list contains more than two elements", $p5_id, $PS_EXIT_SYS_ERROR) unless
     79        &my_die("Unable to parse metadata list", $diff_id, $PS_EXIT_PROG_ERROR);
     80}
     81
     82&my_die("Subtraction list contains more than two elements", $diff_id, $PS_EXIT_SYS_ERROR) unless
    8383    scalar @$files == 2;
    8484
     
    9595    }
    9696    if (defined $skycell_id) {
    97         &my_die("Skycell identifiers don't match", $p5_id, $PS_EXIT_SYS_ERROR) unless
     97        &my_die("Skycell identifiers don't match", $diff_id, $PS_EXIT_SYS_ERROR) unless
    9898            $file->{skycell_id} eq $skycell_id;
    9999    } else {
     
    102102}
    103103
    104 &my_die("Unable to identify template", $p5_id, $PS_EXIT_SYS_ERROR) unless defined $template;
    105 &my_die("Unable to identify input", $p5_id, $PS_EXIT_SYS_ERROR) unless defined $input;
     104&my_die("Unable to identify template", $diff_id, $PS_EXIT_SYS_ERROR) unless defined $template;
     105&my_die("Unable to identify input", $diff_id, $PS_EXIT_SYS_ERROR) unless defined $input;
    106106
    107107### Working directory
     
    114114
    115115# Get the output filenames
    116 my $outputFile = "$skycell_id.sub.$p5_id"; # Root name
     116my $outputFile = "$skycell_id.sub.$diff_id"; # Root name
    117117my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
    118118
     
    131131    unless ($success) {
    132132        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    133         &my_die("Unable to perform ppImage: $error_code", $p5_id, $error_code);
    134     }
    135     &my_die("Couldn't find expected output file: $outputName", $p5_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;
    136 #    &my_die("Couldn't find expected output file: $bin1Name",    $p5_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;
    137 #    &my_die("Couldn't find expected output file: $bin2Name",    $p5_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;
    138 #    &my_die("Couldn't find expected output file: $outputStats", $p5_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
     133        &my_die("Unable to perform ppImage: $error_code", $diff_id, $error_code);
     134    }
     135    &my_die("Couldn't find expected output file: $outputName", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;
     136#    &my_die("Couldn't find expected output file: $bin1Name",    $diff_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;
     137#    &my_die("Couldn't find expected output file: $bin2Name",    $diff_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;
     138#    &my_die("Couldn't find expected output file: $outputStats", $diff_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
    139139
    140140    # Get the statistics on the residual image
    141141    if (0) { ### Disabled because pois doesn't output stats yet
    142142        my $statsFile;          # File handle
    143         open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $p5_id, $PS_EXIT_SYS_ERROR);
     143        open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $diff_id, $PS_EXIT_SYS_ERROR);
    144144        my @contents = <$statsFile>; # Contents of file
    145145        close $statsFile;
    146146        my $metadata = $mdcParser->parse(join "", @contents) or
    147             &my_die("Unable to parse metadata config doc", $p5_id, $PS_EXIT_PROG_ERROR);
    148         $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $p5_id, $PS_EXIT_PROG_ERROR);
     147            &my_die("Unable to parse metadata config doc", $diff_id, $PS_EXIT_PROG_ERROR);
     148        $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $diff_id, $PS_EXIT_PROG_ERROR);
    149149    }
    150150}
     
    160160    # Add the subtraction result
    161161    {
    162         my $command = "$difftool -adddiffscfile -p5_id $p5_id -uri $outputName -b1_uri $outputRoot";
     162        my $command = "$difftool -adddiffscfile -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", $p5_id, $error_code);
     170            &my_die("Unable to perform difftool -adddiffscfile: $error_code", $diff_id, $error_code);
    171171        }
    172172       
     
    176176    # Register the run as completed
    177177    {
    178         my $command = "$difftool -updaterun -p5_id $p5_id -state stop"; # Command to run p5tool
     178        my $command = "$difftool -updaterun -diff_id $diff_id -state stop"; # Command to run difftool
    179179        $command .= " -dbname $dbname" if defined $dbname;
    180180
     
    193193{
    194194    my $msg = shift;            # Warning message on die
    195     my $p5_id = shift;          # Phase 5 identifier
     195    my $diff_id = shift;        # Diff identifier
    196196    my $exit_code = shift;      # Exit code to add
    197197
    198198    warn($msg);
    199     if ($p5_id and not $no_update) {
    200         my $command = "$difftool -updaterun -p5_id $p5_id -state stop -code $exit_code";
     199    if ($diff_id and not $no_update) {
     200        my $command = "$difftool -updaterun -diff_id $diff_id -state stop -code $exit_code";
    201201        $command .= " -dbname $dbname" if defined $dbname;
    202202        system ($command);
Note: See TracChangeset for help on using the changeset viewer.