Changeset 12213 for trunk/ippScripts/scripts/camera_exp.pl
- Timestamp:
- Mar 2, 2007, 5:37:28 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/camera_exp.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/camera_exp.pl
r12079 r12213 33 33 use Pod::Usage qw( pod2usage ); 34 34 35 my ($exp_ tag, $camera, $dbname, $workdir, $no_update, $no_op);35 my ($exp_id, $cam_id, $camera, $dbname, $workdir, $no_update, $no_op); 36 36 GetOptions( 37 'exp_tag|e=s' => \$exp_tag, 38 'camera|c=s' => \$camera, 39 'dbname|d=s' => \$dbname, # Database name 40 'workdir|w=s' => \$workdir, 41 'no-update' => \$no_update, 42 'no-op' => \$no_op, 43 ) or pod2usage( 2 ); 37 'exp_id=s' => \$exp_id, # Exposure identifier 38 'cam_id=s' => \$cam_id, # Camtool identifier 39 'camera|c=s' => \$camera, # Camera 40 'dbname|d=s' => \$dbname, # Database name 41 'workdir|w=s' => \$workdir, # Working directory 42 'no-update' => \$no_update, # Update the database? 43 'no-op' => \$no_op, # Don't do any operations? 44 ) or pod2usage( 2 ); 44 45 45 46 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 46 47 pod2usage( 47 -msg => "Required options: --exp_ tag--camera",48 -msg => "Required options: --exp_id --cam_id --camera", 48 49 -exitval => 3, 49 ) unless defined $exp_tag 50 ) unless defined $exp_id 51 and defined $cam_id 50 52 and defined $camera; 51 53 … … 75 77 my $files; # Array of component files 76 78 { 77 my $command = "$camtool -pendingimfile - exp_tag $exp_tag"; # Command to run79 my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run 78 80 $command .= " -dbname $dbname" if defined $dbname; 79 81 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 81 83 unless ($success) { 82 84 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 83 &my_die("Unable to perform camtool: $error_code", $ exp_tag, $error_code);85 &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code); 84 86 } 85 87 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 86 &my_die("Unable to parse metadata config doc", $ exp_tag, $PS_EXIT_PROG_ERROR);88 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR); 87 89 $files = parse_md_list($metadata) or 88 &my_die("Unable to parse metadata list", $ exp_tag, $PS_EXIT_PROG_ERROR);90 &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR); 89 91 } 90 92 … … 98 100 # my @zp; # Array of photometric zero points 99 101 foreach my $file (@$files) { 100 &my_die("Unable to find class id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id};102 &my_die("Unable to find class id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{class_id}; 101 103 my $class_id = $file->{class_id}; 102 &my_die("Unable to find bg for class_id=$class_id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg};103 &my_die("Unable to find bg_mean_stdev for class_id=$class_id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev};104 # &my_die("Unable to find sigma_ra for class_id=$class_id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra};105 # &my_die("Unable to find sigma_dec for class_id=$class_id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec};106 # &my_die("Unable to find zp for class_id=$class_id", $ exp_tag, $PS_EXIT_SYS_ERROR) unless defined $file->{zp};104 &my_die("Unable to find bg for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg}; 105 &my_die("Unable to find bg_mean_stdev for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{bg_mean_stdev}; 106 # &my_die("Unable to find sigma_ra for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_ra}; 107 # &my_die("Unable to find sigma_dec for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{sigma_dec}; 108 # &my_die("Unable to find zp for class_id=$class_id", $cam_id, $PS_EXIT_SYS_ERROR) unless defined $file->{zp}; 107 109 push @backgrounds, $file->{bg}; 108 110 push @variances, $file->{bg_stdev}**2; … … 129 131 $workdir = $dir; 130 132 } 133 134 $workdir = File::Spec->catfile( $workdir, $exp_id ); 131 135 system "mkdir -p $workdir" unless -d $workdir; 132 136 133 # make this a function which generates a specific list file for a specific filename134 135 137 # Generate the file list, and get the statistics 136 my $outputFile = "$exp_ tag.cam";138 my $outputFile = "$exp_id.cam$cam_id"; 137 139 my $outputRoot = File::Spec->catfile( $workdir, $outputFile ); 138 140 … … 182 184 unless ($success) { 183 185 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 184 &my_die("Unable to perform psastro: $error_code", $ exp_tag, $error_code);185 } 186 &my_die("Unable to find expected output file: $fpaObjects", $ exp_tag, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects;186 &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code); 187 } 188 &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $fpaObjects; 187 189 } else { 188 190 $fpaObjects = $chipObjects; … … 198 200 unless ($success) { 199 201 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 200 &my_die("Unable to perform addstar: $error_code", $ exp_tag, $error_code);202 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code); 201 203 } 202 204 } … … 209 211 unless ($success) { 210 212 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 211 &my_die("Unable to perform ppImage: $error_code", $ exp_tag, $error_code);212 } 213 &my_die("Unable to find expected output file: $jpeg1", $ exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg1;213 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code); 214 } 215 &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg1; 214 216 } 215 217 … … 221 223 unless ($success) { 222 224 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 223 &my_die("Unable to perform ppImage: $error_code", $ exp_tag, $error_code);224 } 225 &my_die("Unable to find expected output file: $jpeg2", $ exp_tag, $PS_EXIT_PROG_ERROR) unless -f $jpeg2;225 &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code); 226 } 227 &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $jpeg2; 226 228 } 227 229 } … … 232 234 233 235 unless ($no_update) { 234 my $command = "$camtool -addprocessedexp - exp_tag $exp_tag-uri UNKNOWN " .236 my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN " . 235 237 "-recip " . RECIPE1() . "," . RECIPE2() . " -path_base $outputRoot " . 236 238 "-bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev " . … … 253 255 { 254 256 my $msg = shift; # Warning message on die 255 my $ exp_tag = shift; # Exposure tag257 my $cam_id = shift; # Camtool identifier 256 258 my $exit_code = shift; # Exit code to add 257 259 258 260 warn($msg); 259 if ($ exp_tagand not $no_update) {260 my $command = "$camtool -addprocessedexp - exp_tag $exp_tag-code $exit_code";261 if ($cam_id and not $no_update) { 262 my $command = "$camtool -addprocessedexp -cam_id $cam_id -code $exit_code"; 261 263 $command .= " -dbname $dbname" if defined $dbname; 262 264 system ($command);
Note:
See TracChangeset
for help on using the changeset viewer.
