Changeset 27838 for branches/tap_branches/tools/ipp_apply_burntool.pl
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tools/ipp_apply_burntool.pl (modified) (6 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/tools/ipp_apply_burntool.pl
-
Property svn:executable
set to
*
r25863 r27838 1 1 #!/usr/bin/env perl 2 2 # this program is used to run 'burntool' on images for a single chip 3 # for all exposures for a given time period. 4 # USAGE: ipp_apply_burntool.pl --dbname gpc1 --class_id XY00 --dateobs_begin YYYY/MM/DD --dateobs_end YYYY/MM/DD 3 # for all exposures for a given time period. 4 # USAGE: ipp_apply_burntool.pl --dbname gpc1 --class_id XY00 --dateobs_begin YYYY/MM/DD --dateobs_end YYYY/MM/DD 5 5 6 6 # XXX todo: 7 7 # - add filters to processedimfile 8 # 8 # 9 9 10 10 use warnings; … … 82 82 foreach my $cfg (@$recipeData) { 83 83 if ($cfg->{name} eq 'BURNTOOL.STATE.GOOD') { 84 $burntoolStateGood = $cfg->{value};84 $burntoolStateGood = $cfg->{value}; 85 85 } 86 86 } … … 100 100 $command .= " -dbname $dbname" if defined $dbname; 101 101 102 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 102 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 103 103 run ( command => $command, verbose => $verbose); 104 104 unless ($success) { … … 125 125 my $rawImfile = $file->{uri}; 126 126 my $rawImfileReal = $ipprc->file_resolve($rawImfile, 0); 127 127 128 128 my $outTable = $file->{uri}; 129 129 $outTable =~ s/fits$/burn.tbl/; 130 130 my $outTableReal = $ipprc->file_resolve($outTable, 1); 131 131 132 132 my $process = 0; 133 133 my $previousTableStyle = 0; 134 134 135 135 if ($state == 0) { 136 $process = 1;136 $process = 1; 137 137 } 138 138 elsif ($state == -1) { 139 $process = 1;139 $process = 1; 140 140 } 141 141 elsif ($state == -3) { 142 $process = 1;142 $process = 1; 143 143 } 144 144 elsif ($state == -2) { 145 &my_die("Aborting as $rawImfile has modified pixel data!");145 &my_die("Aborting as $rawImfile has modified pixel data!"); 146 146 } 147 147 elsif ($state == $burntoolStateGood) { 148 $process = 0;149 $previousTableStyle = 1;148 $process = 0; 149 $previousTableStyle = 1; 150 150 } 151 151 elsif ($state == -1 * $burntoolStateGood) { 152 $process = 0;153 # $previousTable = "in=$outTableReal";154 $previousTableStyle = -1;152 $process = 0; 153 # $previousTable = "in=$outTableReal"; 154 $previousTableStyle = -1; 155 155 } 156 156 else { 157 $process = 1;157 $process = 1; 158 158 } 159 159 if ($REALRUN == 0) { 160 print "##Pretending to process as instructed!\n";161 $process = 1;160 print "##Pretending to process as instructed!\n"; 161 $process = 1; 162 162 } 163 163 if (($process == 1)||($processNext == 1)) { 164 $processNext = 1; 165 # Set state to processing 166 my $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -1", $REALRUN); 167 if ($status) { 168 &my_die("failed to update imfile"); 169 } 170 $file->{burntool_state} = -1; 171 172 my $tempfile = new File::Temp ( TEMPLATE => "$file->{exp_name}.XXXX", 173 DIR => '/tmp/', 174 UNLINK => !$save_temps, 175 SUFFIX => '.fits'); 176 my $tempPixels = $tempfile->filename; 177 178 # Run burntool 179 $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN); 180 if ($status) { 181 &my_die("failed on funpack",$exp_id,$class_id); 182 } 183 if ($previousTable ne '') { 184 $status = vsystem ("$burntool $tempPixels $previousTable out=$outTableReal tableonly=t persist=t", $REALRUN); 185 } 186 else { 187 $status = vsystem ("$burntool $tempPixels out=$outTableReal tableonly=t persist=t", $REALRUN); 188 } 189 if ($status) { 190 &my_die("failed on burntool",$exp_id,$class_id); 191 } 192 193 $status = vsystem ("$neb-xattr --write $outTable user.copies:2"); 194 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state $outState", $REALRUN); 195 if ($status) { 196 &my_die("failed to update imfile"); 197 } 198 199 $previousTableStyle = -1; 200 201 print "\n"; 202 } 203 164 $processNext = 1; 165 # Set state to processing 166 my $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -1", $REALRUN); 167 if ($status) { 168 &my_die("failed to update imfile"); 169 } 170 $file->{burntool_state} = -1; 171 172 my $tempfile = new File::Temp ( TEMPLATE => "$file->{exp_name}.XXXX", 173 DIR => '/tmp/', 174 UNLINK => !$save_temps, 175 SUFFIX => '.fits'); 176 my $tempPixels = $tempfile->filename; 177 178 # Run burntool 179 $status = vsystem ("$funpack -S $rawImfileReal > $tempPixels", $REALRUN); 180 if ($status) { 181 &my_die("failed on funpack",$exp_id,$class_id); 182 } 183 if ($previousTable ne '') { 184 $status = vsystem ("$burntool $tempPixels $previousTable out=$outTableReal tableonly=t persist=t", $REALRUN); 185 } 186 else { 187 $status = vsystem ("$burntool $tempPixels out=$outTableReal tableonly=t persist=t", $REALRUN); 188 } 189 if ($status) { 190 &my_die("failed on burntool",$exp_id,$class_id); 191 } 192 &my_die("Unable to find output file: $outTableReal", $exp_id, $class_id) unless $ipprc->file_exists($outTableReal); 193 194 $status = vsystem ("$nebXattr --write $outTable user.copies:2", $REALRUN); 195 if ($status) { 196 &my_die("failed to neb-xattr imfile", $outTable); 197 } 198 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state $outState", $REALRUN); 199 if ($status) { 200 &my_die("failed to update imfile"); 201 } 202 203 $previousTableStyle = -1; 204 205 print "\n"; 206 } 207 204 208 if ($previousTableStyle == 1) { 205 $previousTable = "infits=$rawImfileReal";209 $previousTable = "infits=$rawImfileReal"; 206 210 } 207 211 elsif ($previousTableStyle == -1) { 208 $previousTable = "in=$outTableReal";212 $previousTable = "in=$outTableReal"; 209 213 } 210 214 else { 211 die "previousTableStyle undefined!\n";212 } 213 214 } 215 215 die "previousTableStyle undefined!\n"; 216 } 217 218 } 219 216 220 exit 0; 217 221 … … 221 225 222 226 print "$command\n"; 223 227 224 228 my $status = 0; 225 229 if ($realrun) { 226 $status = system ($command);230 $status = system ($command); 227 231 } 228 232 … … 233 237 my $message = shift; 234 238 if ($#_ != -1) { 235 my $exp_id = shift;236 my $class_id = shift;237 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1);239 my $exp_id = shift; 240 my $class_id = shift; 241 vsystem("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -burntool_state -3",1); 238 242 } 239 243 printf STDERR "$message\n"; -
Property svn:executable
set to
Note:
See TracChangeset
for help on using the changeset viewer.
