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/detrend_reject_exp.pl

    r11829 r11837  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update);
     34my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update, $no_op);
    3535GetOptions(
    3636           'det_id|d=s'        => \$det_id,
     
    4141           'workdir|w=s'       => \$workdir, # Working directory for output files
    4242           'dbname|d=s'        => \$dbname, # Database name
    43            'no-update'         => \$no_update
     43           'no-update'         => \$no_update,
     44           'no-op'             => \$no_op,
    4445) or pod2usage( 2 );
    4546
     
    133134    $command = "$dettool -updateresidexp -det_id $det_id -iteration $iter -exp_tag $expTag"; # Command to run
    134135    $command .= " -dbname $dbname" if defined $dbname;
    135 
     136   
    136137    $reject = 0;                # Reject this exposure?
    137138
     
    143144    }
    144145
     146    # Cop-out if we're not doing any operations
     147    if ($no_op) {
     148        # Make sure something gets rejected (just once!), just so that
     149        # we can trace the full range of the workflow
     150        if ($i == 0 and $iter == 0) {
     151            $reject = 1;
     152        }
     153        goto UPDATE;
     154    }
     155   
    145156    if ($reject_mean and defined $meanStats->standard_deviation() ) {
    146157        my $dMean = abs($means[$i] - $meanStats->mean()) ;
     
    201212    }
    202213}
    203    
     214
    204215# Decide if the current is sufficient to use as a master, and if we can stop iterating
    205216my $master = 1;                 # This is good enough for a master
     
    220231print "Stop: $stop\n";
    221232
    222 # Put the result into the database
     233# Put results into the database
    223234unless ($no_update) {
    224     my $varianceStats = Statistics::Descriptive::Sparse->new(); # Statistics calculator
    225     $varianceStats->add_data(@variances);
    226 
    227     my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter" .
    228         " -bg " . $meanStats->mean() . " -bg_stdev " . sqrt($varianceStats->mean()) .
    229         " -bg_mean_stdev " . $meanStats->standard_deviation();
    230     $command .= " -accept" if $master;
    231     $command .= " -dbname $dbname" if defined $dbname;
    232 
    233     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    234         run(command => $command, verbose => 1);
    235     unless ($success) {
    236         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    237         warn("Unable to perform dettool -adddetrunsummary: $error_code");
    238         exit($error_code);
    239     }
    240 }
    241 
    242 # Re-run processing if required
    243 unless ($no_update) {
    244     my $command = "$dettool -updatedetrun -det_id $det_id";
    245     if ($stop) {
    246         $command .= ' -state stop';
    247     } else {
    248         $command .= ' -again';
    249     }
    250    
    251     $command .= " -dbname $dbname" if defined $dbname;
    252    
    253     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    254         run(command => $command, verbose => 1);
    255     unless ($success) {
    256         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    257         warn("Unable to perform dettool -updatedetrun: $error_code");
    258         exit($error_code);
     235
     236    {
     237        # Add the summary
     238        my $varianceStats = Statistics::Descriptive::Sparse->new(); # Statistics calculator
     239        $varianceStats->add_data(@variances);
     240       
     241        my $bg = ($meanStats->mean() or 'NAN');
     242        my $bg_stdev = (sqrt( $varianceStats->mean() ) or 'NAN');
     243        my $bg_mean_stdev = ($meanStats->standard_deviation() or 'NAN');
     244       
     245        my $command = "$dettool -adddetrunsummary -det_id $det_id -iteration $iter";
     246        $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
     247        $command .= " -accept" if $master;
     248        $command .= " -dbname $dbname" if defined $dbname;
     249       
     250        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     251            run(command => $command, verbose => 1);
     252        unless ($success) {
     253            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     254            warn("Unable to perform dettool -adddetrunsummary: $error_code");
     255            exit($error_code);
     256        }
     257    }
     258
     259    # Re-run processing if required
     260    {
     261        my $command = "$dettool -updatedetrun -det_id $det_id";
     262        if ($stop) {
     263            $command .= ' -state stop';
     264        } else {
     265            $command .= ' -again';
     266        }
     267       
     268        $command .= " -dbname $dbname" if defined $dbname;
     269       
     270        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     271            run(command => $command, verbose => 1);
     272        unless ($success) {
     273            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     274            warn("Unable to perform dettool -updatedetrun: $error_code");
     275            exit($error_code);
     276        }
    259277    }
    260278}
Note: See TracChangeset for help on using the changeset viewer.