Changeset 25442
- Timestamp:
- Sep 18, 2009, 10:29:30 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
ippScripts/scripts/chip_imfile.pl (modified) (2 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (30 diffs)
-
ippconfig/gpc1/camera.config (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/chip_imfile.pl
r24549 r25442 19 19 use IPC::Cmd 0.36 qw( can_run run ); 20 20 use PS::IPP::Metadata::Config; 21 use PS::IPP::Metadata::List qw( parse_md_list ); 21 22 use PS::IPP::Config 1.01 qw( :standard ); 22 23 use File::Temp qw( tempfile ); … … 143 144 ## XXX make the feature more general? 144 145 my $useDeburnedImage = metadataLookupBool($recipeData, 'USE.DEBURNED.IMAGE'); 145 if ($useDeburnedImage && $deburned) { 146 $uri =~ s/fits$/burn.fits/; 147 &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri); 146 if ($useDeburnedImage) { 147 ## Check that we have required programs: 148 # print STDERR "Inside burntool loop!\n"; 149 my $regtool = can_run('regtool') or &my_die ("Can't find regtool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 150 my $funpack = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 151 my $burntool = can_run('burntool') or &my_die ("Can't find burntool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 152 153 ## Check the current burntool processing version: 154 my $regtool_state_cmd = "$regtool -processedimfile -exp_id $exp_id -class_id $class_id -limit 1"; 155 if (defined($dbname)) { 156 $regtool_state_cmd .= " -dbname $dbname"; 157 } 158 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 159 run(command => $regtool_state_cmd, verbose => $verbose); 160 161 unless ($success) { 162 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 163 &my_die("Unable to perform regtool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 164 } 165 166 my $regData = $mdcParser->parse(join "", @$stdout_buf) or 167 &my_die("Unable to parse regtool metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 168 my $regData2 = parse_md_list($regData); 169 170 my $burntoolState = 999; 171 foreach my $regEntry (@$regData2) { 172 # print "$regEntry->{exp_id} $regEntry->{burntool_state}\n"; 173 174 if ($regEntry->{exp_id} == $exp_id) { 175 $burntoolState = $regEntry->{burntool_state}; 176 } 177 } 178 if ($burntoolState == 999) { 179 &my_die("Unable to find burntool_state in metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 180 } 181 182 ## Read camera config to get the current good burntool state : 183 ## XXX This is extremely slow. Any better way to do this? 184 my $camera_config_cmd = "$ppConfigDump -camera $camera -dump-camera -"; 185 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 186 run(command => $camera_config_cmd, verbose => $verbose); 187 unless ($success) { 188 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 189 &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 190 } 191 192 my $camData = $mdcParser->parse(join "", @$stdout_buf) or 193 &my_die("Unable to parse ppConfigDump metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 194 195 my $burntoolStateGood; 196 foreach my $camEntry (@$camData) { 197 if ($camEntry->{name} eq "BURNTOOL.STATE.GOOD") { 198 $burntoolStateGood = $camEntry->{value}; 199 } 200 } 201 202 if (abs($burntoolState) != $burntoolStateGood) { 203 &my_die("Image burntool version does not match current accepted version.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 204 } 205 206 ## We now know that we have an image that has been burntooled. 207 my ($tempFile, $tempName) = tempfile( "/tmp/chip.$exp_id.$class_id.deburned.XXXX", 208 UNLINK => !$save_temps, SUFFIX => '.fits' ); 209 210 # get the UNIX version of the (possible) neb: or path: filename 211 my $uriReal = $ipprc->file_resolve( $uri ); 212 213 # funpack into the temp file. 214 my $funpack_cmd = "$funpack -S $uriReal > $tempName"; 215 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose); 216 unless ($success) { 217 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 218 &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 219 } 220 221 ## Construct commands to apply the pre-calculated burntool trailfits to the pixel data. 222 my ($burntoolTable_uri, $burntoolTable_uriReal); 223 my $burntool_cmd = "$burntool "; 224 225 if ($burntoolState == -1 * $burntoolStateGood) { # Burntool information stored in an external table. 226 $burntoolTable_uri = $uri; 227 $burntoolTable_uri =~ s/fits$/burn.tbl/; 228 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 229 unless ($ipprc->file_exists($burntoolTable_uri)) { 230 &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR); 231 } 232 233 $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} apply=t"; 234 } 235 elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table. 236 $burntool_cmd .= "$tempName apply=t"; 237 } 238 else { 239 &my_die("Image data not properly burntooled, impossible state", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 240 } 241 242 ## Run burntool to change the pixels of tempfile, and repoint $uri to that file. 243 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 244 run(command => $burntool_cmd, verbose => $verbose); 245 unless ($success) { 246 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 247 &my_die("Unable to perform burntool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 248 } 249 250 $uri = $tempName; 251 unless ($ipprc->file_exists($uri)) { 252 &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 253 } 254 255 # print STDERR "$uri $uriReal $tempName $burntoolTable_uri $burntoolTable_uriReal $burntool_cmd $save_temps\n"; 256 # exit(100); 148 257 } 149 258 -
trunk/ippScripts/scripts/ipp_cleanup.pl
r25324 r25442 123 123 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 124 124 125 if (!$config_file or ! -e $config_file) { 125 # if (!$config_file or ! -e $config_file) { 126 unless ($ipprc->file_exists($config_file)) { 126 127 print STDERR "skipping cleanup for chipRun $stage_id $class_id " 127 . " because config file is missing\n";128 . " because config file ($config_file) is missing\n"; 128 129 $status = 0; 129 130 } … … 132 133 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 133 134 134 if ($ config_file and -e $config_file) {135 if ($ipprc->file_exists($config_file)) { 135 136 print STDERR "skipping scrubbed for chipRun $stage_id $class_id " 136 . " because config file is present\n";137 . " because config file ($config_file) is present\n"; 137 138 $status = 0; 138 139 } … … 144 145 145 146 # delete the temporary image datafiles 146 addFilename (\@files, "PPIMAGE.OUTPUT", $path_base, $class_id);147 addFilename (\@files, "PPIMAGE.OUTPUT.MASK", $path_base, $class_id);148 addFilename (\@files, "PPIMAGE.OUTPUT.VARIANCE", $path_base, $class_id);147 # addFilename (\@files, "PPIMAGE.OUTPUT", $path_base, $class_id); 148 # addFilename (\@files, "PPIMAGE.OUTPUT.MASK", $path_base, $class_id); 149 # addFilename (\@files, "PPIMAGE.OUTPUT.VARIANCE", $path_base, $class_id); 149 150 addFilename (\@files, "PPIMAGE.CHIP", $path_base, $class_id); 150 151 addFilename (\@files, "PPIMAGE.CHIP.MASK", $path_base, $class_id); … … 236 237 if ($mode eq "goto_cleaned") { 237 238 my $config_file = $ipprc->filename("PSASTRO.CONFIG", $path_base); 238 239 if (!$config_file or ! -e $config_file) {239 240 unless ($ipprc->file_exists($config_file)) { 240 241 print STDERR "skipping cleanup for camRun $stage_id because config file is missing\n"; 241 242 $status = 0; … … 245 246 my $config_file = $ipprc->filename("PSASTRO.CONFIG", $path_base); 246 247 247 if ($ config_file and -e $config_file) {248 if ($ipprc->file_exists($config_file)) { 248 249 print STDERR "skipping cleanup for camRun $stage_id because config file ($config_file) is present\n"; 249 250 $status = 0; … … 329 330 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id); 330 331 331 if (!$config_file or ! -e $config_file) {332 unless ($ipprc->file_exists($config_file)) { 332 333 print STDERR "skipping cleanup for warpRun $stage_id $skycell_id" . 333 334 " because config file is missing\n"; … … 338 339 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id); 339 340 340 if ($ config_file and -e $config_file) {341 if ($ipprc->file_exists($config_file)) { 341 342 print STDERR "skipping scrubbed for warpRun $stage_id $skycell_id" . 342 343 " because config file is present\n"; … … 345 346 } 346 347 if ($status) { 348 my @files = (); 347 349 # delete the temporary image datafiles 348 350 addFilename(\@files, "PSWARP.OUTPUT", $path_base, $skycell_id ); … … 433 435 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 434 436 435 $config_file =~ s%^file://%%; 436 if (!$config_file or ! -e $config_file) { 437 unless ($ipprc->file_exists($config_file)) { 437 438 print STDERR "skipping cleanup for stackRun $stage_id $skycell_id" . 438 439 " because config file is missing\n"; 439 440 $status = 0; 440 441 } 441 $config_file = 'file://' . $config_file;442 442 } 443 443 elsif ($mode eq "goto_scrubbed") { 444 444 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 445 $config_file =~ s%^file://%%; 446 if ($ config_file and -e $config_file) {445 446 if ($ipprc->file_exists($config_file)) { 447 447 print STDERR "skipping scrubbed for stackRun $stage_id $skycell_id" . 448 448 " because config file is present\n"; … … 451 451 } 452 452 if ($status) { 453 my @files = (); 453 454 # delete the temporary image datafiles 454 455 addFilename(\@files, "PPSTACK.OUTPUT", $path_base, $skycell_id); … … 535 536 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 536 537 537 $config_file =~ s%^file://%%; 538 if (!$config_file or ! -e $config_file) { 538 unless ($ipprc->file_exists($config_file)) { 539 539 print STDERR "skipping cleanup for diffRun $stage_id $skycell_id" . 540 540 " because config file ($config_file) is missing\n"; 541 541 $status = 0; 542 542 } 543 $config_file = 'file://' . $config_file;544 543 } 545 544 elsif ($mode eq "goto_scrubbed") { 546 545 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 547 $config_file =~ s%^file://%%; 548 if ($ config_file and -e $config_file) {546 547 if ($ipprc->file_exists($config_file)) { 549 548 print STDERR "skipping scrubbed for diffRun $stage_id $skycell_id" . 550 549 " because config file ($config_file) is present\n"; … … 553 552 } 554 553 if ($status) { 554 my @files = (); 555 555 # delete the temporary image datafiles 556 556 addFilename(\@files, "PPSUB.OUTPUT", $path_base, $skycell_id); … … 581 581 582 582 } 583 print STDERR "MY FILES: @files\n";583 # print STDERR "MY FILES: @files\n"; 584 584 $status = &delete_files(\@files); 585 585 } 586 print STDERR "MY STATUS: $status\n";586 # print STDERR "MY STATUS: $status\n"; 587 587 if ($status) { 588 588 my $command = "$difftool -diff_id $stage_id"; … … 675 675 my $config_file = $ipprc->filename("PPSIM.CONFIG", $path_base, $class_id); 676 676 677 if (!$config_file or ! -e $config_file) {677 unless ($ipprc->file_exists($config_file)) { 678 678 print STDERR "skipping cleanup for fakeRun $stage_id $class_id " 679 679 . " because config file is missing\n"; … … 684 684 my $config_file = $ipprc->filename("PPSIM.CONFIG", $path_base, $class_id); 685 685 686 if ($ config_file and -e $config_file) {686 if ($ipprc->file_exists($config_file)) { 687 687 print STDERR "skipping scrubbed for fakeRun $stage_id $class_id " 688 688 . " because config file is present\n"; … … 795 795 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 796 796 797 if (!$config_file or ! -e $config_file) {797 unless ($ipprc->file_exists($config_file)) { 798 798 print STDERR "skipping cleanup for detrend.process.imfile $stage_id $class_id " 799 799 . " because config file is missing\n"; … … 804 804 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 805 805 806 if ($ config_file and -e $config_file) {806 if ($ipprc->file_exists($config_file)) { 807 807 print STDERR "skipping scrubbed for detrend.process.imfile $stage_id $class_id " 808 808 . " because config file is present\n"; … … 942 942 my $config_file = $ipprc->filename("PSIMAGE.CONFIG", $path_base); 943 943 944 if (!$config_file or ! -e $config_file) {944 unless ($ipprc->file_exists($config_file)) { 945 945 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 946 946 $status = 0; … … 950 950 my $config_file = $ipprc->filename("PSIMAGE.CONFIG", $path_base); 951 951 952 if ($ config_file and -e $config_file) {952 if ($ipprc->file_exists($config_file)) { 953 953 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 954 954 $status = 0; … … 1094 1094 1095 1095 if ($status) { 1096 my @files = (); 1096 1097 # delete the temporary image datafiles 1097 1098 # There's no convenient way to get the detrend type, so I'm queueing all of them for deletion. … … 1227 1228 run(command => $command, verbose => $verbose); 1228 1229 unless ($success) { 1229 print STDERR "WTF: $success TTT $error_code QQQ\n";1230 1230 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1231 1231 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); … … 1316 1316 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1317 1317 1318 if (!$config_file or ! -e $config_file) {1318 unless ($ipprc->file_exists($config_file)) { 1319 1319 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1320 1320 $status = 0; … … 1324 1324 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1325 1325 1326 if ($ config_file and -e $config_file) {1326 if ($ipprc->file_exists($config_file)) { 1327 1327 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1328 1328 $status = 0; … … 1450 1450 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1451 1451 1452 if (!$config_file or ! -e $config_file) {1452 unless ($ipprc->file_exists($config_file)) { 1453 1453 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1454 1454 $status = 0; … … 1458 1458 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1459 1459 1460 if ($ config_file and -e $config_file) {1460 if ($ipprc->file_exists($config_file)) { 1461 1461 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1462 1462 $status = 0; … … 1591 1591 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 1592 1592 1593 if (!$config_file or ! -e $config_file) {1593 unless ($ipprc->file_exists($config_file)) { 1594 1594 print STDERR "skipping cleanup for $stage $stage_id $class_id " 1595 1595 . " because config file is missing\n"; … … 1600 1600 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 1601 1601 1602 if ($ config_file and -e $config_file) {1602 if ($ipprc->file_exists($config_file)) { 1603 1603 print STDERR "skipping scrubbed for $stage $stage_id $class_id " 1604 1604 . " because config file is present\n"; … … 1731 1731 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1732 1732 1733 if (!$config_file or ! -e $config_file) {1733 unless ($ipprc->file_exists($config_file)) { 1734 1734 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1735 1735 $status = 0; … … 1739 1739 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1740 1740 1741 if ($ config_file and -e $config_file) {1741 if ($ipprc->file_exists($config_file)) { 1742 1742 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1743 1743 $status = 0; … … 1833 1833 { 1834 1834 my $files = shift; # reference to a list of files to unlink 1835 1836 # open(TMPLOG,">>/tmp/czw.cleanup.log"); 1837 # flock(TMPLOG,2); 1835 # my $test_verbose = 1; 1836 1837 # if ($test_verbose == 1) { 1838 # open(TMPLOG,">>/tmp/czw.cleanup.log"); 1839 # flock(TMPLOG,2); 1840 # } 1838 1841 1839 1842 # this script is, of course, very dangerous. 1840 1843 foreach my $file (@$files) { 1841 print STDERR "unlinking $file\n"; 1842 # print TMPLOG "$stage $stage_id $file"; 1843 # my $ff = $file; 1844 # $ff =~ s%^file://%%; 1845 # unless (-e $ff) { 1846 # print TMPLOG "\t File not found\n"; 1844 print STDERR "unlinking $stage $stage_id $file"; 1845 unless ($ipprc->file_exists($file)) { 1846 print STDERR "\t File not found\n"; 1847 } 1848 else { 1849 print STDERR "\n"; 1850 } 1851 1852 # if ($test_verbose == 1) { 1853 # print TMPLOG "$stage $stage_id $file"; 1854 1855 # else { 1856 # print TMPLOG "\n"; 1857 # } 1847 1858 # } 1848 # else {1849 # print TMPLOG "\n";1850 # }1851 1859 1852 1860 $ipprc->file_delete($file); 1853 1861 } 1854 1862 1855 # flock(TMPLOG,8); 1856 # close(TMPLOG); 1863 # if ($test_verbose == 1) { 1864 # flock(TMPLOG,8); 1865 # close(TMPLOG); 1866 # } 1857 1867 1858 1868 return 1; -
trunk/ippconfig/gpc1/camera.config
r25425 r25442 148 148 PHOTCODE.RULE STR {DETECTOR}.{FILTER.ID}.{CHIP.NAME} # Rule for generating photcode 149 149 150 BURNTOOL.STATE.GOOD S16 1 2# Value for burntool_state with the most recent bt version.150 BURNTOOL.STATE.GOOD S16 13 # Value for burntool_state with the most recent bt version.
Note:
See TracChangeset
for help on using the changeset viewer.
