Changeset 8609 for trunk/ippScripts/scripts/detrend_create_resid.pl
- Timestamp:
- Aug 25, 2006, 2:31:08 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_create_resid.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_create_resid.pl
r8511 r8609 24 24 }; 25 25 26 # Prefix to add to filenames 27 use 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 26 34 use constant DELETE_STATS => 0; # Delete the statistics file when done? 27 35 28 36 # Parse the command-line arguments 29 if (scalar @ARGV != 7) {37 if (scalar @ARGV != 8) { 30 38 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"; 32 40 } 33 41 my $detId = shift @ARGV; # Detrend ID 42 my $iter = shift @ARGV; # Iteration 34 43 my $expId = shift @ARGV; # Exposure ID 35 44 my $classId = shift @ARGV; # Class ID … … 51 60 my $detFlag = DETRENDS->{$detType}; 52 61 die "Unrecognised detrend type: $detType\n" if not defined $detFlag; 62 # Prefix to use for filename 63 my $prefix = PREFIX->{$detType}; 64 die "Unrecognised detrend type: $detType\n" if not defined $prefix; 53 65 54 66 ### 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'; 67 my $outputRoot = $prefix . '_' . $output; 68 my $outputName = $outputRoot . '.' . $classId . '.fit'; 69 my $outputStats = $outputRoot . '.' . $classId . '.stats'; 70 my $bin1Name = $outputRoot . '.' . $classId . '.b1.fit'; 71 my $bin2Name = $outputRoot . '.' . $classId . '.b2.fit'; 58 72 59 73 # Run ppImage 60 74 { 61 my $command = "$ppImage -file $input $output -recipe PPIMAGE $recipe" .62 " -stat $output .stats $detFlag $detrend"; # Command to run ppImage75 my $command = "$ppImage -file $input $outputRoot -recipe PPIMAGE $recipe" . 76 " -stat $outputStats $detFlag $detrend"; # Command to run ppImage 63 77 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 64 78 run(command => $command, verbose => 1); … … 73 87 { 74 88 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"; 76 90 my @contents = <$statsFile>; # Contents of file 77 91 close $statsFile; … … 84 98 # Add the processed file to the database 85 99 { 86 my $command = " dettool -addresidimfile -det_id $detId-exp_id $expId " .87 "-class_id $classId -recip e $recipe -uri $outputName -b1$bin1Name " .88 "-b2 $bin2Name"; # Command to run dettool100 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 89 103 $command .= " -bg " . $stats->bg_mean(); 90 104 $command .= " -bg_stdev " . $stats->bg_stdev();
Note:
See TracChangeset
for help on using the changeset viewer.
