Changeset 34772 for branches/czw_branch/20120906/ippScripts
- Timestamp:
- Dec 6, 2012, 6:32:19 PM (14 years ago)
- Location:
- branches/czw_branch/20120906/ippScripts
- Files:
-
- 14 edited
-
Build.PL (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
scripts/addstar_run.pl (modified) (1 diff)
-
scripts/background_chip.pl (modified) (3 diffs)
-
scripts/background_warp.pl (modified) (3 diffs)
-
scripts/destreak_restore_camera.pl (modified) (2 diffs, 1 prop)
-
scripts/detrend_process_imfile.pl (modified) (2 diffs)
-
scripts/ipp_apply_burntool_single.pl (modified) (1 prop)
-
scripts/lap_science.pl (modified) (1 diff)
-
scripts/magic_destreak.pl (modified) (1 prop)
-
scripts/publish_file.pl (modified) (11 diffs)
-
scripts/regenerate_background.pl (modified) (8 diffs)
-
scripts/skycalibration.pl (modified) (3 diffs)
-
scripts/staticsky.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20120906/ippScripts/Build.PL
r33627 r34772 128 128 scripts/listvideocells.pl 129 129 scripts/skycalibration.pl 130 scripts/regenerate_background.pl 130 131 )], 131 132 dist_abstract => 'Scripts for running the Pan-STARRS IPP', -
branches/czw_branch/20120906/ippScripts/MANIFEST
r31435 r34772 46 46 scripts/skycell_jpeg.pl 47 47 scripts/lap_science.pl 48 scripts/regenerate_background.pl 48 49 t/00_distribution.t -
branches/czw_branch/20120906/ippScripts/scripts/addstar_run.pl
r34265 r34772 300 300 $command .= " -image" if $image_only; 301 301 if ($stage =~ /staticsky/) { 302 $command .= " -accept-astrom "; 302 $command .= " -accept-astrom -quick-airmass"; 303 } #careful here - this matches staticsky and staticsky_multi 304 if ($stage =~ /skycal/) { 305 $command .= " -quick-airmass"; 303 306 } #careful here - this matches staticsky and staticsky_multi 304 307 -
branches/czw_branch/20120906/ippScripts/scripts/background_chip.pl
r33054 r34772 73 73 74 74 if ($redirect) { 75 $ipprc->redirect_ output($logDest) or my_die( "Unable to redirect output", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR );75 $ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $chip_bg_id, $class_id, $PS_EXIT_SYS_ERROR ); 76 76 print STDOUT "\n\n"; 77 77 print STDOUT "Starting script $0 on $host\n\n"; … … 155 155 156 156 $ipprc->outroot_prepare($outroot); 157 my $out_image = $ipprc->filename("PPBACKGROUND.OUTPUT", $outroot, $class_id); 158 my $out_mask = $ipprc->filename("PPBACKGROUND.OUTPUT.MASK", $outroot, $class_id); 159 my $out_stats = $ipprc->filename("PPBACKGROUND.STATS", $outroot, $class_id); 160 my $out_config = $ipprc->filename("PPBACKGROUND.CONFIG", $outroot, $class_id); 161 my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id); 157 #my $out_image = $ipprc->filename("PPBACKGROUND.OUTPUT", $outroot, $class_id); 158 #my $out_mask = $ipprc->filename("PPBACKGROUND.OUTPUT.MASK", $outroot, $class_id); 159 #my $out_stats = $ipprc->filename("PPBACKGROUND.STATS", $outroot, $class_id); 160 #my $out_config = $ipprc->filename("PPBACKGROUND.CONFIG", $outroot, $class_id); 161 #my $traceDest = $ipprc->filename("TRACE.IMFILE", $outroot, $class_id); 162 163 my $out_image = prepare_output("PPBACKGROUND.OUTPUT", $outroot, $class_id, 1); 164 my $out_mask = prepare_output("PPBACKGROUND.OUTPUT.MASK", $outroot, $class_id, 1); 165 my $out_stats = prepare_output("PPBACKGROUND.STATS", $outroot, $class_id, 1); 166 my $out_config = prepare_output("PPBACKGROUND.CONFIG", $outroot, $class_id, 1); 167 my $traceDest = prepare_output("TRACE.IMFILE", $outroot, $class_id, 1); 162 168 163 169 # Run ppImage … … 238 244 ### Pau. 239 245 246 # Prepare to write to an output file 247 # Lookup the filename in the rules. 248 # Make sure that if file exists and is a nebulous file that there is only one instance 249 # Deal with files that have been lost. 250 sub prepare_output 251 { 252 my $filerule = shift; 253 my $outroot = shift; 254 my $class_id = shift; 255 my $delete = shift; 256 $delete = 0 if !defined $delete; 257 258 my $error; 259 my $output = $ipprc->prepare_output($filerule, $outroot, $class_id, $delete, \$error) 260 or &my_die("failed to prepare output file for: $filerule", $chip_bg_id, $class_id, $error); 261 return $output; 262 } 263 264 240 265 241 266 sub my_die -
branches/czw_branch/20120906/ippScripts/scripts/background_warp.pl
r33054 r34772 88 88 my $logDest = $ipprc->filename("LOG.EXP", $outroot, $skycell_id) or my_die( "Unable to get log filename", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR ); 89 89 90 $ipprc->redirect_ output($logDest) or my_die( "Unable to redirect output", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect;90 $ipprc->redirect_to_logfile($logDest) or my_die( "Unable to redirect output", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR ) if $redirect; 91 91 92 92 # Recipes to use based on reduction class … … 158 158 &my_die("Can't find input astrometry: $astrometry", $warp_bg_id, $skycell_id, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($astrometry); 159 159 160 my $out_image = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id ); 161 my $out_mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id); 162 my $out_stats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id ); 163 my $out_config = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id); 164 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id); 165 166 my $skyFile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 160 #my $out_image = $ipprc->filename("PSWARP.OUTPUT", $outroot, $skycell_id ); 161 #my $out_mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $outroot, $skycell_id); 162 #my $out_stats = $ipprc->filename("SKYCELL.STATS", $outroot, $skycell_id ); 163 #my $out_config = $ipprc->filename("PSWARP.CONFIG", $outroot, $skycell_id); 164 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot, $skycell_id); 165 166 my $out_image = prepare_output("PSWARP.OUTPUT", $outroot, $skycell_id, 1); 167 my $out_mask = prepare_output("PSWARP.OUTPUT.MASK", $outroot, $skycell_id, 1); 168 my $out_stats = prepare_output("SKYCELL.STATS", $outroot, $skycell_id, 1); 169 my $out_config = prepare_output("PSWARP.CONFIG", $outroot, $skycell_id, 1); 170 my $traceDest = prepare_output("TRACE.EXP", $outroot, $skycell_id, 1); 171 172 my $skyFile = prepare_output("SKYCELL.TEMPLATE", $outroot, $skycell_id, 1); 173 167 174 $ipprc->skycell_file( $tess_dir, $skycell_id, $skyFile, $verbose ) or &my_die("Unable to generate template skycell", $warp_bg_id, $skycell_id, $PS_EXIT_SYS_ERROR); 168 175 … … 239 246 ### Pau. 240 247 248 sub prepare_output 249 { 250 my $filerule = shift; 251 my $outroot = shift; 252 my $skycell_id = shift; 253 my $delete = shift; 254 $delete = 0 if !defined $delete; 255 256 my $error; 257 my $output = $ipprc->prepare_output($filerule, $outroot, $skycell_id, $delete, \$error) 258 or &my_die("failed to prepare output file for: $filerule", $warp_bg_id, $skycell_id, $error); 259 return $output; 260 } 261 241 262 242 263 sub my_die -
branches/czw_branch/20120906/ippScripts/scripts/destreak_restore_camera.pl
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20120905/ippScripts/scripts/destreak_restore_camera.pl (added) merged: 34428,34466,34566,34575,34735,34747
r34402 r34772 440 440 } 441 441 442 my $backup_url = shift; 442 443 my $original_url = shift; 443 my $backup_url = shift;444 444 445 445 # rename the backup as the orig … … 449 449 my $moved; 450 450 eval { 451 $moved = nebulous->move($backup_url, $original_url);451 $moved = $nebulous->move($backup_url, $original_url); 452 452 }; 453 453 if ($@ or not $moved) { - Property svn:mergeinfo changed
-
branches/czw_branch/20120906/ippScripts/scripts/detrend_process_imfile.pl
r33666 r34772 27 27 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 28 28 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 29 my $nebrepair = can_run('neb-repair') or (warn "Can't find neb-repair" and $missing_tools = 1); 30 29 31 if ($missing_tools) { 30 32 warn("Can't find required tools."); … … 124 126 # Run ppImage 125 127 unless ($no_op) { 128 my $repair_cmd = "$nebrepair $input_uri"; 129 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 130 unless ($repair_success) { 131 &my_die("Unable to attempt repair: $input_uri $repair_error_code", $det_id, $exp_id, $class_id $PS_EXIT_SYS_ERROR); 132 } 133 134 126 135 my $command = "$ppImage -file $input_uri $outroot"; 127 136 $command .= " -recipe PPIMAGE $ppimage_recipe"; -
branches/czw_branch/20120906/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed
-
branches/czw_branch/20120906/ippScripts/scripts/lap_science.pl
r34313 r34772 671 671 # } 672 672 # Do quality checks here 673 if ($verbose) { 674 printf("TEST: %d %d %d\n",$exposure->{exp_id},$exposure->{chip_id},$exposure->{chip_component_count}); 675 } 676 # Checks to ensure we do not divide by zero. Mostly happens with old diffs, it seems. 677 if ($exposure->{chip_component_count} == 0) { 678 $exposure->{chip_component_count} = 1; 679 } 680 if ($exposure->{cam_component_count} == 0) { 681 $exposure->{cam_component_count} = 1; 682 } 683 if ($exposure->{warp_component_count} == 0) { 684 $exposure->{warp_component_count} = 1; 685 } 686 if ($exposure->{diff_component_count} == 0) { 687 $exposure->{diff_component_count} = 1; 688 } 689 673 690 my $is_bad_quality = 0; 674 691 if ((defined($exposure->{chipRun_state}))&&($exposure->{chipRun_state} eq 'full')&& -
branches/czw_branch/20120906/ippScripts/scripts/magic_destreak.pl
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20120905/ippScripts/scripts/magic_destreak.pl (added) merged: 34428,34466,34566,34575,34735,34747
- Property svn:mergeinfo changed
-
branches/czw_branch/20120906/ippScripts/scripts/publish_file.pl
r30376 r34772 32 32 my $pubtool = can_run('pubtool') or (warn "Can't find pubtool" and $missing_tools = 1); 33 33 my $camtool = can_run('camtool') or (warn "Can't find camtool" and $missing_tools = 1); 34 my $regtool = can_run('regtool') or (warn "Can't find regtool" and $missing_tools = 1); 34 35 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 35 36 my $ppMops = can_run('ppMops') or (warn "Can't find ppMops" and $missing_tools = 1); … … 44 45 my ( $pub_id, $camera, $stage, $stage_id, $fileset, $format, $product, $workdir, $need_magic ); 45 46 my ( $dbname, $verbose, $no_update, $no_op, $save_temps, $redirect ); 46 my ( $output_format );47 my ( $output_format, $difftype ); 47 48 48 49 GetOptions( … … 72 73 defined $stage and 73 74 defined $stage_id and 74 defined $workdir; 75 defined $workdir and 76 defined $dbname; 75 77 76 78 my $outroot = "$workdir/$product.$pub_id"; # Output root name … … 166 168 my %negative; # Data for negative diff detections 167 169 foreach my $comp ( @$components ) { 168 my $path_base = $comp->{path_base}; # Base name for file170 my $path_base = $comp->{path_base}; # Base name for file 169 171 if (!$need_magic and $comp->{magicked}) { 170 172 # This client is authorized to receive uncensored detections … … 194 196 195 197 $filename = $resolved; 198 199 my $cam_id = $comp->{cam_id_1}; 200 #print "Getting info from camera stage $cam_id\n"; 201 my $cam_command = "$camtool -processedexp -cam_id $cam_id"; 202 $cam_command .= " -dbname $dbname" if defined $dbname; 203 my ( $cam_success, $cam_error_code, $cam_full_buf, $cam_stdout_buf, $cam_stderr_buf ) = 204 run(command => $cam_command, verbose => $verbose); 205 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $cam_success; 206 my $cam_metadata = $mdcParser->parse(join "", @$cam_stdout_buf) or 207 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 208 my $cam_components = parse_md_list($cam_metadata) or 209 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 210 &my_die("More than one entry for cam_id $stage_id", $pub_id, $PS_EXIT_PROG_ERROR) if scalar @$cam_components > 1; 211 my $cam_comp = $$cam_components[0]; 212 213 my $exp_id = $comp->{exp_id_1}; 214 #print "Getting info from raw stage $exp_id\n"; 215 my $reg_command = "$regtool -processedimfile -exp_id $exp_id"; 216 $reg_command .= " -dbname $dbname" if defined $dbname; 217 my ( $reg_success, $reg_error_code, $reg_full_buf, $reg_stdout_buf, $reg_stderr_buf ) = 218 run(command => $reg_command, verbose => $verbose); 219 &my_die( "Unable to retrieve filename", $pub_id, $PS_EXIT_SYS_ERROR) unless $reg_success; 220 my $reg_metadata = $mdcParser->parse(join "", @$reg_stdout_buf) or 221 &my_die("Unable to parse metadata config", $pub_id, $PS_EXIT_PROG_ERROR); 222 my $reg_components = parse_md_list($reg_metadata) or 223 &my_die("Unable to parse metadata list", $pub_id, $PS_EXIT_PROG_ERROR); 224 my $reg_comp = $$reg_components[0]; 225 226 # Now get the difftype value from diff->{diff_mode} 227 my $difftype = ""; 228 if ($comp->{diff_mode} == 1) { 229 $difftype = "WW"; 230 } elsif ($comp->{diff_mode} == 2) { 231 $difftype = "WS"; 232 } elsif ($comp->{diff_mode} == 3) { 233 $difftype = "SW"; # Not used yet 234 } elsif ($comp->{diff_mode} == 4) { 235 $difftype = "SS"; 236 } else { 237 $difftype = "Unsupported diff_mode value: [" . $comp->{diff_mode} . "]"; 238 } 196 239 197 240 my $data = { zp => $zp, … … 207 250 output_format => $comp->{output_format}, 208 251 direction => 1, 252 comment => $reg_comp->{comment}, 253 obsmode => $reg_comp->{obs_mode}, 254 difftype => $difftype, 255 sky => $cam_comp->{bg}, 256 shutoutc => $reg_comp->{dateobs}, 209 257 }; 210 258 259 #warn("Checking for positive"); 211 260 diff_check(\%positive, $data, "positive"); 212 261 … … 239 288 diff_id => $comp->{diff_id}, 240 289 direction => 0, 290 comment => $reg_comp->{comment}, 291 obsmode => $reg_comp->{obs_mode}, 292 difftype => $difftype, 293 sky => $cam_comp->{bg}, 294 shutoutc => $reg_comp->{dateobs}, 241 295 }; 242 296 297 #warn("Checking for negative"); 243 298 diff_check(\%negative, $data, "negative"); 244 299 … … 288 343 &my_die( "Unable to register with data store", $pub_id, $PS_EXIT_SYS_ERROR) unless $success; 289 344 } 290 291 292 345 293 346 ### Pau. … … 311 364 $data->{diff_id} = $comp->{diff_id} unless defined $data->{diff_id}; 312 365 $data->{direction} = $comp->{direction} unless defined $data->{direction}; 366 $data->{comment} = $comp->{comment} unless defined $data->{comment}; 367 $data->{obsmode} = $comp->{obsmode} unless defined $data->{obsmode}; 368 $data->{difftype} = $comp->{difftype} unless defined $data->{difftype}; 369 $data->{sky} = $comp->{sky} unless defined $data->{sky}; 370 $data->{shutoutc} = $comp->{shutoutc} unless defined $data->{shutoutc}; 313 371 314 372 &my_die("zp value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{zp} and $comp->{zp} != $data->{zp}; … … 323 381 &my_die("diff_id value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{diff_id} and $comp->{diff_id} != $data->{diff_id}; 324 382 &my_die("direction value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{direction} and $comp->{direction} != $data->{direction}; 383 &my_die("comment value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{comment} and $comp->{comment} ne $data->{comment}; 384 &my_die("obsmode value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{obsmode} and $comp->{obsmode} ne $data->{obsmode}; 385 &my_die("difftype value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{difftype} and $comp->{difftype} ne $data->{difftype}; 386 &my_die("sky value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{sky} and $comp->{sky} != $data->{sky}; 387 &my_die("shutoutc value for $name doesn't match", $pub_id, $PS_EXIT_SYS_ERROR) if defined $data->{shutoutc} and $comp->{shutoutc} ne $data->{shutoutc}; 325 388 326 389 return 1; … … 350 413 $command .= " -astrom_rms " . $data->{astrom} if defined $data->{astrom}; 351 414 $command .= " -version " . $data->{output_format} if defined $data->{output_format}; 415 $command .= " -comment \"" . $data->{comment} . "\"" if defined $data->{comment}; 416 $command .= " -obsmode " . $data->{obsmode} if defined $data->{obsmode}; 417 $command .= " -difftype " . $data->{difftype} if defined $data->{difftype}; 418 $command .= " -sky " . $data->{sky} if defined $data->{sky}; 419 $command .= " -shutoutc \"" . $data->{shutoutc} . "\"" if defined $data->{shutoutc}; 352 420 353 421 unless ($no_op) { -
branches/czw_branch/20120906/ippScripts/scripts/regenerate_background.pl
r34756 r34772 10 10 use IPC::Cmd 0.36 qw( can_run run ); 11 11 use File::Spec; 12 use File::Temp qw( tempfile ); 12 13 use PS::IPP::Config 1.01 qw( :standard ); 13 14 use Getopt::Long qw (GetOptions :config auto_help auto_version gnu_getopt ); 14 15 use Pod::Usage qw( pod2usage ); 16 use PS::IPP::Metadata::Config; 17 use PS::IPP::Metadata::List qw( parse_md_list ); 18 19 15 20 16 21 my $ppConfigDump = can_run('ppConfigDump'); … … 67 72 my $astromSource; # The astrometry source 68 73 { 69 my $command = "$ppConfigDump -camera $camera -recipe PSWARP DEFAULT-dump-recipe PSWARP -";74 my $command = "$ppConfigDump -camera $camera -recipe PSWARP BACKGROUND -dump-recipe PSWARP -"; 70 75 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 71 76 run(command => $command, verbose => $verbose); … … 97 102 } 98 103 99 my $in_md = $mdcParser->parse _list(join "", @$stdout_buf) or104 my $in_md = $mdcParser->parse(join "", @$stdout_buf) or 100 105 &my_die("Unable to parse metadata config doc", $stage, $stage_id, $PS_EXIT_PROG_ERROR); 101 106 $imfiles = parse_md_list($in_md) or … … 165 170 &my_die("Unable to generate template skycell",$skycell_id,$warp_id,$PS_EXIT_SYS_ERROR); 166 171 } 167 172 my $bkgOut_log = prepare_output("LOG.EXP",$path_base . ".BKG_REG",$skycell_id,1); 168 173 169 174 # Construct pswarp command 170 175 my $pswarp_command = "$pswarp "; 171 176 $pswarp_command .= " -list $bkgList_name -astromlist $astromList_name -bkglist $bkgList_name "; 177 $pswarp_command .= " ${path_base} "; 172 178 $pswarp_command .= " $skyCell_name "; 173 179 $pswarp_command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF "; … … 186 192 unless ($success) { 187 193 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 194 &my_die("Unable to perform pswarp: $error_code", $stage, $stage_id, $error_code); 195 } 196 197 my $update_command = "$warptool "; 198 $update_command .= " -updateskyfile -warp_id $warp_id -skycell_id $skycell_id "; 199 $update_command .= " -set_background_model 1 "; 200 $update_command .= " -dbname $dbname " if defined $dbname; 201 202 ( $success, $error_code, $full_buf, $stdout_buf, $stderrr_buf ) = 203 run(command => $update_command, verbose => $verbose); 204 unless ($success) { 205 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 188 206 &my_die("Unable to perform warptool: $error_code", $stage, $stage_id, $error_code); 189 207 } … … 223 241 224 242 my $num = 0; 225 243 my $path_base = '/tmp/x'; 244 my $expTime = 60; 245 226 246 my ($inputMDC_file, $inputMDC_name) = tempfile("/tmp/bkgreg.stack.mdc.${stage_id}.XXXX", 227 247 UNLINK => !$save_temps); … … 242 262 } 243 263 close($inputMDC_file); 244 264 265 my $bkgOut_log = prepare_output("LOG.IMFILE",$path_base . "BKG_REG",$skycell_id,1); 266 245 267 my $ppStack_command = "$ppStackMedian -input $inputMDC_name $path_base "; 246 268 $ppStack_command .= " -recipe PPSTACK STACK -recipe PPSUB STACK -recipe PSPHOT STACK "; … … 253 275 $ppStack_command .= " -Db PHOTOMETRY F -Db VARIANCE F -Db CONVOLVE F "; 254 276 $ppStack_command .= " -Df DEFAULT.EXPTIME $expTime "; 255 $ppStack_command .= " -threads $threads-log $bkgOut_log ";277 $ppStack_command .= " -threads 1 -log $bkgOut_log "; 256 278 $ppStack_command .= " -dbname $dbname " if defined $dbname; 257 279 -
branches/czw_branch/20120906/ippScripts/scripts/skycalibration.pl
r34151 r34772 33 33 my $psastro = can_run('psastro') or (warn "Can't find psastro" and $missing_tools = 1); 34 34 my $fhead = can_run('fhead') or (warn "Can't find fhead" and $missing_tools = 1); 35 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 35 36 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 36 37 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); … … 191 192 } 192 193 194 my $resolved = $ipprc->file_resolve($file); 195 if (!$resolved) { 196 &my_die("Unable to find input file: $file", $skycal_id, $PS_EXIT_SYS_ERROR); 197 } 198 199 # read the input header to find the number of detections and the number of detections 200 # with extended model 201 my $n_detections = 0; 202 my $n_extended = 0; 203 { 204 my $command = "echo $resolved | $fields -n SkyChip.psf NAXIS2"; 205 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 206 run(command => $command, verbose => 0); 207 # fields does not return 0 on success 208 (undef, $n_detections) = split " ", join "", @$stdout_buf; 209 chomp $n_detections; 210 &my_die("Unable to find number of detections from $file: ", $skycal_id, $PS_EXIT_SYS_ERROR) 211 unless defined $n_detections; 212 213 $command = "echo $resolved | $fields -n SkyChip.hdr NDET_EXT"; 214 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 215 run(command => $command, verbose => 0); 216 (undef, $n_extended) = split " ", join "", @$stdout_buf; 217 chomp $n_extended; 218 &my_die("Unable to find number of extended objects from $file: ", $skycal_id, $PS_EXIT_SYS_ERROR) 219 unless defined $n_extended; 220 } 221 222 193 223 # Perform psastro analysis 194 224 my $output_sources_filerule = 'PSASTRO.OUTPUT.CMF'; … … 246 276 { 247 277 my $command = "$staticskytool -skycal_id $skycal_id"; 278 $command .= " -n_detections $n_detections"; 279 $command .= " -n_extended $n_extended"; 248 280 $command .= " -addskycalresult -path_base $outroot"; 249 281 $command .= " $cmdflags"; -
branches/czw_branch/20120906/ippScripts/scripts/staticsky.pl
r33979 r34772 124 124 my $nInputs = @$files; 125 125 126 if ( $nInputs >1) {126 if (1) { 127 127 my $recipe_psphot = $ipprc->reduction($reduction, 'STACKPHOT_PSPHOT'); # Recipe to use for psphot 128 128 my $recipe_ppsub = $ipprc->reduction($reduction, 'STACKPHOT_PPSUB'); # Recipe to use for ppsub … … 266 266 } 267 267 } else { 268 # XXX This mode is no longer used. We run psphotStack even if there is only one filter 268 269 # single input. Run psphot 269 270 # find the recipe … … 302 303 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 303 304 $variance = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 305 $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Expnum name 304 306 } else { 305 307 $image = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 306 308 $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 307 309 $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 308 $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Weightname310 $expnum = $ipprc->filename("PPSTACK.OUTPUT.EXPNUM", $path_base ); # Expnum name 309 311 } 310 312
Note:
See TracChangeset
for help on using the changeset viewer.
