IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 15, 2007, 2:23:33 PM (19 years ago)
Author:
Paul Price
Message:

Adding --no-op option which turns off processing (so one can track only the database work flow) for everything except the phase 0 scripts (need to have some real data in the database in order to track it).

File:
1 edited

Legend:

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

    r11830 r11837  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update);
     34my ($p4_id, $skycell_id, $camera, $dbname, $workdir, $no_update, $no_op);
    3535GetOptions(
    3636    'p4_id|i=s'         => \$p4_id, # Phase 4 identifier
     
    3939    'dbname|d=s'        => \$dbname, # Database name
    4040    'workdir|w=s'       => \$workdir, # Working directory, for output files
    41     'no-update'         => \$no_update
     41    'no-update'         => \$no_update, # Don't update the database?
     42    'no-op'             => \$no_op, # Don't do any operations?
    4243) or pod2usage( 2 );
    4344
     
    6263
    6364# Get list of component imfiles for exposure
     65my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6466my $imfiles;
    6567{
     
    9799open my $listFile, '>' . $listName;
    98100foreach my $imfile (@$imfiles) {
    99     my $uri = $ipprc->convert_filename_absolute( $file->{uri} );
     101    my $uri = $ipprc->convert_filename_absolute( $imfile->{uri} );
    100102
    101     print $listFile $uri . "\n";
     103    print $listFile "$uri\n";
    102104}
    103105close $listFile;
    104106
    105107# Run pswarp
    106 {
    107     my $command = "$pswarp -file $uri $outputRoot -stat $outputStats"; # Command to run pswarp
     108my $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
     109unless ($no_op) {
     110    my $command = "$pswarp -list $listName $outputRoot -stat $outputStats"; # Command to run pswarp
    108111    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    109112        run(command => $command, verbose => 1);
     
    116119    &my_die("Couldn't find expected output file: $outputBin1", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1;
    117120    &my_die("Couldn't find expected output file: $outputBin2", $p4_id, $skycell_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2;
    118 }
    119121
    120 # Get the statistics on the warped image
    121 my $stats;                      # Statistics from pswarp
    122 {
     122    # Get the statistics on the warped image
    123123    my $statsFile;              # File handle
    124124    open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n";
    125125    my @contents = <$statsFile>; # Contents of file
    126126    close $statsFile;
    127     my $mdcParser = PS::IPP::Metadata::Config->new;     # Parser for metadata config files
    128127    my $metadata = $mdcParser->parse(join "", @contents)
    129128        or &my_die("Unable to parse metadata config", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    130     $stats = PS::IPP::Metadata::Stats->new(); # Stats parser
    131129    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $p4_id, $skycell_id, $PS_EXIT_PROG_ERROR);
    132130}
     
    137135$outputBin2  = $ipprc->convert_filename_relative( $outputBin2  );
    138136
     137my $bg = ($stats->bg_mean() or 'NAN');
     138my $bg_stdev = ($stats->bg_stdev() or 'NAN');
     139
    139140# Add the processed file to the database
    140141unless ($no_update) {
    141142    my $command = "$p4tool -warped -p4_id $p4_id -skycell_id $skycell_id" .
    142143        " -uri $outputImage -b1_uri $outputRoot";  # Command to run dettool
    143     $command .= " -bg " . $stats->bg_mean();
    144     $command .= " -bg_stdev " . $stats->bg_stdev();
     144    $command .= " -bg $bg -bg_stdev $bg_stdev";
    145145    $command .= " -dbname $dbname" if defined $dbname;
    146146
Note: See TracChangeset for help on using the changeset viewer.