Changeset 26901
- Timestamp:
- Feb 10, 2010, 7:44:33 PM (16 years ago)
- Location:
- trunk/ippScripts
- Files:
-
- 6 edited
- 2 copied
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
scripts/chip_imfile.pl (modified) (7 diffs)
-
scripts/diff_skycell.pl (modified) (2 diffs)
-
scripts/ds9_cmf_regions.pl (modified) (3 diffs)
-
scripts/ipp_apply_burntool.pl (copied) (copied from branches/eam_branches/20091201/ippScripts/scripts/ipp_apply_burntool.pl )
-
scripts/magic_process.pl (modified) (6 diffs)
-
scripts/make_burntool_pcontrol.pl (copied) (copied from branches/eam_branches/20091201/ippScripts/scripts/make_burntool_pcontrol.pl )
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/Build.PL
r26670 r26901 101 101 scripts/whichimage 102 102 scripts/automate_stacks.pl 103 scripts/ipp_apply_burntool.pl 104 scripts/make_burntool_pcontrol.pl 103 105 )], 104 106 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
trunk/ippScripts/MANIFEST
r26670 r26901 37 37 scripts/ds9_cmf_regions.pl 38 38 scripts/automate_stacks.pl 39 scripts/ipp_apply_burntool.pl 40 scripts/make_burntool_pcontrol.pl 39 41 t/00_distribution.t -
trunk/ippScripts/scripts/chip_imfile.pl
r26567 r26901 134 134 $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe_ppImage -"; 135 135 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 136 run(command => $command, verbose => $verbose);136 run(command => $command, verbose => 0); 137 137 unless ($success) { 138 138 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 146 146 147 147 if ($useDeburnedImage) { 148 my $useBestBurntool = metadataLookupBool($recipeData, 'USE.BEST.BURNTOOL');149 150 ## Check that we have required programs:151 # print STDERR "Inside burntool loop!\n";152 my $regtool = can_run('regtool') or &my_die ("Can't find regtool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);153 my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);154 my $burntool = can_run('burntool') or &my_die ("Can't find burntool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);155 148 my $useBestBurntool = metadataLookupBool($recipeData, 'USE.BEST.BURNTOOL'); 149 150 ## Check that we have required programs: 151 # print STDERR "Inside burntool loop!\n"; 152 my $regtool = can_run('regtool') or &my_die ("Can't find regtool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 153 my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 154 my $burntool = can_run('burntool') or &my_die ("Can't find burntool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 155 156 156 ## Check the current burntool processing version: 157 157 my $regtool_state_cmd = "$regtool -processedimfile -exp_id $exp_id -class_id $class_id -limit 1"; … … 173 173 my $burntoolState = 999; 174 174 foreach my $regEntry (@$regData2) { 175 #print "$regEntry->{exp_id} $regEntry->{burntool_state}\n";175 print "$regEntry->{exp_id} $regEntry->{burntool_state}\n"; 176 176 177 177 if ($regEntry->{exp_id} == $exp_id) { … … 182 182 &my_die("Unable to find burntool_state in metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 183 183 } 184 if ($burntoolState == 32767) {185 $burntoolState = 0;186 }184 if ($burntoolState == 32767) { 185 $burntoolState = 0; 186 } 187 187 188 188 ## Read camera config to get the current good burntool state : … … 190 190 my $camera_config_cmd = "$ppConfigDump -camera $camera -dump-camera -"; 191 191 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 192 run(command => $camera_config_cmd, verbose => $verbose);192 run(command => $camera_config_cmd, verbose => 0); 193 193 unless ($success) { 194 194 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); … … 206 206 } 207 207 208 if (abs($burntoolState) != $burntoolStateGood) { 209 if ($useBestBurntool) { 210 &my_die("Image burntool version does not match current accepted version.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 211 } 212 else { 213 warn ("Image burntool version does not match current accepted version. Continuing as requested."); 214 # Internally pretend that we're at a good version. 215 if ($burntoolState < -10) { 216 $burntoolState = -1 * $burntoolStateGood; 217 } 218 elsif ($burntoolState > 10) { 219 $burntoolState = $burntoolStateGood; 220 } 221 elsif ($burntoolState == 0) { 222 # You've told me to use a deburned image, and that you don't care if it's the most recent. The database has told me 223 # that burntool has never been run on this image. We'll hope the database is wrong, but I don't really trust that. 224 warn ("burntool_state suggests no table will be found. This will likely crash."); 225 $burntoolState = -1 * $burntoolStateGood; 226 } 227 else { 228 &my_die("No valid burntool table will be found.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 229 } 230 } 231 } 208 print "burntool state vs burntoolStateGood : $burntoolState vs $burntoolStateGood\n"; 209 if (abs($burntoolState) != $burntoolStateGood) { 210 if ($useBestBurntool) { 211 &my_die("Image burntool version does not match current accepted version.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 212 } 213 else { 214 warn ("Image burntool version does not match current accepted version. Continuing as requested."); 215 # Internally pretend that we're at a good version. 216 if ($burntoolState < -10) { 217 $burntoolState = -1 * $burntoolStateGood; 218 } 219 elsif ($burntoolState > 10) { 220 $burntoolState = $burntoolStateGood; 221 } 222 elsif ($burntoolState == 0) { 223 # You've told me to use a deburned image, and that you don't care if it's the most recent. The database has told me 224 # that burntool has never been run on this image. We'll hope the database is wrong, but I don't really trust that. 225 warn ("burntool_state suggests no table will be found. This will likely crash."); 226 $burntoolState = -1 * $burntoolStateGood; 227 } 228 else { 229 &my_die("No valid burntool table will be found.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 230 } 231 } 232 } 232 233 233 234 ## We now know that we have an image that has been burntooled. … … 258 259 } 259 260 260 $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} apply=t";261 $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t"; 261 262 } 262 263 elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table. 263 $burntool_cmd .= "$tempName apply=t";264 $burntool_cmd .= "$tempName persist=t apply=t"; 264 265 } 265 266 else { -
trunk/ippScripts/scripts/diff_skycell.pl
r26639 r26901 55 55 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 56 56 pod2usage( 57 -msg => "Required options: --diff_id --skycell_id --outroot --run-state ",57 -msg => "Required options: --diff_id --skycell_id --outroot --run-state --diff_skyfile_id", 58 58 -exitval => 3, 59 59 ) unless defined $diff_id … … 168 168 } 169 169 170 print "reduction: $reduction\n"; 171 print "recipe_ppSub: $recipe_ppSub\n"; 172 170 173 # print "templateMask: $templateMask\n"; 171 174 # print "templatePath: $templatePath\n"; -
trunk/ippScripts/scripts/ds9_cmf_regions.pl
r24343 r26901 81 81 if ($mag_radius) { 82 82 foreach my $m (@$mag) { 83 next unless defined $m and $m < "inf" and $m > "-inf";83 next unless defined $m and $m != "nan" and $m < "inf" and $m > "-inf"; 84 84 unless (defined $mag_min and defined $mag_max) { 85 85 $mag_min = $m; … … 99 99 for (my $i = 0; $i < $numRows; $i++) { 100 100 my $col; # Colour to use 101 if ($$flags[$i] & $flag ) {101 if ($$flags[$i] & $flag or not defined $$mag[$i] or $$mag[$i] eq "nan" or $$mag[$i] == "inf" or $$mag[$i] == "-inf") { 102 102 $numBad++; 103 103 $col = $flag_colour; … … 107 107 } 108 108 my $r = $radius; # Radius of circle 109 next if defined $mag_radius and (not defined $$mag[$i]or $$mag[$i] == "inf" or $$mag[$i] == "-inf");109 next if $mag_radius and (not defined $$mag[$i] or $$mag[$i] eq "nan" or $$mag[$i] == "inf" or $$mag[$i] == "-inf"); 110 110 $r -= ($$mag[$i] - $mag_min) * $radius_scale if defined $mag_radius; 111 111 print $coordFile "image; circle(" . ($$x[$i] + 1) . ',' . ($$y[$i] + 1) . ",$r) \# color = $col\n"; -
trunk/ippScripts/scripts/magic_process.pl
r25934 r26901 31 31 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1); 32 32 my $detectstreaks = can_run('DetectStreaks') or (warn "Can't find DetectStreaks" and $missing_tools = 1); 33 my $VerifyStreaks = can_run('VerifyStreaks') or (warn "Can't find VerifyStreaks, will not produce png images"); 33 34 if ($missing_tools) { 34 35 warn("Can't find required tools."); … … 37 38 38 39 # Parse the command-line arguments 39 my ($magic_id, $node, $camera, $dbname, $ outroot, $save_temps, $verbose, $no_update, $no_op, $logfile);40 my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile); 40 41 41 42 GetOptions( … … 44 45 'camera=s' => \$camera, # Camera name 45 46 'dbname=s' => \$dbname, # Database name 46 ' outroot=s' => \$outroot,# Output root name47 'baseroot=s' => \$baseroot, # Output root name 47 48 'save-temps' => \$save_temps, # Save temporary files? 48 49 'verbose' => \$verbose, # Print stuff? … … 53 54 54 55 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 55 pod2usage( -msg => "Required options: --magic_id --camera --node -- outroot",56 pod2usage( -msg => "Required options: --magic_id --camera --node --baseroot", 56 57 -exitval => 3) unless 57 58 defined $magic_id and 58 59 defined $node and 59 60 defined $camera and 60 defined $ outroot;61 defined $baseroot; 61 62 62 63 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 63 64 $ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $node, $PS_EXIT_SYS_ERROR ) if $logfile; 64 65 65 # DetectStreaks doesn't know about nebulous. It expects to be able to append strings to outroot 66 # to form valid file names. 67 # So forbid nebulous path in outroot. We could relax this by change DetectStreaks to take all 68 # of the file names as arguments or by teaching it about Nebulous 69 if ($outroot =~ 'neb:/') { 66 # DetectStreaks doesn't know about nebulous. It expects to be able to 67 # append strings to baseroot to form valid file names. So forbid 68 # nebulous path in baseroot. We could relax this by change 69 # DetectStreaks to take all of the file names as arguments or by 70 # teaching it about Nebulous 71 if ($baseroot =~ 'neb:/') { 70 72 &my_die("DetectStreaks does not support nebulous paths in outroot", $magic_id, $node, $PS_EXIT_CONFIG_ERROR); 71 73 } 72 74 75 # most filenames are of the form $baseroot.$node.*, but VerifyStreaks 76 # needs access to $baseroot.*, so we construct $outroot = 77 # $baseroot.$node in here 78 73 79 # resolve any path:// or file:// in outroot 74 $outroot = $ipprc->file_resolve($outroot); 80 $baseroot = $ipprc->file_resolve($baseroot); 81 my $outroot = "$baseroot.$node"; 75 82 76 83 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 255 262 } 256 263 264 &run_verifystreaks($baseroot); 265 257 266 my $command = "$magictool -addmask"; 258 267 $command .= " -magic_id $magic_id"; … … 275 284 } 276 285 277 278 279 286 ### Pau. 287 288 sub run_verifystreaks { 289 290 my $baseroot = shift; 291 292 unless ($VerifyStreaks) { 293 print STDERR "skipping VerifyStreaks\n"; 294 return 1; 295 } 296 297 # VerifyStreaks --out $outdir --clusters $outdir/clusters.list $rootname.root.streakMap 298 299 my $outdir = "$baseroot.verify"; 300 301 my($status) = system ("mkdir -p $outdir"); 302 if ($status) { 303 print STDERR "failed to create output directory $outdir\n"; 304 return 1; 305 } 306 307 my $FILE; 308 309 my @files = <$baseroot.*.clusters>; 310 311 unless (open ($FILE, ">$outdir/clusters.list")) { 312 print "failed to create cluster file $outdir/clusters.list\n"; 313 return 1; 314 } 315 foreach my $file (@files) { 316 $file =~ s|.clusters$||; 317 print $FILE "$file\n"; 318 } 319 close ($FILE); 320 if ($status) { 321 print "failed to create cluster file $outdir/clusters.list\n"; 322 return 1; 323 } 324 325 my $command = "$VerifyStreaks --out $outdir --clusters $outdir/clusters.list $baseroot.root.streakMap"; 326 327 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 328 run(command => $command, verbose => $verbose); 329 unless ($success) { 330 print "failed to run VerifyStreaks:\n"; 331 return 1; 332 } 333 334 return 0; 335 } 280 336 281 337 sub open_list_file {
Note:
See TracChangeset
for help on using the changeset viewer.
