Changeset 32538
- Timestamp:
- Oct 12, 2011, 10:57:46 AM (15 years ago)
- Location:
- tags/ipp-20110622
- Files:
-
- 7 edited
-
ippScripts/scripts/magic_destreak.pl (modified) (7 diffs, 1 prop)
-
ippTasks/destreak.pro (modified) (2 diffs, 1 prop)
-
ippTools/share/magicdstool_todestreak_camera.sql (modified) (1 diff, 1 prop)
-
ippTools/share/magicdstool_todestreak_chip.sql (modified) (1 diff, 1 prop)
-
ippTools/share/magicdstool_todestreak_diff.sql (modified) (2 diffs, 1 prop)
-
ippTools/share/magicdstool_todestreak_raw.sql (modified) (1 diff, 1 prop)
-
ippTools/share/magicdstool_todestreak_warp.sql (modified) (2 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20110622/ippScripts/scripts/magic_destreak.pl
- Property svn:mergeinfo set to
r32401 r32538 35 35 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 36 36 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 37 my $dvoImageOverlaps = can_run('dvoImageOverlaps') or (warn "Can't find dvoImageOverlaps" and $missing_tools = 1); 37 38 if ($missing_tools) { 38 39 warn("Can't find required tools."); … … 45 46 my ($outroot, $recoveryroot, $magicked); 46 47 my ($replace, $release); 48 my ($diff_tess_id, $mismatched_tess); 47 49 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 48 50 … … 60 62 'stage_id=s' => \$stage_id, # exp_id, chip_id, warp_id, or diff_id 61 63 'component=s' => \$component, # the class_id or skycell_id 64 'mismatched_tess'=> \$mismatched_tess, # true if tess_id of input does not match tess_id of the diff used for magic 65 'diff_tess_id=s' => \$diff_tess_id, # tess_id of diffRun used to compute the streaks 62 66 'uri=s' => \$uri, # uri of the input image 63 67 'path_base=s' => \$path_base, # path_base of the input … … 106 110 if (($stage eq "raw") or ($stage eq "chip") or $stage eq "chip_bg") { 107 111 $class_id = $component; 108 $skycell_args = " -class_id $component";112 $skycell_args = " -class_id"; 109 113 } elsif ($stage eq "warp" or $stage eq "warp_bg") { 110 114 $skycell_id = $component; 111 $skycell_args = " -skycell_id $component";115 $skycell_args = " -skycell_id"; 112 116 } elsif ($stage eq "diff") { 113 117 $skycell_id = $component; … … 215 219 my ($sfh, $skycell_list); 216 220 if ($skycell_args) { 217 my $command = "$magicdstool -magic_ds_id $magic_ds_id -getskycells $skycell_args"; 218 $command .= " -dbname $dbname" if defined $dbname; 219 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 220 run(command => $command, verbose => $verbose); 221 unless ($success) { 222 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 223 &my_die("Unable to perform magicdstool -diffskyfile $skycell_args: $error_code", $magic_ds_id, $component, $error_code); 224 } 225 226 my $getskycells_output = join "", @$stdout_buf; 227 if ($getskycells_output) { 228 my $metadata = $mdcParser->parse($getskycells_output) or 229 &my_die("Unable to parse metadata config doc", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 230 231 my $skycells = parse_md_list($metadata) or 232 &my_die("Unable to parse metadata list", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 233 234 ($sfh, $skycell_list) = tempfile( "/tmp/skycell_list.XXXX", UNLINK => !$save_temps); 235 236 foreach my $skycell (@$skycells) { 237 my $skycell_uri; 238 if ($skycell->{data_state} eq "full" and $skycell->{quality} = 0) { 239 $skycell_uri = $ipprc->filename("PPSUB.OUTPUT", $skycell->{path_base}); 240 } else { 241 # diff run must have been cleaned up, need to create this skycell file on the fly 242 if (!defined $temp_dir ) { 243 $temp_dir = tempdir( CLEANUP => !$save_temps); 221 my $command = "$magicdstool -magic_ds_id $magic_ds_id -getskycells"; 222 $command .= " $skycell_args"; 223 my @diff_components; 224 if ($mismatched_tess) { 225 # tessellation for this skycell does not match the tessellation used for the magic analysis 226 # used to calculate the streaks file 227 @diff_components = get_overlaps($path_base, $component, $diff_tess_id); 228 } else { 229 @diff_components = ($component); 230 } 231 232 # hash of uris by skycell. 233 my %diff_skycells; 234 foreach my $component (@diff_components) { 235 my $this_command = "$command $component"; 236 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 237 run(command => $this_command, verbose => $verbose); 238 unless ($success) { 239 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 240 &my_die("Unable to perform magicdstool -diffskyfile $skycell_args: $error_code", $magic_ds_id, $component, $error_code); 241 } 242 243 my $getskycells_output = join "", @$stdout_buf; 244 if ($getskycells_output) { 245 my $metadata = $mdcParser->parse($getskycells_output) or 246 &my_die("Unable to parse metadata config doc", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 247 248 my $skycells = parse_md_list($metadata) or 249 &my_die("Unable to parse metadata list", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 250 251 foreach my $skycell (@$skycells) { 252 my $skycell_uri; 253 if ($skycell->{data_state} eq "full" and $skycell->{quality} == 0) { 254 $skycell_uri = $ipprc->filename("PPSUB.OUTPUT", $skycell->{path_base}); 255 $diff_skycells{$skycell_id} = $skycell_uri; 256 } else { 257 # diff run must have been cleaned up, need to create this skycell file on the fly 258 if (!defined $temp_dir ) { 259 $temp_dir = tempdir( CLEANUP => !$save_temps); 260 } 261 my $skycell_id = $skycell->{skycell_id}; 262 if (!$diff_skycells{$skycell_id}) { 263 $skycell_uri = "$temp_dir/$skycell_id"; 264 $ipprc->skycell_file($skycell->{tess_id}, $skycell_id, $skycell_uri, $verbose) or 265 &my_die("failed to create skycell file for $skycell_id", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR); 266 } 267 $diff_skycells{$skycell_id} = $skycell_uri; 244 268 } 245 my $skycell_id = $skycell->{skycell_id};246 $skycell_uri = "$temp_dir/$skycell_id";247 $ipprc->skycell_file($skycell->{tess_id}, $skycell_id, $skycell_uri, $verbose) or248 &my_die("failed to create skycell file for $skycell_id", $magic_ds_id, $component, $PS_EXIT_PROG_ERROR);249 269 } 250 print $sfh "$skycell_uri\n"; 251 } 252 close $sfh 253 } 270 } 271 } 272 # write the skycell list file 273 ($sfh, $skycell_list) = tempfile( "/tmp/skycell_list.XXXX", UNLINK => !$save_temps); 274 foreach my $skycell_id (keys %diff_skycells) { 275 print $sfh $diff_skycells{$skycell_id} . "\n"; 276 } 277 close $sfh 254 278 } 255 279 … … 470 494 471 495 my $statsFlags; 472 if ( $stage ne "camera") {496 if (!$no_op and $stage ne "camera") { 473 497 file_check($statsFile); 474 498 { … … 590 614 } 591 615 616 # @diff_components = get_overlaps($path_base, $component, $tess_id, $diff_tess_id); 617 sub get_overlaps { 618 my $path_base = shift; 619 my $component = shift; 620 my $diff_tess_id = shift; 621 622 my $tess_dir = $ipprc->tessellation_catdir( $diff_tess_id ); 623 my $catdir = $ipprc->convert_filename_absolute($tess_dir); 624 625 my $cmf = $ipprc->file_resolve("$path_base.cmf"); 626 &my_die("Unable to resolve $path_base.$cmf", $magic_ds_id, $component, $PS_EXIT_SYS_ERROR) unless $cmf; 627 628 my $command = "$dvoImageOverlaps -D CATDIR $catdir -accept-astrom $cmf"; 629 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 630 run(command => $command, verbose => $verbose); 631 unless ($success) { 632 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 633 &my_die("Unable to perform dvoImageOverlaps $error_code", $magic_ds_id, $component, 634 $error_code); 635 } 636 my @list; 637 my $output = join "\n", @$stdout_buf; 638 if ($output) { 639 foreach my $line (split "\n", $output) { 640 my (undef, undef, $skycell_id) = split " ", $line; 641 push @list, $skycell_id; 642 } 643 } 644 return @list 645 } 646 592 647 593 648 sub my_die -
tags/ipp-20110622/ippTasks/destreak.pro
- Property svn:mergeinfo set to
r30855 r32538 206 206 book getword magicToDS $pageName magicked -var MAGICKED 207 207 book getword magicToDS $pageName dbname -var DBNAME 208 208 book getword magicToDS $pageName diff_tess_id -var DIFF_TESS_ID 209 book getword magicToDS $pageName mismatched_tess -var MISMATCHED_TESS 209 210 210 211 substr $COMPONENT 0 3 COMP_HEAD … … 224 225 $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --exp_id $EXP_ID --streaks_path_base $STREAKS_PATH_BASE --inv_streaks_path_base $INV_STREAKS_PATH_BASE --streaks $STREAKS --inv_streaks $INV_STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --cam_reduction $CAM_REDUCTION --outroot $WORKDIR --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --magicked $MAGICKED --run-state $RUN_STATE 225 226 227 if ($MISMATCHED_TESS) 228 book getword magicToDS $pageName diff_tess_id -var DIFF_TESS_ID 229 $run = $run --mismatched_tess --diff_tess_id $DIFF_TESS_ID 230 end 226 231 add_standard_args run 227 232 -
tags/ipp-20110622/ippTools/share/magicdstool_todestreak_camera.sql
- Property svn:mergeinfo set to
r30238 r32538 14 14 stage_id, 15 15 'exposure' AS component, 16 0 AS mismatched_tess, 16 17 CAST(NULL AS CHAR(255)) AS uri, 17 18 camProcessedExp.path_base, -
tags/ipp-20110622/ippTools/share/magicdstool_todestreak_chip.sql
- Property svn:mergeinfo set to
r29561 r32538 14 14 stage_id, 15 15 class_id AS component, 16 0 AS mismatched_tess, 16 17 chipProcessedImfile.uri, 17 18 chipProcessedImfile.path_base, -
tags/ipp-20110622/ippTools/share/magicdstool_todestreak_diff.sql
- Property svn:mergeinfo set to
r29561 r32538 15 15 diffRun.magicked, 16 16 diffSkyfile.skycell_id AS component, 17 0 AS mismatched_tess, 17 18 CAST(NULL AS CHAR(255)) AS uri, 18 19 diffSkyfile.path_base, … … 63 64 diffRun.magicked, 64 65 diffSkyfile.skycell_id AS component, 66 0 AS mismatched_tess, 65 67 CAST(NULL AS CHAR(255)) AS uri, 66 68 diffSkyfile.path_base, -
tags/ipp-20110622/ippTools/share/magicdstool_todestreak_raw.sql
- Property svn:mergeinfo set to
r30809 r32538 14 14 rawExp.magicked, 15 15 class_id as component, 16 0 AS mismatched_tess, 16 17 rawImfile.uri AS uri, 17 18 -- XXX: replace this with rawImfile.path_base once it exists -
tags/ipp-20110622/ippTools/share/magicdstool_todestreak_warp.sql
- Property svn:mergeinfo set to
r29561 r32538 14 14 warpRun.magicked, 15 15 warpSkyfile.skycell_id as component, 16 diffRun.tess_id != warpRun.tess_id AS mismatched_tess, 17 diffRun.tess_id as diff_tess_id, 16 18 warpSkyfile.uri, 17 19 warpSkyfile.path_base, … … 27 29 JOIN magicMask USING (magic_id) 28 30 JOIN magicRun USING (magic_id) 31 JOIN diffRun USING(diff_id) 29 32 JOIN warpRun ON warp_id = stage_id 30 33 JOIN warpSkyfile USING(warp_id)
Note:
See TracChangeset
for help on using the changeset viewer.
