Changeset 25027 for branches/pap/tools/ipp_apply_burntool.pl
- Timestamp:
- Aug 7, 2009, 4:08:25 PM (17 years ago)
- Location:
- branches/pap
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tools/ipp_apply_burntool.pl (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap
- Property svn:mergeinfo changed
-
branches/pap/tools/ipp_apply_burntool.pl
r23585 r25027 20 20 use Pod::Usage qw( pod2usage ); 21 21 22 my ( $class_id, $dateobs_begin, $dateobs_end, $skip_burned, $ dbname, $verbose, $save_temps);22 my ( $class_id, $dateobs_begin, $dateobs_end, $skip_burned, $rerun_from_first, $dbname, $logfile, $verbose, $save_temps); 23 23 GetOptions( 24 24 'class_id=s' => \$class_id, # chip identifier … … 26 26 'dateobs_end=s' => \$dateobs_end, # exposure date/time range stop 27 27 'dbname|d=s' => \$dbname, # Database name 28 'logfile=s' => \$logfile, 28 29 'skip_burned' => \$skip_burned, # Print to stdout 30 'rerun_from_first' => \$rerun_from_first, # Print to stdout 29 31 'verbose' => \$verbose, # Print to stdout 30 32 'save-temps' => \$save_temps, # Save temporary files? … … 41 43 defined $dbname; 42 44 45 if ($skip_burned and $rerun_from_first) { &my_die("-rerun_from_first and -skip_burned are incompatible"); } 46 43 47 my $missing_tools; 44 48 my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); … … 57 61 $command .= " -dateobs_begin $dateobs_begin"; 58 62 $command .= " -dateobs_end $dateobs_end"; 59 # $command .= " -limit 20";63 $command .= " -ordered_by_date"; 60 64 $command .= " -dbname $dbname" if defined $dbname; 61 65 … … 87 91 my $ipprc = PS::IPP::Config->new() or my_die("Unable to set up"); 88 92 93 $ipprc->redirect_output($logfile) if $logfile; 94 89 95 my $Nfiles = @files; 90 96 print "files: $Nfiles\n"; 91 97 92 98 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) { 106 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); 118 if ($status) { 119 &my_die("failed to update imfile"); 120 } 121 $file->{user_1} = 0.1; 122 } 123 } 93 124 94 125 my $prevFileOpt = ""; 95 126 foreach my $file (@files) { 96 127 my $exp_id = $file->{exp_id}; 97 if ($skip_burned and ($file->{user_1} > 0.5)) { next; }98 128 99 129 my $rawImfile = $file->{uri}; … … 104 134 ($rawImfileReal) = $rawImfile =~ m|^neb:/(.*)|; 105 135 } 106 #print "rawImfile: $rawImfile -> $rawImfileReal\n";136 print "rawImfile: $rawImfile -> $rawImfileReal\n"; 107 137 108 138 # mangle name, create tmp file (always a UNIX file) … … 120 150 # print "outImfile: $outImfile -> $outImfileReal\n"; 121 151 122 # destination for the burntool artifacts 123 my $artImfile = $rawImfile; 124 $artImfile =~ s/fits$/burn.tbl/; 125 my $artImfileReal = $ipprc->file_resolve($artImfile, 1); 126 # print "artImfile: $artImfile -> $artImfileReal\n"; 127 128 # uncompress the image (do we need to check if it is compressed?) 129 my $status = vsystem ("$funpack -S $rawImfileReal > $tmpImfileReal", $REALRUN); 130 if ($status) { 131 &my_die("failed on funpack"); 132 } 133 134 $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt", $REALRUN); 135 if ($status) { 136 &my_die("failed on burntool"); 137 } 138 139 # compress the image (do we need to check if it is compressed?) 140 $status = vsystem ("$fpack -S $tmpImfileReal > $outImfileReal", $REALRUN); 141 if ($status) { 142 &my_die("failed on fpack"); 143 } 144 145 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -user_1 1.0", 1); 146 if ($status) { 147 &my_die("failed to update imfile"); 148 } 149 152 # burntool now can write the artifacts to the fits file. 153 # destination for the burntool artifacts. use this if RAWTABLES is set. 154 my $artImfile; 155 my $artImfileReal; 156 if ($RAWTABLES) { 157 $artImfile = $rawImfile; 158 $artImfile =~ s/fits$/burn.tbl/; 159 $artImfileReal = $ipprc->file_resolve($artImfile, 1); 160 # print "artImfile: $artImfile -> $artImfileReal\n"; 161 } 162 163 print "$rawImfile : $skip_burned, $file->{user_1}\n"; 164 165 if (! ($skip_burned and ($file->{user_1} > 0.5))) { 166 print "running on: $rawImfile\n"; 167 # uncompress the image (do we need to check if it is compressed?) 168 my $status = vsystem ("$funpack -S $rawImfileReal > $tmpImfileReal", $REALRUN); 169 if ($status) { 170 &my_die("failed on funpack"); 171 } 172 173 if ($RAWTABLES) { 174 $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt", $REALRUN); 175 } else { 176 $status = vsystem ("$burntool $tmpImfileReal $prevFileOpt", $REALRUN); 177 } 178 if ($status) { 179 &my_die("failed on burntool"); 180 } 181 182 # compress the image (do we need to check if it is compressed?) 183 $status = vsystem ("$fpack -S $tmpImfileReal > $outImfileReal", $REALRUN); 184 if ($status) { 185 &my_die("failed on fpack"); 186 } 187 188 $status = vsystem ("$regtool -dbname $dbname -updateprocessedimfile -exp_id $exp_id -class_id $class_id -user_1 1.0", 1); 189 if ($status) { 190 &my_die("failed to update imfile"); 191 } 192 print "\n"; 193 } 150 194 # save the artifact file for the next image 151 $prevFileOpt = "in=$artImfileReal"; 152 print "\n"; 195 if ($RAWTABLES) { 196 $prevFileOpt = "in=$artImfileReal"; 197 } else { 198 $prevFileOpt = "infits=$artImfileReal"; 199 } 153 200 } 154 201
Note:
See TracChangeset
for help on using the changeset viewer.
