- Timestamp:
- Oct 24, 2012, 3:52:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20120905/ippScripts/scripts/publish_file.pl
r30376 r34566 32 32 my $pubtool = can_run('pubtool') or (warn "Can't find pubtool" and $missing_tools = 1); 33 33 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 34 my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); 34 35 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 35 36 my $ppMops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1); … … 44 45 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic ); 45 46 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect ); 46 my ( $output_format );47 my ( $output_format, $difftype ); 47 48 48 49 GetOptions( … … 72 73 defined $stage and 73 74 defined $stage_id and 74 defined $workdir; 75 defined $workdir and 76 defined $dbname; 75 77 76 78 my $outroot = "$workdir/$product.$pub_id"; # Output root name … … 166 168 my %negative; # Data for negative diff detections 167 169 foreach my $comp ( @$components ) { 168 my $path_base = $comp->{path_base}; # Base name for file170 my $path_base = $comp->{path_base}; # Base name for file 169 171 if (!$need_magic and $comp->{magicked}) { 170 172 # This client is authorized to receive uncensored detections … … 194 196 195 197 $filename = $resolved; 198 199 my $cam_id = $comp->{cam_id_1}; 200 #print "Getting info from camera stage $cam_id\n"; 201 my $cam_command = "$camtool -processedexp -cam_id $cam_id"; 202 $cam_command .= " -dbname $dbname" if defined $dbname; 203 my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) = 204 run(command => $cam_command, verbose => $verbose); 205 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success; 206 my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or 207 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 208 my $cam_components = parse_md_list($cam_metadata) or 209 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 210 &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1; 211 my $cam_comp = $$cam_components[0]; 212 213 my $exp_id = $comp->{exp_id_1}; 214 #print "Getting info from raw stage $exp_id\n"; 215 my $reg_command = "$regtool -processedimfile -exp_id $exp_id"; 216 $reg_command .= " -dbname $dbname" if defined $dbname; 217 my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) = 218 run(command => $reg_command, verbose => $verbose); 219 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success; 220 my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or 221 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 222 my $reg_components = parse_md_list($reg_metadata) or 223 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 224 my $reg_comp = $$reg_components[0]; 225 226 # Now get the difftype value from diff->{diff_mode} 227 my $difftype = ""; 228 if ($comp->{diff_mode} == 1) { 229 $difftype = "WW"; 230 } elsif ($comp->{diff_mode} == 2) { 231 $difftype = "WS"; 232 } elsif ($comp->{diff_mode} == 3) { 233 $difftype = "SW"; # Not used yet 234 } elsif ($comp->{diff_mode} == 4) { 235 $difftype = "SS"; 236 } else { 237 $difftype = "Unsupported diff_mode value: [" . $comp->{diff_mode} . "]"; 238 } 196 239 197 240 my $data = { zp => $zp, … … 207 250 output_format => $comp->{output_format}, 208 251 direction => 1, 252 comment => $reg_comp->{comment}, 253 obsmode => $reg_comp->{obs_mode}, 254 difftype => $difftype, 255 sky => $cam_comp->{bg}, 256 shutoutc => $reg_comp->{dateobs}, 209 257 }; 210 258 259 #warn("Checking for positive"); 211 260 diff_check(\%positive, $data, "positive"); 212 261 … … 239 288 diff_id => $comp->{diff_id}, 240 289 direction => 0, 290 comment => $reg_comp->{comment}, 291 obsmode => $reg_comp->{obs_mode}, 292 difftype => $difftype, 293 sky => $cam_comp->{bg}, 294 shutoutc => $reg_comp->{dateobs}, 241 295 }; 242 296 297 #warn("Checking for negative"); 243 298 diff_check(\%negative, $data, "negative"); 244 299 … … 288 343 &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success; 289 344 } 290 291 292 345 293 346 ### Pau. … … 311 364 $data->{diff_id} = $comp->{diff_id} unless defined $data->{diff_id}; 312 365 $data->{direction} = $comp->{direction} unless defined $data->{direction}; 366 $data->{comment} = $comp->{comment} unless defined $data->{comment}; 367 $data->{obsmode} = $comp->{obsmode} unless defined $data->{obsmode}; 368 $data->{difftype} = $comp->{difftype} unless defined $data->{difftype}; 369 $data->{sky} = $comp->{sky} unless defined $data->{sky}; 370 $data->{shutoutc} = $comp->{shutoutc} unless defined $data->{shutoutc}; 313 371 314 372 &my_die("zp value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{zp} and $comp->{zp} != $data->{zp}; … … 323 381 &my_die("diff_id value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{diff_id} and $comp->{diff_id} != $data->{diff_id}; 324 382 &my_die("direction value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{direction} and $comp->{direction} != $data->{direction}; 383 &my_die("comment value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{comment} and $comp->{comment} ne $data->{comment}; 384 &my_die("obsmode value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{obsmode} and $comp->{obsmode} ne $data->{obsmode}; 385 &my_die("difftype value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{difftype} and $comp->{difftype} ne $data->{difftype}; 386 &my_die("sky value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{sky} and $comp->{sky} != $data->{sky}; 387 &my_die("shutoutc value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{shutoutc} and $comp->{shutoutc} ne $data->{shutoutc}; 325 388 326 389 return 1; … … 350 413 $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom}; 351 414 $command .= " -version " . $data->{output_format} if defined $data->{output_format}; 415 $command .= " -comment \"" . $data->{comment} . "\"" if defined $data->{comment}; 416 $command .= " -obsmode " . $data->{obsmode} if defined $data->{obsmode}; 417 $command .= " -difftype " . $data->{difftype} if defined $data->{difftype}; 418 $command .= " -sky " . $data->{sky} if defined $data->{sky}; 419 $command .= " -shutoutc \"" . $data->{shutoutc} . "\"" if defined $data->{shutoutc}; 352 420 353 421 unless ($no_op) {
Note:
See TracChangeset
for help on using the changeset viewer.
