Changeset 42835
- Timestamp:
- May 9, 2025, 9:17:20 AM (12 months ago)
- Location:
- trunk/ippScripts
- Files:
-
- 5 edited
- 5 copied
-
Build.PL (modified) (1 diff)
-
scripts/addstar_run.pl (modified) (6 diffs)
-
scripts/dist_bundle.pl (modified) (1 diff)
-
scripts/stack_skycell.pl (modified) (1 diff)
-
scripts/staticsky.pl (modified) (1 diff)
-
scripts/xccal.pl (copied) (copied from branches/eam_branches/ipp-20230313/ippScripts/scripts/xccal.pl )
-
scripts/xcff_summary.pl (copied) (copied from branches/eam_branches/ipp-20230313/ippScripts/scripts/xcff_summary.pl )
-
scripts/xcff_warp.pl (copied) (copied from branches/eam_branches/ipp-20230313/ippScripts/scripts/xcff_warp.pl )
-
scripts/xcsky.pl (copied) (copied from branches/eam_branches/ipp-20230313/ippScripts/scripts/xcsky.pl )
-
scripts/xcstack_skycell.pl (copied) (copied from branches/eam_branches/ipp-20230313/ippScripts/scripts/xcstack_skycell.pl )
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/Build.PL
r42388 r42835 156 156 scripts/remote_md5sum.pl 157 157 scripts/fpcamera_exp.pl 158 scripts/xcstack_skycell.pl 159 scripts/xcsky.pl 160 scripts/xccal.pl 161 scripts/xcff_warp.pl 162 scripts/xcff_summary.pl 158 163 )], 159 164 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
trunk/ippScripts/scripts/addstar_run.pl
r42712 r42835 30 30 my $missing_tools; 31 31 my $addtool = can_run('addtool') or (warn "Can't find addtool" and $missing_tools = 1); 32 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1);33 32 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 34 33 my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1); 35 36 # these are only used by addstar_run, not addstar_multi37 my $fftool = can_run('fftool') or (warn "Can't find fftool" and $missing_tools = 1);38 34 my $loadgalphot = can_run('loadgalphot') or (warn "Can't find loadgalphot" and $missing_tools = 1); 39 35 … … 44 40 my $minidvodb_path; 45 41 46 my ( $add_id, $camera, $stage, $stage_id, $ stage_extra1, $outroot, $stageroot, $dbname, $reduction,42 my ( $add_id, $camera, $stage, $stage_id, $outroot, $stageroot, $dbname, $reduction, 47 43 $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, 48 44 $no_update, $no_op, $redirect, $save_temps, $addrun_host); … … 52 48 'stage|s=s' => \$stage, # Camera 53 49 'stage_id|w=s' => \$stage_id, 54 'stage_extra1|w=s' => \$stage_extra1, # the number for a staticskymulti (for finding cmf), or stack_id55 50 'dbname|d=s' => \$dbname, # Database name 56 51 'outroot|w=s' => \$outroot, # output file base name … … 83 78 defined $addrun_host and 84 79 defined $camera; 85 if ($stage =~ /cam/ && !defined $stage_id) { 86 my_die("cam stage requires -stage_id", $add_id, 3); 87 88 } 89 if ($minidvodb && !defined($minidvodb_group)) { 90 my_die( "missing minidvodb_group", $add_id, 3 ); 91 } 80 81 my $dtime_addstar = 0; 82 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 83 84 # XXX EAM : 20240204 : not sure this is needed anymore: 85 if ($stage =~ /cam/ && !defined $stage_id) { my_die("cam stage requires -stage_id", $add_id, 3); } 86 if ($minidvodb && !defined($minidvodb_group)) { my_die( "missing minidvodb_group", $add_id, 3 ); } 87 92 88 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $add_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 93 89 94 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 90 my $logDest = $ipprc->filename("LOG.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 91 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 95 92 96 93 if ($redirect) { … … 106 103 $ipprc->outroot_prepare($outroot); 107 104 108 109 #110 105 # Step 1: sort out reductions / recipes 111 #112 113 106 114 107 # Recipes to use based on reduction class 115 108 $reduction = 'DEFAULT' unless defined $reduction; 116 #if ($stage =~/diff/) { 117 # $reduction = 'ADDSTAR'; 118 #} 119 #if ($stage =~/fullforce/) { 120 # $reduction = 'ADDSTAR'; 121 #} 122 123 if ($stage eq 'fullforce') { 124 $reduction='DEFAULT'; 125 #hardwired because why not 126 } 127 elsif ($stage eq 'fullforce_summary') { 128 $reduction = 'DEFAULT'; 129 } 130 elsif ($stage eq 'diff') { 131 $reduction='DEFAULT'; 132 #hardwired because why not 133 } 134 135 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); 136 # XXX This is now not used: do we still need it? 137 if ($stage eq 'cam') { 138 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 139 } 140 elsif ($stage eq 'stack') { 141 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STACK'); # Recipe to use 142 } 143 elsif ($stage eq 'skycal') { 144 $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 145 } 146 #if ($stage =~/staticsky/) { 147 # $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STATICSKY'); # Recipe to use 148 #} 149 150 109 110 my $recipe_addstar; 111 112 # choose the recipe based on the stage: 113 # this probably should have different recipes for each possible stage 114 if ($stage eq 'cam') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } 115 if ($stage eq 'skycal') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 116 if ($stage eq 'diff') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 117 if ($stage eq 'fullforce') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 118 if ($stage eq 'fullforce_summary') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 119 if ($stage eq 'xcff') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 120 if ($stage eq 'xcff_summary') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); } # Recipe to use 121 122 # XXX stack and staticsky are no longer allowed stages: need to use 'skycal' outputs 123 # if ($stage eq 'stack') { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STACK'); } # Recipe to use 124 # if ($stage =~/staticsky/) { $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR_STATICSKY'); } 151 125 152 126 &my_die("Unrecognised ADDSTAR recipe", $add_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar; 153 127 154 155 128 # the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs 156 129 157 #158 130 # Step 2: Determine where sources should come from, modify them as needed. 159 #160 161 131 162 132 # it was PSASTRO.OUTPUT 163 133 164 134 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT", $stageroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 165 my $fpaObjectsAlt = $fpaObjects; 166 167 if ($stage eq 'skycal') { 168 #should be ok for skycal? 169 print "using $fpaObjects for $stage\n"; 170 } 171 elsif ($stage eq 'diff') { 172 print "using $fpaObjects for $stage\n"; 173 } 174 elsif ($stage eq 'fullforce') { 175 print "using $fpaObjects for $stage\n"; 176 } 177 178 if ($stage eq 'cam') { 179 # if it is cam stage we need to be careful when grabbing the filename. 180 # This breaks down into a few steps: 181 182 #get info about the cam_id 183 my $magicked; 184 { 185 my $mdcParser = PS::IPP::Metadata::Config->new; 186 my $command = "$camtool -processedexp -cam_id " . $stage_id; 187 $command .= " -dbname $dbname" if defined $dbname; 188 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 189 run(command => $command, verbose => $verbose); 190 &my_die( "Unable to get info on camRun", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 191 if (scalar @$stdout_buf == 0 ) { #it lists nothing if it is the first 192 &my_die( "empty camRun", $add_id, $PS_EXIT_SYS_ERROR); 193 print "listing nothing\n"; 194 } else { 195 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 196 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 197 #this fails if there is nothing listed. I checked. 198 my $components = parse_md_list($metadata) or 199 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 200 my $comp = $$components[0]; 201 my $mparsed = $comp->{magicked}; 202 203 if (!defined($mparsed)) { 204 &my_die("Unable to parse magicked", $add_id, $PS_EXIT_PROG_ERROR); 205 } #but just to make sure, have it grab a minidvodb_name, to make sure it's not junk. 206 print "found a value for magicked:$mparsed\n"; 207 $magicked = $mparsed; 208 } 209 210 #is this cam_id magicked or not? 211 if ($magicked) { 212 $stage_extra1 = $magicked; 213 $fpaObjects = $ipprc->destreaked_filename("$fpaObjects") or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 214 print "cam_id is magicked, using $fpaObjects for the cam smf\n"; 215 } else { 216 print "cam_id is NOT magicked, using $fpaObjects for the cam smf\n"; 217 } 218 } 219 } 220 221 if (($stage eq 'stack') || 222 ($stage eq 'skycal') || 223 ($stage eq 'diff') || 224 ($stage eq 'fullforce')|| 225 ($stage eq 'fullforce_summary')) { 226 $fpaObjects =~ s/smf$/cmf/; 227 $fpaObjectsAlt =~ s/smf$/cmf/; 228 } 229 230 my $fpaObjects1; 231 my $fpaObjects2; 232 my $checkalt = 0; 233 if ($stage eq 'staticsky') { 234 $checkalt = 1; 235 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $stageroot); #this is mostly rigtht except the .cmf needs either 236 # .000.cmf or .stk.xxxxx.cmf 237 print "$sources\n\n\n"; 238 &my_die( "can't find the filter_num for staticsky_multi, giving up.", $add_id, $PS_EXIT_SYS_ERROR) unless (defined $stage_extra1); 239 240 241 $fpaObjects1 = $sources; 242 $fpaObjects2 = $sources; 243 $fpaObjects = $sources; 244 245 my $nice_num = sprintf ("%03d", $stage_extra1); 246 247 $fpaObjects1 =~ s/cmf$/stk.$stage_extra1.cmf/; 248 $fpaObjects2 =~ s/cmf$/$nice_num.cmf/; #this make it look for .001.cmf, etc 249 # we have 3 of them to try 250 my $realFile = $ipprc->file_resolve($fpaObjects); 251 my $realFile1 = $ipprc->file_resolve($fpaObjects1); 252 my $realFile2 = $ipprc->file_resolve($fpaObjects2); 253 if (!defined($realFile1)) { 254 if (!defined($realFile2)) { 255 print "using $fpaObjects\n"; 256 257 } else { 258 print "using $fpaObjects2\n"; 259 $fpaObjects = $fpaObjects2; 260 } 261 262 } else { 263 print "using $fpaObjects1\n"; 264 $fpaObjects = $fpaObjects1; 265 } 266 } 267 268 269 # 135 136 # XXX EAM 2024.02.04 : I am stripping out support for magic here: 137 138 # the following stages generate files with extension 'cmf' not 'smf': 139 if ($stage eq 'skycal') { $fpaObjects =~ s/smf$/cmf/; } 140 if ($stage eq 'diff') { $fpaObjects =~ s/smf$/cmf/; } 141 if ($stage eq 'fullforce') { $fpaObjects =~ s/smf$/cmf/; } 142 if ($stage eq 'fullforce_summary') { $fpaObjects =~ s/smf$/cmf/; } 143 144 # XXX EAM 2024.02.04 : I am stripping out support for staticsky output here: 145 270 146 # Step 3 Set up addtool/loadgalphot commands. 271 # 272 273 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot) or &my_die("Missing entry from camera config", $add_id, $PS_EXIT_CONFIG_ERROR); 274 147 275 148 # convert supplied DVO database name to UNIX filename 276 149 my $dvodbReal; 277 if (defined $dvodb) { 278 $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO 279 $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR); 280 } 281 282 my $dtime_addstar = 0; 283 if (defined $dvodbReal) { 284 if ($minidvodb) { 285 my $command = "$addtool -listminidvodbrun "; 286 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 287 $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 288 $command .= " -state 'active' -limit 1"; 289 $command .= " -dbname $dbname" if defined $dbname; 290 print $command; 291 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 292 run(command => $command, verbose => $verbose); 293 &my_die( "Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR) unless $success; 294 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 295 &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 296 297 my $components = parse_md_list($metadata) or 298 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 299 my $comp = $$components[0]; 300 $minidvodb_path = $comp->{minidvodb_path}; 301 $minidvodb_name = $comp->{minidvodb_name}; 302 $addrun_host = $comp->{addrun_host}; 303 304 if (!defined($minidvodb_path)) { 305 &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR); 150 $dvodbReal = $ipprc->dvo_catdir( $dvodb ); # catdir for DVO 151 $dvodbReal = $ipprc->convert_filename_absolute( $dvodbReal ) or &my_die("can't get path for dvodb", $add_id, $PS_EXIT_CONFIG_ERROR); 152 unless (defined $dvodbReal) { &my_die("dvodbReal not defined", $add_id, $PS_EXIT_CONFIG_ERROR); } ## XXX probably redundant with previous line 153 154 # the supplied dvodb entry is not the real target if a minidvodb is supplied 155 if ($minidvodb) { 156 my $command = "$addtool -listminidvodbrun "; 157 $command .= " -minidvodb_group $minidvodb_group" if defined $minidvodb_group; 158 $command .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 159 $command .= " -state 'active' -limit 1"; 160 $command .= " -dbname $dbname" if defined $dbname; 161 print $command; 162 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 163 my $error_code = &parse_error_message ($success, $error_msg, $command); 164 unless ($success) { 165 &my_die("Unable to get active minidvodb_name", $add_id, $PS_EXIT_SYS_ERROR); 166 } 167 168 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or &my_die("Unable to parse metadata config", $add_id, $PS_EXIT_PROG_ERROR); 169 170 my $components = parse_md_list($metadata) or &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 171 172 my $comp = $$components[0]; 173 $minidvodb_path = $comp->{minidvodb_path}; 174 $minidvodb_name = $comp->{minidvodb_name}; 175 $addrun_host = $comp->{addrun_host}; 176 177 if (!defined($minidvodb_path)) { &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR); } 178 if (!defined($minidvodb_name)) { &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); } 179 } else { 180 $minidvodb_path = $dvodbReal; 181 } 182 183 if ($no_op) { &update_database; exit 0; } 184 185 print "target CATDIR: $dvodbReal\n"; 186 ## addstar can either save the full set of detections, or just 187 ## the image metadata, in the dvodb. this is set in the 188 ## database table addRun 189 190 # addstar requires the user to have a valid .ptolemyrc which 191 # in turn points at ippconfig/dvo.site 192 193 # get the names for the camera and the real input file 194 my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar 195 196 my $realFile = $ipprc->file_resolve($fpaObjects) or &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR); 197 198 # most cameras use CHIP_HEADER. other exceptions: 199 # gpc1 @ camera : PHU_HEADER 200 # gpc1 @ staticsky : NOMINAL (is uncalibrated) 201 202 # temporary hard-wired info 203 my $zeroPointOption = "CHIP_HEADER"; 204 my $zeroPointKeyword = "ZPT_OBS"; 205 206 if (($camdir =~ /gpc1/) && ($stage =~ /cam/)) { $zeroPointOption = "PHU_HEADER"; } 207 if ($stage eq "diff") { $zeroPointKeyword = "FPA.ZP"; } 208 if ($stage eq "xcff") { $zeroPointKeyword = "FPA.ZP"; } 209 if ($stage eq "xcff_summary") { $zeroPointKeyword = "FPA.ZP"; } 210 211 my $command; 212 213 if (($stage ne 'fullforce_summary') && ($stage ne 'xcff_summary')) { 214 print "Using command ADDSTAR\n"; 215 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 216 $command = "$addstar -update"; # XXX optionally set -update? 217 $command .= " -D CAMERA $camdir"; 218 $command .= " -D CATDIR $minidvodb_path"; 219 $command .= " -D ZERO_POINT_OPTION $zeroPointOption"; 220 $command .= " -D ZERO_POINT_KEYWORD $zeroPointKeyword"; 221 $command .= " $realFile"; 222 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 223 $command .= " -image" if $image_only; 224 225 # some stages require alternate options: 226 if ($stage eq "skycal") { $command .= " -quick-airmass"; } 227 if ($stage eq "diff") { $command .= " -accept-astrom"; } 228 if ($stage eq "fullforce") { $command .= " -accept-astrom -xrad"; } 229 if ($stage eq "xcff") { $command .= " -accept-astrom -xrad"; } 230 231 # if ($stage =~ /staticsky/) { $command .= " -accept-astrom -quick-airmass"; } 232 233 } else { # Full force summary case 234 print "Using command LOADGALPHOT\n"; 235 236 $command = "$loadgalphot -v "; 237 $command .= " -D CAMERA $camdir "; 238 $command .= " -D CATDIR $minidvodb_path "; 239 $command .= " $realFile "; 240 $command .= " -image-id $stage_id "; 241 } 242 243 ### actually run the addstar (or loadgalphot) command here: 244 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 245 my $error_code = &parse_error_message ($success, $error_msg, $command); 246 unless ($success) { &my_die("Unable to perform addstar: $error_code", $add_id, $error_code); } 247 248 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script 249 250 &update_database; 251 exit 0; 252 253 sub update_database { 254 # This needs to be updated when addtool is written. BROKEN 255 my $fpaCommand = "$addtool -addprocessedexp"; 256 $fpaCommand .= " -add_id $add_id"; 257 $fpaCommand .= " -dtime_addstar $dtime_addstar"; 258 259 $fpaCommand .= " -path_base $outroot"; 260 $fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path; 261 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 262 $fpaCommand .= " -addrun_host $addrun_host" if defined $addrun_host; 263 $fpaCommand .= " -dbname $dbname" if defined $dbname; 264 265 print $fpaCommand; 266 267 # Add the result into the database 268 unless ($no_update) { 269 my ( $success, $error_msg, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $fpaCommand, verbose => $verbose); 270 my $error_code = &parse_error_message ($success, $error_msg, $command); 271 unless ($success) { 272 warn("Unable to add result to database: $error_code\n"); 273 exit($error_code); 306 274 } 307 if (!defined($minidvodb_name)) { 308 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 309 } 275 } else { 276 print "skipping command: $fpaCommand\n"; 310 277 } 311 else { 312 $minidvodb_path = $dvodbReal; 313 } 314 315 unless ($no_op) { 316 print "$dvodbReal\n"; 317 ## addstar can either save the full set of detections, or just 318 ## the image metadata, in the dvodb. this is set in the 319 ## database table addRun 320 321 # addstar requires the user to have a valid .ptolemyrc which 322 # in turn points at ippconfig/dvo.site 323 324 # get the names for the camera and the real input file 325 my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar 326 327 my $realFile = $ipprc->file_resolve($fpaObjects) or &my_die("Unable to resolve $fpaObjects", $add_id, $PS_EXIT_SYS_ERROR); 328 329 # most cameras use CHIP_HEADER. other exceptions: 330 # gpc1 @ camera : PHU_HEADER 331 # gpc1 @ staticsky : NOMINAL (is uncalibrated) 332 333 # temporary hard-wired info 334 my $zeroPointOption = "CHIP_HEADER"; 335 my $zeroPointKeyword = "ZPT_OBS"; 336 if (($camdir =~ /gpc1/) && ($stage =~ /staticsky/)) { 337 $zeroPointOption = "NOMINAL"; 338 } 339 if (($camdir =~ /gpc1/) && ($stage =~ /cam/)) { 340 $zeroPointOption = "PHU_HEADER"; 341 } 342 if ($stage eq "diff") { 343 $zeroPointKeyword = "FPA.ZP"; 344 } 345 346 my $command; 347 348 if ($stage ne 'fullforce_summary') { 349 # print "IN ADDSTAR VERSION\n"; 350 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 351 $command = "$addstar -update"; # XXX optionally set -update? 352 $command .= " -force-single-time"; # IPP-676 time difference for chips causes dvo mosaic issue 353 $command .= " -D CAMERA $camdir"; 354 $command .= " -D CATDIR $minidvodb_path"; 355 $command .= " -D ZERO_POINT_OPTION $zeroPointOption"; 356 $command .= " -D ZERO_POINT_KEYWORD $zeroPointKeyword"; 357 $command .= " $realFile"; 358 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference 359 $command .= " -image" if $image_only; 360 if ($stage =~ /staticsky/) { 361 $command .= " -accept-astrom -quick-airmass"; 362 } #careful here - this matches staticsky and staticsky_multi 363 if ($stage =~ /skycal/) { 364 $command .= " -quick-airmass"; 365 } #careful here - this matches staticsky and staticsky_multi 366 if ($stage =~ /diff/) { 367 $command .= " -accept-astrom"; 368 } 369 if ($stage =~ /fullforce/) { 370 $command .= " -accept-astrom -xrad"; 371 } 372 } 373 else { # Full force summary case 374 # print "IN LOADGALPHOT VERSION\n"; 375 # We need to know the filter to set up the photcode, as the summaries do not include that in the header. 376 # We /could/ set up the addtool stuff to pass that in to the script when needed, but that would require adding 377 # a lot of extra hooks and option handlers. Therefore, call out to fftool, and get the filter that way, and 378 # construct the correct photcode. 379 380 my $photcode = ''; 381 { 382 my $ff_command = "$fftool -dbname ${dbname} -summary -ff_id ${stage_id}"; 383 print "$ff_command\n"; 384 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 385 run(command => $ff_command, verbose => $verbose); 386 unless ($success) { 387 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 388 &my_die("Unable to fetch filter via fftool: $error_code", $add_id, $error_code); 389 } 390 my $MDlist = $mdcParser->parse(join "", @$stdout_buf) or 391 &my_die("Unable to determine ff summary information.", $add_id, $error_code); 392 my $metadata = parse_md_list($MDlist); 393 my $ffSummary = $metadata->[0]; 394 my $filter = $ffSummary->{filter}; 395 my $stack_id = $ffSummary->{stack_id}; 396 397 $filter =~ s/\.00000//; 398 $photcode = "GPC1.${filter}.ForcedWarp"; 399 } 400 401 $command = "$loadgalphot -v "; 402 $command .= " -D CAMERA $camdir "; 403 $command .= " -D CATDIR $minidvodb_path "; 404 $command .= " $realFile "; 405 $command .= " -p $photcode "; 406 $command .= " -image-id $stage_id "; 407 } 408 409 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 410 411 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 412 run(command => $command, verbose => $verbose); 413 unless ($success) { 414 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 415 &my_die("Unable to perform addstar: $error_code", $add_id, $error_code); 416 } 417 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script 418 } 419 } 420 421 # This needs to be updated when addtool is written. BROKEN 422 my $fpaCommand = "$addtool -addprocessedexp"; 423 $fpaCommand .= " -add_id $add_id"; 424 $fpaCommand .= " -dtime_addstar $dtime_addstar"; 425 426 $fpaCommand .= " -path_base $outroot"; 427 $fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path; 428 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 429 $fpaCommand .= " -addrun_host $addrun_host" if defined $addrun_host; 430 $fpaCommand .= " -dbname $dbname" if defined $dbname; 431 432 $fpaCommand .= " -stage_extra1 $stage_extra1" if defined $stage_extra1; 433 434 print $fpaCommand; 435 436 # Add the result into the database 437 unless ($no_update) { 438 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 439 run(command => $fpaCommand, verbose => $verbose); 440 unless ($success) { 441 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 442 warn("Unable to add result to database: $error_code\n"); 443 exit($error_code); 444 } 445 } else { 446 print "skipping command: $fpaCommand\n"; 447 } 448 278 } 449 279 450 280 sub my_die … … 474 304 } 475 305 306 # if the program exited normally, the exit value is returned 307 # if the program exited with a signal (abort, crash, etc), PS_EXIT_PROG_ERROR (4) is returned 308 # if the program failed to run, -PS_EXIT_PROG_ERROR (-4) is returned 309 sub parse_error_message { 310 my $success = shift; 311 my $error_msg = shift; 312 my $command = shift; 313 314 if ($success) { return 0; } 315 316 print "raw error_msg: $error_msg\n"; 317 print "full command: $command\n"; 318 319 if (&looks_like_number($error_msg)) { return (($error_msg >> 8) or ($PS_EXIT_PROG_ERROR)); } 320 321 # which of these match? 322 my ($error_code) = $error_msg =~ m/exited with value (\d+)/; 323 if (defined $error_code) { return $error_code; } 324 325 ($error_code) = $error_msg =~ m/died with signal (\d+)/; 326 # if (defined $error_code) { return (128 + $error_code); } 327 if (defined $error_code) { return ($PS_EXIT_PROG_ERROR); } 328 329 # probably failed to execute: 330 return (-1*$PS_EXIT_PROG_ERROR); 331 } 332 476 333 END { 477 334 my $status = $?; -
trunk/ippScripts/scripts/dist_bundle.pl
r42730 r42835 73 73 my %empty_cleaned = (); 74 74 75 # no longer needed: magic is no longer used 76 # my $streaksrelease = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1); 77 75 78 # Look for programs we need 76 79 my $missing_tools; 77 my $streaksrelease = can_run('streaksrelease') or (warn "Can't find streaksrelease" and $missing_tools = 1);80 my $streaksrelease = '/bin/false'; 78 81 my $bgtool = can_run('bgtool') or (warn "Can't find bgtool" and $missing_tools = 1); 79 82 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); -
trunk/ippScripts/scripts/stack_skycell.pl
r42099 r42835 185 185 my $recipe_psphot = $ipprc->reduction($reduction, 'STACK_PSPHOT'); # Recipe to use for psphot 186 186 my $recipe_ppstats = 'STACKSTATS'; 187 if ($ 188 run_state eq 'update') { 187 if ($run_state eq 'update') { 189 188 $recipe_ppstats = 'WARPSTATS'; 190 189 } -
trunk/ippScripts/scripts/staticsky.pl
r40803 r42835 162 162 print "input: $path_base\n"; 163 163 my $stack_id = $file->{stack_id}; 164 print "stack_id: $stack_id\n"; 164 165 165 166 my ($imageCnv, $maskCnv, $weightCnv, $expnumCnv);
Note:
See TracChangeset
for help on using the changeset viewer.
