Changeset 38937 for trunk/ippScripts
- Timestamp:
- Oct 21, 2015, 5:44:52 PM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/addstar_run.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/addstar_run.pl
r38090 r38937 31 31 my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1); 32 32 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 33 my $fftool = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1); 34 33 35 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 36 34 37 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 38 my $loadgalphot = can_run('loadgalphot') or (warn "Can't find loadgalphot" and $missing_tools = 1); 39 35 40 if ($missing_tools) { 36 41 warn("Can't find required tools."); … … 92 97 } 93 98 99 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 100 101 # Output products 102 $ipprc->outroot_prepare($outroot); 103 104 105 # 106 # Step 1: sort out reductions / recipes 107 # 108 109 94 110 # Recipes to use based on reduction class 95 111 $reduction = 'DEFAULT' unless defined $reduction; … … 101 117 #} 102 118 103 if ($stage =~/fullforce/) {119 if ($stage eq 'fullforce') { 104 120 $reduction='DEFAULT'; 105 121 #hardwired because why not 106 122 } 107 if ($stage =~/diff/) { 123 elsif ($stage eq 'fullforce_summary') { 124 $reduction = 'DEFAULT'; 125 } 126 elsif ($stage eq 'diff') { 108 127 $reduction='DEFAULT'; 109 128 #hardwired because why not … … 112 131 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); 113 132 # XXX This is now not used: do we still need it? 114 if ($stage =~/cam/) {133 if ($stage eq 'cam') { 115 134 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 116 135 } 117 if ($stage =~/stack/) {136 elsif ($stage eq 'stack') { 118 137 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STACK'); # Recipe to use 138 } 139 elsif ($stage eq 'skycal') { 140 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 119 141 } 120 142 #if ($stage =~/staticsky/) { 121 143 # $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STATICSKY'); # Recipe to use 122 144 #} 123 if ($stage =~/skycal/) {124 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use125 }126 145 127 146 … … 129 148 &my_die("Unrecognised ADDSTAR recipe", $add_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar; 130 149 131 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files132 133 # Output products134 $ipprc->outroot_prepare($outroot);135 150 136 151 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs 152 153 # 154 # Step 2: Determine where sources should come from, modify them as needed. 155 # 156 137 157 138 158 # it was PSASTRO.OUTPUT … … 141 161 my $fpaObjectsAlt = $fpaObjects; 142 162 143 if ($stage =~ /skycal/) {163 if ($stage eq 'skycal') { 144 164 #should be ok for skycal? 145 165 print "using $fpaObjects for $stage\n"; 146 166 } 147 if ($stage =~/diff/) {167 elsif ($stage eq 'diff') { 148 168 print "using $fpaObjects for $stage\n"; 149 169 } 150 if ($stage =~/fullforce/) {170 elsif ($stage eq 'fullforce') { 151 171 print "using $fpaObjects for $stage\n"; 152 172 } 153 173 154 155 156 if ($stage =~ /cam/) { 174 if ($stage eq 'cam') { 157 175 # if it is cam stage we need to be careful when grabbing the filename. 158 176 # This breaks down into a few steps: … … 197 215 } 198 216 199 if (($stage =~/stack/ || $stage =~ /skycal/ || $stage =~/diff/ || $stage=~/fullforce/)) { 217 if (($stage eq 'stack') || 218 ($stage eq 'skycal') || 219 ($stage eq 'diff') || 220 ($stage eq 'fullforce')|| 221 ($stage eq 'fullforce_summary')) { 200 222 $fpaObjects =~ s/smf$/cmf/; 201 223 $fpaObjectsAlt =~ s/smf$/cmf/; 202 203 224 } 204 225 … … 206 227 my $fpaObjects2; 207 228 my $checkalt = 0; 208 if ($stage =~/staticsky/) {229 if ($stage eq 'staticsky') { 209 230 $checkalt = 1; 210 231 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $stageroot); #this is mostly rigtht except the .cmf needs either … … 239 260 $fpaObjects = $fpaObjects1; 240 261 } 241 242 243 } 262 } 263 264 265 # 266 # Step 3 Set up addtool/loadgalphot commands. 267 # 244 268 245 269 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); … … 251 275 $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR); 252 276 } 277 253 278 my $dtime_addstar = 0; 254 279 if (defined $dvodbReal) { 255 280 if ($minidvodb) { 256 my $command = " addtool -listminidvodbrun ";281 my $command = "$addtool -listminidvodbrun "; 257 282 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 258 283 $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; … … 285 310 unless ($no_op) { 286 311 print $dvodbReal; 287 288 312 ## addstar can either save the full set of detections, or just 289 313 ## the image metadata, in the dvodb. this is set in the … … 311 335 } 312 336 313 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 314 my $command = "$addstar -update"; # XXX optionally set -update? 315 $command .= " -D CAMERA $camdir"; 316 $command .= " -D CATDIR $minidvodb_path"; 317 $command .= " -D ZERO_POINT_OPTION $zeroPointOption"; 318 $command .= " $realFile"; 319 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 320 $command .= " -image" if $image_only; 321 if ($stage =~ /staticsky/) { 322 $command .= " -accept-astrom -quick-airmass"; 323 } #careful here - this matches staticsky and staticsky_multi 324 if ($stage =~ /skycal/) { 325 $command .= " -quick-airmass"; 326 } #careful here - this matches staticsky and staticsky_multi 327 if ($stage =~ /diff/) { 328 $command .= " -accept-astrom"; 337 my $command; 338 339 if ($stage ne 'fullforce_summary') { 340 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 341 $command = "$addstar -update"; # XXX optionally set -update? 342 $command .= " -D CAMERA $camdir"; 343 $command .= " -D CATDIR $minidvodb_path"; 344 $command .= " -D ZERO_POINT_OPTION $zeroPointOption"; 345 $command .= " $realFile"; 346 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 347 $command .= " -image" if $image_only; 348 if ($stage =~ /staticsky/) { 349 $command .= " -accept-astrom -quick-airmass"; 350 } #careful here - this matches staticsky and staticsky_multi 351 if ($stage =~ /skycal/) { 352 $command .= " -quick-airmass"; 353 } #careful here - this matches staticsky and staticsky_multi 354 if ($stage =~ /diff/) { 355 $command .= " -accept-astrom"; 356 } 357 if ($stage =~ /fullforce/) { 358 $command .= " -accept-astrom -xrad"; 359 } 329 360 } 330 if ($stage =~ /fullforce/) { 331 $command .= " -accept-astrom -xrad"; 361 else { # Full force summary case 362 # We need to know the filter to set up the photcode, as the summaries do not include that in the header. 363 # We /could/ set up the addtool stuff to pass that in to the script when needed, but that would require adding 364 # a lot of extra hooks and option handlers. Therefore, call out to fftool, and get the filter that way, and 365 # construct the correct photcode. 366 367 my $photcode = ''; 368 { 369 my $ff_command = "$fftool -dbname ${dbname} -summary -ff_id ${stage_id}"; 370 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 371 run(command => $command, verbose => $verbose); 372 unless ($success) { 373 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 374 &my_die("Unable to fetch filter via fftool: $error_code", $add_id, $error_code); 375 } 376 my $MDlist = $mdcParser->parse(join "", @$stdout_buf) or 377 &my_die("Unable to determine ff summary information.", $add_id, $error_code); 378 my $metadata = parse_md_list($MDlist); 379 my $ffSummary = $metadata->[0]; 380 my $filter = $ffSummary->{filter}; 381 382 $filter =~ s/\.00000//; 383 $photcode = "GPC1.${filter}.ForcedWarp"; 384 } 385 386 $command = "$loadgalphot -v "; 387 $command .= " -D CAMERA $camdir "; 388 $command .= " -D CATDIR $minidvodb_path "; 389 $command .= " $realFile "; 390 $command .= " -p $photcode "; 332 391 } 333 392 334 393 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 335 394 336 395 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 337 396 run(command => $command, verbose => $verbose);
Note:
See TracChangeset
for help on using the changeset viewer.
