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_imfile.pl

    r11829 r11837  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($det_id, $iter, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $no_update);
     35my ($det_id, $iter, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $no_update, $no_op);
    3636GetOptions(
    3737           'det_id|d=s'        => \$det_id,
     
    4545           'workdir|w=s'       => \$workdir, # Working directory, for output files
    4646           'no-update'         => \$no_update,
     47           'no-op'             => \$no_op,
    4748           ) or pod2usage( 2 );
    4849
     
    129130my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
    130131
    131 # Make the jpeg for binning 1
    132 {
    133     my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
    134     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    135         run(command => $command, verbose => 1);
    136     unless ($success) {
    137         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    138         &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code);
    139     }
    140     &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1Name;
    141 }
    142 
    143 # Make the jpeg for binning 2
    144 {
    145     my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
    146     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    147         run(command => $command, verbose => 1);
    148     unless ($success) {
    149         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    150         &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code);
    151     }
    152     &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2Name;
     132unless ($no_op) {
     133
     134    # Make the jpeg for binning 1
     135    {
     136        my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
     137        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     138            run(command => $command, verbose => 1);
     139        unless ($success) {
     140            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     141            &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code);
     142        }
     143        &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg1Name;
     144    }
     145   
     146    # Make the jpeg for binning 2
     147    {
     148        my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
     149        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     150            run(command => $command, verbose => 1);
     151        unless ($success) {
     152            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     153            &my_die("Unable to run ppImage: $error_code", $det_id, $iter, $exp_tag, $error_code);
     154        }
     155        &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $exp_tag, $PS_EXIT_SYS_ERROR) unless -f $jpeg2Name;
     156    }
    153157}
    154158
     
    172176    my $stdev = sqrt($variances[$i]);   # Stdev for this imfile
    173177
     178    last if $no_op;
     179
    174180    if ($reject_imfile_mean) {
    175181        if (abs($mean) > $reject_imfile_mean * $stdev) {
     
    212218        print "no rejection for imfile S/N\n";
    213219    }
    214    
    215220}
    216221
     
    235240## Reject based on the exposure ensemble stats
    236241# reject if the exposure ensemble mean is deviant
    237 if ($reject_exp_mean) {
    238     if (abs($mean) > $reject_exp_mean * $stdev) {
    239         print "Rejecting exposure based on bad mean: \n";
    240         print "mean: $mean, stdev: $stdev (limit is: % $reject_exp_mean\n";
    241         $reject = 1;
    242     }
    243 } else {
    244     print "no rejection for exp mean\n";
    245 }
    246 # reject if the exposure ensemble stdev is deviant
    247 if ($reject_exp_stdev) {
    248     if ($stdev > $reject_exp_stdev) {
    249         print "Rejecting exposure based on bad mean stdev: " . $stdev . " vs " .
    250             $reject_exp_stdev . "\n";
    251         $reject = 1;
    252     }
    253 } else {
    254     print "no rejection for exp stdev\n";
    255 }
    256 # reject if the exposure ensemble mean stdev is deviant
    257 if ($reject_exp_meanstdev) {
    258     if ($meanStdev > $reject_exp_meanstdev) {
    259         print "Rejecting exposure based on bad mean stdev: " . $meanStdev . " vs " .
    260             $reject_exp_meanstdev . "\n";
    261         $reject = 1;
    262     }
    263 } else {
    264     print "no rejection for exp mean stdev\n";
    265 }
    266 # reject if the signal-to-noise is insufficient
    267 if ($reject_exp_sn) {
    268     if (abs($mean) < abs($stdev * $reject_exp_sn)) {
    269         print "Rejecting exposure based on poor S/N: \n";
    270         print "signal: $mean vs noise: $stdev (s/n limit is: $reject_exp_sn)\n";
    271         $reject = 1;
    272     }
    273 } else {
    274     print "no rejection for exp S/N\n";
     242unless ($no_op) {
     243    if ($reject_exp_mean) {
     244        if (abs($mean) > $reject_exp_mean * $stdev) {
     245            print "Rejecting exposure based on bad mean: \n";
     246            print "mean: $mean, stdev: $stdev (limit is: % $reject_exp_mean\n";
     247            $reject = 1;
     248        }
     249    } else {
     250        print "no rejection for exp mean\n";
     251    }
     252    # reject if the exposure ensemble stdev is deviant
     253    if ($reject_exp_stdev) {
     254        if ($stdev > $reject_exp_stdev) {
     255            print "Rejecting exposure based on bad mean stdev: " . $stdev . " vs " .
     256                $reject_exp_stdev . "\n";
     257            $reject = 1;
     258        }
     259    } else {
     260        print "no rejection for exp stdev\n";
     261    }
     262    # reject if the exposure ensemble mean stdev is deviant
     263    if ($reject_exp_meanstdev) {
     264        if ($meanStdev > $reject_exp_meanstdev) {
     265            print "Rejecting exposure based on bad mean stdev: " . $meanStdev . " vs " .
     266                $reject_exp_meanstdev . "\n";
     267            $reject = 1;
     268        }
     269    } else {
     270        print "no rejection for exp mean stdev\n";
     271    }
     272    # reject if the signal-to-noise is insufficient
     273    if ($reject_exp_sn) {
     274        if (abs($mean) < abs($stdev * $reject_exp_sn)) {
     275            print "Rejecting exposure based on poor S/N: \n";
     276            print "signal: $mean vs noise: $stdev (s/n limit is: $reject_exp_sn)\n";
     277            $reject = 1;
     278        }
     279    } else {
     280        print "no rejection for exp S/N\n";
     281    }
    275282}
    276283
     
    278285$jpeg1Name = $ipprc->convert_filename_relative( $jpeg1Name );
    279286$jpeg2Name = $ipprc->convert_filename_relative( $jpeg2Name );
     287
     288my $bg = $mean;
     289my $bg_stdev = $stdev;
     290my $bg_mean_stdev = $meanStdev;
     291
    280292unless ($no_update) {
    281293    my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_tag $exp_tag " .
    282         "-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $outputRoot " .
    283         "-bg $mean -bg_stdev $stdev -bg_mean_stdev $meanStdev"; # Command to run
     294        "-recip " . RECIPE1() . "," . RECIPE2() . " -b1_uri $outputRoot "; # Command to run
     295    $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
    284296    $command .= ' -reject' if $reject;
    285297    $command .= " -dbname $dbname" if defined $dbname;
Note: See TracChangeset for help on using the changeset viewer.