IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2007, 10:25:51 AM (19 years ago)
Author:
Paul Price
Message:

Write determinations to log file.

File:
1 edited

Legend:

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

    r11837 r12673  
    121121my $reject_meanstdev = rejection_limit( 'ENSEMBLE.MEANSTDEV', $det_type, $filter );
    122122
    123 print "Ensemble mean " . $meanStats->mean() . " +/- " . $meanStats->standard_deviation .
    124     ", stdev " . $stdevStats->mean() . " +/- " . $stdevStats->standard_deviation() . "\n\n";
     123$workdir = $ipprc->convert_filename_absolute( $workdir );
     124
     125my $logName = "$camera.$det_type.$det_id.$iter.detreject.log"; # Name for log
     126$logName = File::Spec->catfile( $workdir, $logName );
     127my $logFile;
     128unless ($no_op) {
     129    open $logFile, "> $logName" or &my_die("Unable to open log file $logName.\n", $det_id, $iter, $PS_EXIT_SYS_ERROR);
     130    print $logFile "Ensemble mean " . $meanStats->mean() . " +/- " . $meanStats->standard_deviation .
     131        ", stdev " . $stdevStats->mean() . " +/- " . $stdevStats->standard_deviation() . "\n\n";
     132}
    125133
    126134# Go through again to do rejection, and update the database for each exposure
     
    139147    if (not $accept[$i]) {
    140148        # Rejected this at an earlier stage
    141         print "Rejecting $expTag based on earlier determination.\n";
     149        unless ($no_op) {
     150            print $logFile "Rejecting $expTag based on earlier determination.\n";
     151        }
    142152        $reject = 1;
    143153        goto UPDATE;
     
    157167        my $dMean = abs($means[$i] - $meanStats->mean()) ;
    158168        if ($dMean > ($reject_mean * $meanStats->standard_deviation())) {
    159             print "Rejecting $expTag based on outlier mean value: " .
     169            print $logFile "Rejecting $expTag based on ensemble mean value: " .
    160170                "$means[$i] --> $dMean vs " . $reject_mean * $meanStats->standard_deviation() . "\n";
    161171            $reject = 1;
    162             goto UPDATE;
     172            #goto UPDATE;
    163173        }
    164174    } else {
    165         print "no rejection for exposure mean\n";
     175        print $logFile "No rejection for ensemble mean\n";
    166176    }
    167177
     
    169179        my $dMean = abs($stdevs[$i] - $stdevStats->mean());
    170180        if ($dMean > ($reject_stdev * $stdevStats->standard_deviation())) {
    171             print "Rejecting $expTag based on outlier stdev: " .
     181            print $logFile "Rejecting $expTag based on ensemble stdev: " .
    172182                $stdevs[$i] . " --> $dMean sigma vs " . $reject_stdev . "\n";
    173183            $reject = 1;
    174             goto UPDATE;
     184            #goto UPDATE;
    175185        }
    176186    } else {
    177         print "no rejection for exposure stdev\n";
     187        print $logFile "No rejection for ensemble stdev\n";
    178188    }
    179189   
     
    181191        my $dMean = abs($meanStdevs[$i] - $meanStdevStats->mean());
    182192        if ($dMean > ($reject_meanstdev * $meanStdevStats->standard_deviation())) {
    183             print "Rejecting $expTag based on outlier mean stdev: " .
     193            print $logFile "Rejecting $expTag based on ensemble mean stdev: " .
    184194                $meanStdevs[$i] . " --> $dMean sigma vs " . $reject_meanstdev . "\n";
    185195            $reject = 1;
    186             goto UPDATE;
     196            #goto UPDATE;
    187197        }
    188198    } else {
    189         print "no rejection for exposure mean stdev\n";
     199        print $logFile "No rejection for ensemble mean stdev\n";
    190200    }
    191201
     
    198208    # Check for status changes
    199209    if ((not $include[$i] and not $reject) or ($include[$i] and $reject)) {
    200         print "Status of $expTag has changed.\n";
     210        unless ($no_op) {
     211            print $logFile "Status of $expTag has changed.\n";
     212        }
    201213        $numChanges++;
    202214    }
     
    228240}
    229241
    230 print "Master: $master\n";
    231 print "Stop: $stop\n";
     242unless ($no_op) {
     243    print $logFile "Master: $master\n";
     244    print $logFile "Stop: $stop\n";
     245    close $logFile;
     246}
    232247
    233248# Put results into the database
Note: See TracChangeset for help on using the changeset viewer.