Changeset 14048 for trunk/ippScripts/scripts/detrend_norm_exp.pl
- Timestamp:
- Jul 6, 2007, 3:44:38 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_norm_exp.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_norm_exp.pl
r14009 r14048 16 16 use IPC::Cmd 0.36 qw( can_run run ); 17 17 use PS::IPP::Metadata::Config; 18 use PS::IPP::Metadata::Stats; 19 18 20 use PS::IPP::Metadata::List qw( parse_md_list ); 19 21 use File::Temp qw( tempfile ); … … 33 35 use Pod::Usage qw( pod2usage ); 34 36 35 my ($det_id, $iter, $det_type, $camera, $dbname, $workdir, $ no_update, $no_op);37 my ($det_id, $iter, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op); 36 38 GetOptions( 37 'det_id|d=s' => \$det_id, 38 'iteration|i=s' => \$iter, 39 'camera|c=s' => \$camera, 40 'det_type|t=s' => \$det_type, 41 'dbname|d=s' => \$dbname, # Database name 42 'workdir|w=s' => \$workdir, # Working directory, for output files 43 'no-update' => \$no_update, 44 'no-op' => \$no_op, 45 ) or pod2usage( 2 ); 39 'det_id|d=s' => \$det_id, 40 'iteration|i=s' => \$iter, 41 'camera|c=s' => \$camera, 42 'det_type|t=s' => \$det_type, 43 'dbname|d=s' => \$dbname, # Database name 44 'workdir|w=s' => \$workdir, # Working directory, for output files 45 'reduction|=s' => \$reduction, 46 'no-update' => \$no_update, 47 'no-op' => \$no_op, 48 ) or pod2usage( 2 ); 46 49 47 50 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; … … 58 61 $reduction = 'DETREND' unless defined $reduction; 59 62 60 my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_IMAGE ' . uc($det_type); # Recipe to use63 my $recipe1 = $ipprc->reduction($reduction, 'JPEG_BIN1_IMAGE_' . uc($det_type)); # Recipe to use 61 64 &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe1; 62 65 63 my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_IMAGE ' . uc($det_type); # Recipe to use66 my $recipe2 = $ipprc->reduction($reduction, 'JPEG_BIN2_IMAGE_' . uc($det_type)); # Recipe to use 64 67 &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $PS_EXIT_PROG_ERROR) unless defined $recipe2; 65 68 … … 69 72 # XXX (A) if imfile.Ncomp > 1, (B) if imfile.Ncomp == 1 70 73 my $STATS = 71 [72 # KEYWORD STATISTIC CHIPTOOL FLAG73 { name => "bg", type => "mean", flag => "-bg" },74 { name => "bg", type => "stdev", flag => "-bg_mean_stdev" },75 { name => "bg_stdev", type => "rms", flag => "-bg_stdev" },76 # { name => "bg_mean_stdev", type => "rms", flag => "-bg_mean_stdev" },77 ];74 [ 75 # KEYWORD STATISTIC CHIPTOOL FLAG 76 { name => "bg", type => "mean", flag => "-bg" }, 77 { name => "bg", type => "stdev", flag => "-bg_mean_stdev" }, 78 { name => "bg_stdev", type => "rms", flag => "-bg_stdev" }, 79 # { name => "bg_mean_stdev", type => "rms", flag => "-bg_mean_stdev" }, 80 ]; 78 81 79 82 # Look for programs we need … … 87 90 88 91 # Get list of component files 89 my $files; # Array of component files92 my ($files, $command, $success, $error_code, $full_buf, $stdout_buf, $stderr_buf); 90 93 { 91 my $command= "$dettool -normalizedimfile -det_id $det_id -iteration $iter"; # Command to run94 $command = "$dettool -normalizedimfile -det_id $det_id -iteration $iter"; # Command to run 92 95 $command .= " -dbname $dbname" if defined $dbname; 93 my( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =96 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 94 97 run(command => $command, verbose => 1); 95 98 unless ($success) { … … 131 134 unless ($no_op) { 132 135 # Make the jpeg for binning 1 133 { 134 my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run 135 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 136 run(command => $command, verbose => 1); 137 &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg1Name); 138 } 136 $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run 137 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 138 run(command => $command, verbose => 1); 139 &my_die("Unable to find expected output file: $jpeg1Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg1Name); 139 140 140 141 # Make the jpeg for binning 2 141 { 142 my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run 143 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 144 run(command => $command, verbose => 1); 145 &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg2Name); 146 } 142 $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run 143 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 144 run(command => $command, verbose => 1); 145 &my_die("Unable to find expected output file: $jpeg2Name", $det_id, $iter, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($jpeg2Name); 146 147 147 } 148 148 149 149 # command to update the database 150 my $command= "$dettool -addnormalizedexp";150 $command = "$dettool -addnormalizedexp"; 151 151 $command .= " -det_id $det_id"; 152 152 $command .= " -iteration $iter"; … … 164 164 # Add the processed file to the database 165 165 unless ($no_update) { 166 my( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =166 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 167 167 run(command => $command, verbose => 1); 168 168 unless ($success) {
Note:
See TracChangeset
for help on using the changeset viewer.
