Changeset 22430 for trunk/ippScripts/scripts/detrend_norm_apply.pl
- Timestamp:
- Feb 24, 2009, 12:00:25 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/detrend_norm_apply.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/detrend_norm_apply.pl
r19942 r22430 22 22 use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt ); 23 23 use Pod::Usage qw( pod2usage ); 24 25 # Look for programs we need 26 my $missing_tools; 27 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1); 28 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 29 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 30 if ($missing_tools) { 31 warn("Can't find required tools."); 32 exit($PS_EXIT_CONFIG_ERROR); 33 } 24 34 25 35 # Parse the command-line … … 54 64 defined $outroot; 55 65 66 # Unhandled exceptions should be passed on to my_die so they get pushed into the database 67 $SIG{__DIE__} = sub { die @_ if $^S; 68 my_die( $_[0], $det_id, $iter, $class_id, $PS_EXIT_UNKNOWN_ERROR ); }; 69 56 70 $ipprc->define_camera($camera); 57 71 58 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 72 my $logDest = $ipprc->filename("LOG.IMFILE", $outroot, $class_id) 59 73 or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR); 60 74 $ipprc->redirect_output($logDest) if $redirect; … … 64 78 # Define which detrend types we normalise 65 79 use constant DETTYPE => { 66 'bias' => 'bias',67 'dark' => 'dark',80 'bias' => 'bias', 81 'dark' => 'dark', 68 82 'dark_premask' => 'dark', 69 'shutter' => 'shutter',83 'shutter' => 'shutter', 70 84 'flat_premask' => 'flat', 71 85 'domeflat_premask' => 'flat', … … 73 87 'flat_raw' => 'flat', 74 88 'domeflat_raw' => 'flat', 75 'skyflat_raw' => 'flat', 76 'flat' => 'flat',77 'domeflat' => 'flat',78 'skyflat' => 'flat',79 'fringe' => 'fringe',80 'mask' => 'mask',81 'darkmask' => 'mask',82 'flatmask' => 'mask',83 }; 89 'skyflat_raw' => 'flat', 90 'flat' => 'flat', 91 'domeflat' => 'flat', 92 'skyflat' => 'flat', 93 'fringe' => 'fringe', 94 'mask' => 'mask', 95 'darkmask' => 'mask', 96 'flatmask' => 'mask', 97 }; 84 98 85 99 # convert supplied detrend type to a controlled namespace 86 100 &my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $class_id, $PS_EXIT_PROG_ERROR) unless exists DETTYPE()->{lc($det_type)}; 87 101 my $det_type_real = DETTYPE()->{lc($det_type)}; 88 89 # Look for programs we need90 my $missing_tools;91 my $dettool = can_run('dettool') or (warn "Can't find dettool" and $missing_tools = 1);92 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1);93 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);94 if ($missing_tools) {95 warn("Can't find required tools.");96 exit($PS_EXIT_CONFIG_ERROR);97 }98 102 99 103 &my_die("Couldn't find input file: $input_uri\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri); … … 124 128 # we cannot use ppImage to load a normalized mask : just copy it and build the jpeg images 125 129 if ($det_type_real eq 'mask') { 126 $RECIPE_PPIMAGE = 'PPIMAGE_BIN';127 my $input_real = $ipprc->file_resolve($input_uri, 0);128 my $output_real = $ipprc->file_resolve($output, 1);129 system ("cp $input_real $output_real");130 $RECIPE_PPIMAGE = 'PPIMAGE_BIN'; 131 my $input_real = $ipprc->file_resolve($input_uri, 0); 132 my $output_real = $ipprc->file_resolve($output, 1); 133 system ("cp $input_real $output_real"); 130 134 } 131 135 … … 162 166 } 163 167 foreach my $line (@$stdout_buf) { 164 $cmdflags .= " $line";168 $cmdflags .= " $line"; 165 169 } 166 170 chomp $cmdflags; … … 204 208 $command .= " -iteration $iter"; 205 209 $command .= " -class_id $class_id"; 206 $command .= " -path_base $outroot";210 $command .= " -path_base $outroot"; 207 211 $command .= " -code $exit_code"; 208 212 $command .= " -dbname $dbname" if defined $dbname;
Note:
See TracChangeset
for help on using the changeset viewer.
