IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 25, 2006, 2:31:08 PM (20 years ago)
Author:
Paul Price
Message:

Fixing file names, adding iteration parameter.

File:
1 edited

Legend:

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

    r8511 r8609  
    2424};
    2525
     26# Prefix to add to filenames
     27use constant PREFIX => {
     28    'bias' => 'ob',             # Overscan only
     29    'dark' => 'obd',            # Overscan and bias only
     30    'flat' => 'obdf',           # Overscan, bias and dark only
     31};
     32
     33
    2634use constant DELETE_STATS => 0; # Delete the statistics file when done?
    2735
    2836# Parse the command-line arguments
    29 if (scalar @ARGV != 7) {
     37if (scalar @ARGV != 8) {
    3038    die "Apply a stacked detrend image to an individual detrend.\n\n" .
    31         "Usage: $0 DET_ID EXP_ID CLASS_ID DETREND_TYPE DETREND.fits INPUT.fits OUTPUT_ROOT\n\n";
     39        "Usage: $0 DET_ID ITERATION EXP_ID CLASS_ID DETREND_TYPE DETREND.fits INPUT.fits OUTPUT_ROOT\n\n";
    3240}
    3341my $detId = shift @ARGV;        # Detrend ID
     42my $iter = shift @ARGV;         # Iteration
    3443my $expId = shift @ARGV;        # Exposure ID
    3544my $classId = shift @ARGV;      # Class ID
     
    5160my $detFlag = DETRENDS->{$detType};
    5261die "Unrecognised detrend type: $detType\n" if not defined $detFlag;
     62# Prefix to use for filename
     63my $prefix = PREFIX->{$detType};
     64die  "Unrecognised detrend type: $detType\n" if not defined $prefix;
    5365
    5466### Output file names --- must match camera configuration!
    55 my $outputName = $output . '.' . $classId . '.fit';
    56 my $bin1Name = $output . '.' . $classId . '.b1.fit';
    57 my $bin2Name =  $output . '.' . $classId . '.b2.fit';
     67my $outputRoot = $prefix . '_' . $output;
     68my $outputName = $outputRoot . '.' . $classId . '.fit';
     69my $outputStats = $outputRoot . '.' . $classId . '.stats';
     70my $bin1Name = $outputRoot . '.' . $classId . '.b1.fit';
     71my $bin2Name =  $outputRoot . '.' . $classId . '.b2.fit';
    5872
    5973# Run ppImage
    6074{
    61     my $command = "$ppImage -file $input $output -recipe PPIMAGE $recipe" .
    62         " -stat $output.stats $detFlag $detrend"; # Command to run ppImage
     75    my $command = "$ppImage -file $input $outputRoot -recipe PPIMAGE $recipe" .
     76        " -stat $outputStats $detFlag $detrend"; # Command to run ppImage
    6377    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6478        run(command => $command, verbose => 1);
     
    7387{
    7488    my $statsFile;              # File handle
    75     open $statsFile, "$output.stats" or die "Can't open statistics file $output.stats: $!\n";
     89    open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n";
    7690    my @contents = <$statsFile>; # Contents of file
    7791    close $statsFile;
     
    8498# Add the processed file to the database
    8599{
    86     my $command = "dettool -addresidimfile -det_id $detId -exp_id $expId " .
    87         "-class_id $classId -recipe $recipe -uri $outputName -b1 $bin1Name " .
    88         "-b2 $bin2Name"; # Command to run dettool
     100    my $command = "$dettool -addresidimfile -det_id $detId -iteration $iter -exp_id $expId " .
     101        "-class_id $classId -recip $recipe -uri $outputName -b1_uri $bin1Name " .
     102        "-b2_uri $bin2Name"; # Command to run dettool
    89103    $command .= " -bg " . $stats->bg_mean();
    90104    $command .= " -bg_stdev " . $stats->bg_stdev();
Note: See TracChangeset for help on using the changeset viewer.