Changeset 25425
- Timestamp:
- Sep 16, 2009, 6:35:31 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/share/regtool_updateprocessedimfile.sql (modified) (1 diff)
-
ippTools/src/regtool.c (modified) (4 diffs)
-
ippTools/src/regtoolConfig.c (modified) (1 diff)
-
ippconfig/gpc1/camera.config (modified) (1 diff)
-
ippconfig/gpc1/format_20090220.config (modified) (1 diff)
-
ippconfig/recipes/ppImage.config (modified) (1 diff)
-
ippconfig/recipes/ppStats.config (modified) (1 diff)
-
ippconfig/recipes/ppStatsFromMetadata.config (modified) (1 diff)
-
psModules/src/concepts/pmConcepts.c (modified) (2 diffs)
-
psModules/src/concepts/pmConceptsRead.c (modified) (4 diffs)
-
psModules/src/concepts/pmConceptsStandard.c (modified) (2 diffs)
-
psModules/src/concepts/pmConceptsStandard.h (modified) (1 diff)
-
tools/examine_burntool_pcontrol.pl (modified) (7 diffs)
-
tools/ipp_apply_burntool.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/share/pxadmin_create_tables.sql
r25420 r25425 223 223 teltemp_extra FLOAT, 224 224 pon_time FLOAT, 225 burntool_state SMALLINT, 225 226 user_1 DOUBLE, 226 227 user_2 DOUBLE, -
trunk/ippTools/share/regtool_updateprocessedimfile.sql
r23546 r25425 1 1 UPDATE rawImfile 2 SET user_1 = %lf2 SET burntool_state = %d 3 3 WHERE 4 4 rawImfile.exp_id = %lld -
trunk/ippTools/src/regtool.c
r25420 r25425 224 224 PXOPT_LOOKUP_F32(teltemp_extra, config->args, "-teltemp_extra", false, false); 225 225 PXOPT_LOOKUP_F32(pon_time, config->args, "-pon_time", false, false); 226 PXOPT_LOOKUP_S16(burntool_state, config->args, "-burntool_state", false, false); 226 227 PXOPT_LOOKUP_F64(user_1, config->args, "-user_1", false, false); 227 228 PXOPT_LOOKUP_F64(user_2, config->args, "-user_2", false, false); … … 467 468 468 469 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 469 PXOPT_LOOKUP_F64(user_1, config->args, "-user_1", false, false); 470 471 if ((fault == INT16_MAX) && !isfinite(user_1)) { 472 psError(PS_ERR_UNKNOWN, false, "one of -fault or -user_1 must be selected"); 473 return false; 474 } 475 if ((fault != INT16_MAX) && isfinite(user_1)) { 476 psError(PS_ERR_UNKNOWN, false, "only one of -fault or -user_1 must be selected"); 470 /* PXOPT_LOOKUP_F64(user_1, config->args, "-user_1", false, false); */ 471 PXOPT_LOOKUP_S16(burntool_state, config->args, "-burntool_state", false, false); 472 473 if ((fault == INT16_MAX) && !isfinite(burntool_state)) { 474 psError(PS_ERR_UNKNOWN, false, "one of -fault or -burntool_state must be selected"); 475 return false; 476 } 477 if ((fault != INT16_MAX) && isfinite(burntool_state)) { 478 psError(PS_ERR_UNKNOWN, false, "only one of -fault or -burntool_state must be selected"); 477 479 return false; 478 480 } … … 491 493 } 492 494 493 if (isfinite( user_1)) {495 if (isfinite(burntool_state)) { 494 496 psString query = pxDataGet("regtool_updateprocessedimfile.sql"); 495 497 if (!query) { … … 498 500 } 499 501 500 if (!p_psDBRunQueryF(config->dbh, query, user_1, exp_id, class_id)) {502 if (!p_psDBRunQueryF(config->dbh, query, burntool_state, exp_id, class_id)) { 501 503 psError(PS_ERR_UNKNOWN, false, "database error"); 502 504 psFree(query); -
trunk/ippTools/src/regtoolConfig.c
r25418 r25425 155 155 ADD_OPT(S64, updateprocessedimfileArgs, "-exp_id", "search by exposure ID", 0); 156 156 ADD_OPT(Str, updateprocessedimfileArgs, "-class_id", "search by class ID", NULL); 157 ADD_OPT( F64, updateprocessedimfileArgs, "-user_1", "set user stat (1)", NAN);157 ADD_OPT(S16, updateprocessedimfileArgs, "-burntool_state", "set burntool state", 0); 158 158 ADD_OPT(S16, updateprocessedimfileArgs, "-fault", "set fault code", INT16_MAX); 159 159 -
trunk/ippconfig/gpc1/camera.config
r25383 r25425 147 147 148 148 PHOTCODE.RULE STR {DETECTOR}.{FILTER.ID}.{CHIP.NAME} # Rule for generating photcode 149 150 BURNTOOL.STATE.GOOD S16 12 # Value for burntool_state with the most recent bt version. -
trunk/ippconfig/gpc1/format_20090220.config
r25299 r25425 207 207 FPA.TELTEMP.TRUSS STR TELTEMTR # Mid truss temperatures (C 208 208 FPA.TELTEMP.EXTRA STR TELTEMEX # Miscellaneous temperatures (C) 209 210 FPA.BURNTOOL.APPLIED STR BTOOLAPP 209 211 210 212 FPA.PON.TIME STR PONTIME -
trunk/ippconfig/recipes/ppImage.config
r25299 r25425 56 56 SCAN.ROWS S32 100 57 57 58 BURNTOOL.TRAILS U16 0x01 58 # Which regions identified by burntool to mask. 0x01 : only unfit trails, 0x02 "up" trails, 0x04 "down" trails 59 BURNTOOL.TRAILS U16 0x01 59 60 60 61 # Non-linearity correction -
trunk/ippconfig/recipes/ppStats.config
r24773 r25425 190 190 CONCEPT STR FPA.TELTEMP.EXTRA # Miscellaneous temperatures (C) 191 191 192 CONCEPT STR FPA.BURNTOOL.APPLIED 193 192 194 CONCEPT STR FPA.PON.TIME # time since last power on 193 195 -
trunk/ippconfig/recipes/ppStatsFromMetadata.config
r23940 r25425 44 44 ENTRY VAL FPA.TELTEMP.EXTRA F32 CONSTANT -teltemp_extra # Miscellaneous temperatures (C) 45 45 ENTRY VAL FPA.PON.TIME F32 CONSTANT -pon_time # time since last power on 46 # ENTRY VAL FPA.BURNTOOL.APPLIED S32 CONSTANT -burntool_state # 46 47 ENTRY VAL CHIP.TEMP F32 SAMPLE_MEAN -ccd_temp # CCD temperature 47 48 ENTRY VAL CELL.EXPOSURE F32 SAMPLE_MEAN -exp_time # Exposure time -
trunk/psModules/src/concepts/pmConcepts.c
r25046 r25425 329 329 conceptRegisterF32("FPA.TELTEMP.EXTRA", "Telescope Temperatures: extra", p_pmConceptParse_TELTEMPS, NULL, NULL, false, PM_FPA_LEVEL_FPA); 330 330 conceptRegisterF32("FPA.PON.TIME", "Power On Time", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA); 331 conceptRegisterS32("FPA.BURNTOOL.APPLIED", "Status of burntool processing", p_pmConceptParse_BTOOLAPP,NULL,NULL,false,PM_FPA_LEVEL_FPA); 331 332 conceptRegisterF32("FPA.EXPOSURE", "Exposure time (sec)", NULL, NULL, NULL, false, PM_FPA_LEVEL_FPA); 332 333 } … … 344 345 conceptRegisterF32("CHIP.TEMP", "Temperature of chip", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP); 345 346 conceptRegisterStr("CHIP.ID", "Chip identifier", NULL, NULL, NULL, false, PM_FPA_LEVEL_CHIP); 347 346 348 } 347 349 -
trunk/psModules/src/concepts/pmConceptsRead.c
r24824 r25425 73 73 return false; 74 74 } 75 76 75 psTrace ("psModules.concepts", 3, "parsing concept: %s\n", spec->blank->name); 77 76 if (!strcmp (spec->blank->name, "CELL.XPARITY")) { … … 275 274 psMetadataItem *headerItem = NULL; // The value of the concept from the header 276 275 276 277 277 psTrace ("psModules.concepts", 3, "reading concept: %s\n", name); 278 278 if (!strcmp (name, "CELL.XPARITY")) { … … 307 307 } 308 308 } 309 310 309 if (!headerItem) { 311 310 psMetadataItem *formatItem = psMetadataLookup(transSpec, name); // Item with keyword … … 328 327 } 329 328 psString keywords = formatItem->data.str; // The FITS keywords 330 331 329 // In case there are multiple headers 332 330 psList *keys = psStringSplit(keywords, " ,;", true); // List of keywords -
trunk/psModules/src/concepts/pmConceptsStandard.c
r25134 r25425 160 160 assert(concept); 161 161 assert(pattern); 162 163 162 double value = NAN; 164 163 switch (concept->type) { … … 632 631 return psMetadataItemAllocS32(pattern->name, pattern->comment, binning); 633 632 } 633 634 // BTOOLAPP 635 psMetadataItem *p_pmConceptParse_BTOOLAPP(const psMetadataItem *concept, 636 const psMetadataItem *pattern, 637 pmConceptSource source, 638 const psMetadata *cameraFormat, 639 const pmFPA *fpa, 640 const pmChip *chip, 641 const pmCell *cell) 642 { 643 assert(concept); 644 assert(pattern); 645 646 int bt_status = 0; 647 648 if (concept->type != PS_DATA_BOOL) { 649 psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Type for %s (%x) is not BOOL\n", 650 concept->name, concept->type); 651 return NULL; 652 } 653 654 if (concept->data.B == true) { 655 bt_status = -2; 656 } 657 else if (concept->data.B == false) { 658 bt_status = 1 ; 659 } 660 661 return psMetadataItemAllocS32(concept->name, concept->comment, bt_status); 662 } 634 663 635 664 // Get the current value of a concept -
trunk/psModules/src/concepts/pmConceptsStandard.h
r22699 r25425 115 115 ); 116 116 117 /// Format for the BTOOLAPP conceptn 118 psMetadataItem *p_pmConceptParse_BTOOLAPP( 119 const psMetadataItem *concept, ///< Concept to format 120 const psMetadataItem *pattern, 121 pmConceptSource source, ///< Source for concept 122 const psMetadata *cameraFormat, ///< Camera format definition 123 const pmFPA *fpa, ///< FPA for concept, or NULL 124 const pmChip *chip, ///< Chip for concept, or NULL 125 const pmCell *cell ///< Cell for concept, or NULL 126 ); 127 128 117 129 /// Parse the cell binning concepts: CELL.XBIN, CELL.YBIN 118 130 psMetadataItem *p_pmConceptParse_CELL_Binning( -
trunk/tools/examine_burntool_pcontrol.pl
r25300 r25425 2 2 3 3 # script to print out information about the current status of a burntool run. 4 5 4 use DBI; 6 5 use Getopt::Std; … … 15 14 print STDERR " status of the processing. On the OTA grid:\n"; 16 15 print STDERR " _ Blank chip\n"; 17 print STDERR " N Null value for user_1. No burntool attempted.\n"; 18 print STDERR " O 0.1 value for user_1. Burntool failed or is running.\n"; 19 print STDERR " B 1.0 value for user_1. Burntool succeeded.\n"; 16 print STDERR " N Null/zero value for burntool_state. No burntool attempted.\n"; 17 print STDERR " O -1 value for burntool_state. Burntool is running.\n"; 18 print STDERR " E -2 value for burntool_state. Error!\n"; 19 print STDERR " B Current version value for burntool_state. Burntool succeeded.\n"; 20 print STDERR " b Old version value for burntool_state. Burntool needs to be rerun.\n"; 20 21 exit(1); 21 22 } 22 23 # Read a class_id and user_1 pair, and set the correct cell of the (sorry, global) character array vector 23 $| = 1; 24 # Determine what the value of "BURNTOOL.STATE.GOOD" currently is: 25 $burntoolStateGood = 999; 26 open(LAZY,"ppConfigDump -camera GPC1 -dump-camera - |") || die "Can't run ppConfigDump\n"; 27 while(<LAZY>) { 28 chomp; 29 if ($_ =~ /BURNTOOL.STATE.GOOD/) { 30 @line = split /\s+/; 31 $burntoolStateGood = $line[2]; 32 } 33 } 34 close(LAZY); 35 unless( $burntoolStateGood == 999) { 36 print STDERR "GOOD == $burntoolStateGood\n"; 37 } 38 39 # Read a class_id and burntool_state pair, and set the correct cell of the (sorry, global) character array vector 24 40 sub class_to_vector { 25 41 my $class = shift; 26 my $ user1= shift;42 my $burntool_state = shift; 27 43 my $char = '_'; 28 if ( $user1 == 1.0) {29 $char = '[32 mB[m';44 if (abs($burntool_state) == $burntoolStateGood) { 45 $char = '[32;01mB[m'; 30 46 $burncount++; 31 47 } 32 elsif ($user1 == 0.1) { 48 elsif ($burntool_state == -1) { 49 $char = '[01;33mP[m'; 50 } 51 elsif ($burntool_state == 0) { 33 52 $char = '[31mO[m'; 34 53 } 35 elsif ($user1 == -1.0) { 36 $char = '[34mN[m'; 54 elsif ($burntool_state == -2) { 55 $char = '[35;01;44;05mE[m'; 56 } 57 elsif ($burntool_state == -3) { 58 $char = '[34mX[m'; 59 } 60 else { 61 $char = '[32mb[m'; 37 62 } 38 63 … … 47 72 # Engauge autoflush, in case the database server is acting up. 48 73 $| = 1; 49 50 74 51 75 # Load the pcontrol.pro file, and create arrays of the dates included … … 96 120 # Get the data. The limit is there to keep the database happy. I don't think you can observe that many 97 121 # images on a single night. 98 $sth = "SELECT exp_id,exp_name,obs_mode,dateobs,class_id, user_1,comment FROM rawImfile WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' order by dateobs limit 60000";122 $sth = "SELECT exp_id,exp_name,obs_mode,dateobs,class_id,burntool_state,comment FROM rawImfile WHERE dateobs >= '${dmin}' AND dateobs <= '${dmax}' order by dateobs limit 60000"; 99 123 $data_ref = $db->selectall_arrayref( $sth ); 100 124 … … 122 146 123 147 foreach $row_ref (@{ $data_ref }) { 124 ($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$user_1,$comment) = @{ $row_ref }; 148 ($exp_id,$exp_name, $obs_mode,$dateobs,$class_id,$burntool_state,$comment) = @{ $row_ref }; 149 125 150 # Correct for nulls in the database. 126 151 if (!defined($obs_mode)) { 127 152 $obs_mode = 'NULL'; 128 153 } 129 if (!defined($ user_1)) {130 $ user_1 = -1;154 if (!defined($burntool_state)) { 155 $burntool_state = 0; 131 156 } 132 157 if (!defined($comment)) { 133 158 $comment = ' '; 134 159 } 135 160 # print "$exp_id $class_id $burntool_state\n"; 136 161 # If we're still working on the same exp_id, update the chip we got 137 162 if ($exp_id == $cur_exp_id) { 138 class_to_vector($class_id,$ user_1);163 class_to_vector($class_id,$burntool_state); 139 164 } 140 165 else { … … 156 181 } 157 182 ($cur_exp_id,$cur_exp_name,$cur_obs_mode,$cur_dateobs,$cur_comment) = ($exp_id,$exp_name,$obs_mode,$dateobs,$comment); 158 class_to_vector($class_id,$ user_1);183 class_to_vector($class_id,$burntool_state); 159 184 } 160 185 } … … 169 194 if ($burncount != 60) { 170 195 for ($j = 0; $j < 64; $j++) { 171 $vector[$j] =~ s/\[..m(.).*/$1/;172 if ($vector[$j] ne 'B') {196 # printf("%d %s %d\n",$j, $vector[$j], ($vector[$j] !~ /B/)); 197 if ($vector[$j] !~ /B/) { 173 198 if ($vector[$j] ne '_') { 174 199 $id = sprintf("XY%d%d",int($j / 8),$j % 8); -
trunk/tools/ipp_apply_burntool.pl
r25412 r25425 12 12 use Carp; 13 13 14 use IPC::Cmd 0.36 qw( can_run );15 use IPC::Run 0.36 qw( run );14 use IPC::Cmd 0.36 qw( can_run run ); 15 #use IPC::Run 0.36 qw( run ); 16 16 use PS::IPP::Metadata::List qw( parse_md_list ); 17 17 use PS::IPP::Config 1.01 qw( :standard ); … … 20 20 use Pod::Usage qw( pod2usage ); 21 21 22 my ( $class_id, $dateobs_begin, $dateobs_end, $ skip_burned, $rerun_from_first, $dbname, $logfile, $verbose, $save_temps);22 my ( $class_id, $dateobs_begin, $dateobs_end, $convert, $camera, $dbname, $logfile, $verbose, $save_temps); 23 23 GetOptions( 24 24 'class_id=s' => \$class_id, # chip identifier 25 25 'dateobs_begin=s' => \$dateobs_begin, # exposure date/time range start 26 26 'dateobs_end=s' => \$dateobs_end, # exposure date/time range stop 27 'camera=s' => \$camera, # Camera 27 28 'dbname|d=s' => \$dbname, # Database name 28 29 'logfile=s' => \$logfile, 29 'skip_burned' => \$skip_burned, # Print to stdout30 'rerun_from_first' => \$rerun_from_first, # Print to stdout31 30 'verbose' => \$verbose, # Print to stdout 32 31 'save-temps' => \$save_temps, # Save temporary files? 32 33 33 ) or pod2usage( 2 ); 34 34 … … 43 43 defined $dbname; 44 44 45 if ($skip_burned and $rerun_from_first) { &my_die("-rerun_from_first and -skip_burned are incompatible"); } 45 unless (defined $camera) { 46 $camera = "GPC1"; 47 # warn("No camera defined. Defaulting to $camera and warning."); 48 } 46 49 47 50 my $missing_tools; … … 49 52 my $funpack = can_run('funpack') or (warn "Can't find funpack" and $missing_tools = 1); 50 53 my $burntool = can_run('burntool') or (warn "Can't find burntool" and $missing_tools = 1); 51 my $fpack = can_run('fpack') or (warn "Can't find fpack" and $missing_tools = 1); 54 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 55 #my $fpack = can_run('fpack') or (warn "Can't find fpack" and $missing_tools = 1); 52 56 if ($missing_tools) { 53 57 warn("Can't find required tools."); … … 57 61 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 58 62 63 # IPP configuration (including nebulous) 64 my $ipprc = PS::IPP::Config->new( $camera ) or my_die("Unable to set up"); 65 66 $ipprc->redirect_output($logfile) if $logfile; 67 68 # Determine the value of a "good" burntool run. 69 my $config_cmd = "$ppConfigDump -camera $camera -dump-camera - | grep BURNTOOL"; 70 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 71 run ( command => $config_cmd, verbose => $verbose); 72 unless ($success) { 73 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 74 &my_die("Unable to perform ppConfigDump: $error_code", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 75 } 76 77 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 78 &my_die("Unable to parse metadata config doc", 0, 0, $class_id, $PS_EXIT_SYS_ERROR); 79 80 my $burntoolStateGood = 999; 81 foreach my $cfg (@$recipeData) { 82 if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') { 83 $burntoolStateGood = $cfg->{value}; 84 } 85 } 86 if ($burntoolStateGood == 999) { 87 &my_die("Failed to determine BURNTOOL.STATE.GOOD", $burntoolStateGood, $class_id, 0, $PS_EXIT_SYS_ERROR); 88 } 89 my $outState = -1 * abs($burntoolStateGood); 90 91 print ">>$burntoolStateGood<<\n"; 92 93 # Define list of images to examine. 59 94 my $command = "$regtool -processedimfile"; 60 95 $command .= " -class_id $class_id"; … … 64 99 $command .= " -dbname $dbname" if defined $dbname; 65 100 66 my @command = split /\s+/, $command; 67 my ( $stdin, $stdout, $stderr ); # Buffers for running program 68 print "Running [$command]...\n" if $verbose; 69 if (not run(\@command, \$stdin, \$stdout, \$stderr)) { 70 &my_die("Unable to perform regtool -processedimfile"); 71 } 72 print $stdout . "\n" if $verbose; 73 74 my @files; 75 my @whole = split /\n/, $stdout; 76 my @single = (); 77 while ( scalar @whole > 0 ) { 78 my $value = shift @whole; 79 push @single, $value; 80 if ($value =~ /^\s*END\s*$/) { 81 push @single, "\n"; 82 83 my $list = parse_md_list( $mdcParser->parse( join( "\n", @single ) ) ); 84 &my_die("Unable to parse output from regtool") unless defined $list; 85 push @files, @$list; 86 @single = (); 87 } 88 } 89 90 # IPP configuration (including nebulous) 91 my $ipprc = PS::IPP::Config->new() or my_die("Unable to set up"); 92 93 $ipprc->redirect_output($logfile) if $logfile; 94 95 my $Nfiles = @files; 96 print "files: $Nfiles\n"; 101 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 102 run ( command => $command, verbose => $verbose); 103 unless ($success) { 104 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 105 &my_die("Unable to perform regtool: $error_code", $class_id, $dateobs_begin, $dateobs_end, $PS_EXIT_SYS_ERROR); 106 } 107 108 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 109 &my_die("Unable to parse metadata", $class_id, $dateobs_begin, $dateobs_end, $PS_EXIT_SYS_ERROR); 110 111 my $files = parse_md_list($metadata) or 112 &my_die("Unable to parse metadat list", $class_id, $dateobs_begin, $dateobs_end, $PS_EXIT_SYS_ERROR); 97 113 98 114 my $REALRUN = 1; 99 my $RAWTABLES = 1; 100 # XXX if we want to avoid using the raw tables in this script, we need to delay deletion of the tempfile until the next pass. 101 102 # first pass: mark the db entries to catch failures 103 # these will not be identified as burned by chip processing (user_1 > 0.5) 104 if (! $skip_burned) { 105 foreach my $file (@files) { 115 116 # Process each file in turn, checking to see if it needs processing, and doing it all in a single pass 117 my $processNext = 0; 118 my $previousTable = ''; 119 120 foreach my $file (@$files) { 121 my $exp_id = $file->{exp_id}; 122 my $state = $file->{burntool_state}; 123 124 my $rawImfile = $file->{uri}; 125 my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0); 126 127 my $outTable = $file->{uri}; 128 $outTable =~ s/fits$/burn.tbl/; 129 my $outTableReal = $ipprc->file_resolve($outTable, 1); 130 131 my $process = 0; 132 133 if ($state == 0) { 134 $process = 1; 135 } 136 elsif ($state == -1) { 137 $process = 1; 138 } 139 elsif ($state == -3) { 140 $process = 1; 141 } 142 elsif ($state == -2) { 143 &my_die("Aborting as $rawImfile has modified pixel data!"); 144 } 145 elsif ($state == $burntoolStateGood) { 146 $process = 0; 147 $previousTable = "infits=$rawImfileReal"; 148 } 149 elsif ($state == -1 * $burntoolStateGood) { 150 $process = 0; 151 $previousTable = "in=$outTableReal"; 152 } 153 else { 154 $process = 1; 155 } 156 157 if (($process == 1)||($processNext == 1)) { 158 $processNext = 1; 159 # Set state to processing 160 my $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -1", $REALRUN); 161 if ($status) { 162 &my_die("failed to update imfile"); 163 } 164 $file->{burntool_state} = -1; 106 165 107 # rerun_from_first treats the first image as already burned (if it is already burned) 108 # the artifact table from the first file is used for the rest of the sequence. 109 if ($rerun_from_first) { 110 $skip_burned = 1; 111 $rerun_from_first = 0; 112 next; 113 } 114 my $exp_id = $file->{exp_id}; 115 116 my $status; 117 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -user_1 0.1", 1); 166 my $tempfile = new File::Temp ( TEMPLATE => "$file->{exp_name}.XXXX", 167 DIR => '/tmp/', 168 UNLINK => !$save_temps, 169 SUFFIX => '.fits'); 170 my $tempPixels = $tempfile->filename; 171 172 # Run burntool 173 $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN); 174 if ($status) { 175 &my_die("failed on funpack",$exp_id,$class_id); 176 } 177 if ($previousTable ne '') { 178 $status = vsystem ("$burntool $tempPixels $previousTable out=$outTableReal tableonly=t persist=t", $REALRUN); 179 } 180 else { 181 $status = vsystem ("$burntool $tempPixels out=$outTableReal tableonly=t persist=t", $REALRUN); 182 } 183 if ($status) { 184 &my_die("failed on burntool",$exp_id,$class_id); 185 } 186 187 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state $outState", $REALRUN); 118 188 if ($status) { 119 189 &my_die("failed to update imfile"); 120 190 } 121 $file->{user_1} = 0.1; 122 } 123 } 124 125 my $prevFileOpt = ""; 126 foreach my $file (@files) { 127 my $exp_id = $file->{exp_id}; 128 129 my $rawImfile = $file->{uri}; 130 my $rawImfileReal; 131 if ($REALRUN) { 132 $rawImfileReal = $ipprc->file_resolve($rawImfile, 0); 133 } else { 134 ($rawImfileReal) = $rawImfile =~ m|^neb:/(.*)|; 135 } 136 print "rawImfile: $rawImfile -> $rawImfileReal\n"; 137 138 # mangle name, create tmp file (always a UNIX file) 139 my $basename = `basename $rawImfile`; chomp $basename; 140 my $tempfile = new File::Temp ( TEMPLATE => "$basename.XXXX", 141 DIR => '/tmp', 142 UNLINK => !$save_temps, 143 SUFFIX => '.fits'); 144 my $tmpImfileReal = $tempfile->filename; 145 # print "tmpImfile: $tmpImfile -> $tmpImfileReal\n"; 146 147 # destination for the burntool-applied image file (may be a NEB file) 148 my $outImfile = $rawImfile; 149 $outImfile =~ s/fits$/burn.fits/; 150 my $outImfileReal = $ipprc->file_resolve($outImfile, 1); 151 # print "outImfile: $outImfile -> $outImfileReal\n"; 152 153 # burntool now can write the artifacts to the fits file. 154 # destination for the burntool artifacts. use this if RAWTABLES is set. 155 my $artImfile; 156 my $artImfileReal; 157 if ($RAWTABLES) { 158 $artImfile = $rawImfile; 159 $artImfile =~ s/fits$/burn.tbl/; 160 $artImfileReal = $ipprc->file_resolve($artImfile, 1); 161 # print "artImfile: $artImfile -> $artImfileReal\n"; 162 } 163 164 print "$rawImfile : $skip_burned, $file->{user_1}\n"; 165 166 if (! ($skip_burned and ($file->{user_1} > 0.5))) { 167 print "running on: $rawImfile\n"; 168 # uncompress the image (do we need to check if it is compressed?) 169 my $status = vsystem ("$funpack -S $rawImfileReal > $tmpImfileReal", $REALRUN); 170 if ($status) { 171 &my_die("failed on funpack"); 172 } 173 174 if ($RAWTABLES) { 175 $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt persist=t", $REALRUN); 176 } else { 177 $status = vsystem ("$burntool $tmpImfileReal $prevFileOpt persist=t", $REALRUN); 178 } 179 if ($status) { 180 &my_die("failed on burntool"); 181 } 182 183 # compress the image (do we need to check if it is compressed?) 184 $status = vsystem ("$fpack -S $tmpImfileReal > $outImfileReal", $REALRUN); 185 if ($status) { 186 &my_die("failed on fpack"); 187 } 188 189 # set the user_1 value to a new result value for now 190 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -user_1 2.0", 1); 191 if ($status) { 192 &my_die("failed to update imfile"); 193 } 194 print "\n"; 195 } 196 # save the artifact file for the next image 197 if ($RAWTABLES) { 198 $prevFileOpt = "in=$artImfileReal"; 199 } else { 200 $prevFileOpt = "infits=$artImfileReal"; 201 } 202 } 203 191 192 $previousTable = "in=$outTableReal"; 193 194 print "\n"; 195 } 196 } 197 204 198 exit 0; 205 199 … … 220 214 sub my_die { 221 215 my $message = shift; 222 216 if ($#_ != -1) { 217 my $exp_id = shift; 218 my $class_id = shift; 219 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1); 220 } 223 221 printf STDERR "$message\n"; 224 222 exit 1;
Note:
See TracChangeset
for help on using the changeset viewer.
