Changeset 27537
- Timestamp:
- Mar 30, 2010, 3:45:08 PM (16 years ago)
- Location:
- branches/pap_delete
- Files:
-
- 7 edited
- 3 copied
-
. (copied) (copied from trunk )
-
ippScripts/scripts/diff_skycell.pl (modified) (4 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (5 diffs)
-
ippTasks (copied) (copied from trunk/ippTasks )
-
ippconfig/recipes/ppSub.config (modified) (1 diff)
-
ppSub (copied) (copied from trunk/ppSub )
-
ppSub/src/ppSub.h (modified) (1 diff)
-
ppSub/src/ppSubArguments.c (modified) (2 diffs)
-
ppSub/src/ppSubCamera.c (modified) (5 diffs)
-
ppSub/src/ppSubData.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_delete/ippScripts/scripts/diff_skycell.pl
r27215 r27537 102 102 my $camera; # Camera 103 103 my ($inputMagic, $templateMagic); # Are the inputs been magicked? 104 my ($saveInConv, $saveRefConv); # Save the input or reference convolved images? 104 105 # Prescan to decide if this is or is not a stack stack diff. The check above confirms we only have two entries. 105 106 if ((${ $files }[0]->{warp_id} == 0)&& … … 140 141 $templateSources = "PSWARP.OUTPUT.SOURCES"; 141 142 $templateMagic = $file->{magicked}; 143 $saveRefConv = 1; 142 144 } 143 145 } else { … … 162 164 $inputVariance = "PSWARP.OUTPUT.VARIANCE"; 163 165 $inputSources = "PSWARP.OUTPUT.SOURCES"; 166 $saveInConv = 1; 164 167 } 165 168 } … … 284 287 $command .= " -ipprc $configurationReal"; 285 288 } 289 $command .= " -save-inconv" if defined $saveInConv; 290 $command .= " -save-refconv" if defined $saveRefConv; 286 291 $command .= " -recipe PPSUB $recipe_ppSub"; 287 292 $command .= " -recipe PSPHOT $recipe_psphot"; -
branches/pap_delete/ippScripts/scripts/magic_process.pl
r27240 r27537 30 30 my $missing_tools; 31 31 my $magictool = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1); 32 my $difftool = can_run('difftool') or (warn "Can't find difftool" and $missing_tools = 1); 33 my $ppSubConvolve = can_run('ppSubConvolve') or (warn "Can't find ppSubConvolve" and $missing_tools = 1); 32 34 my $detectstreaks = can_run('DetectStreaks') or (warn "Can't find DetectStreaks" and $missing_tools = 1); 33 35 my $VerifyStreaks = can_run('VerifyStreaks') or (warn "Can't find VerifyStreaks, will not produce png images"); … … 116 118 $command .= " --threshold 2.35"; 117 119 120 my @deletions; # Files to delete 118 121 if (scalar @$inputs == 1 and $node ne "root") { 119 122 # … … 135 138 } 136 139 137 my $template = resolve_template($innode); 138 &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR) 139 unless defined $template; 140 my $diff_base = $innode->{diff_path_base}; # Base name for diff 141 my $tempName = $innode->{inverse} ? "PPSUB.INPUT.CONV" : "PPSUB.REF.CONV"; # File rule of interest 142 my $template = $ipprc->file_resolve($ipprc->filename($tempName, $diff_base)); 143 &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless defined $template; 144 145 # Delete the convolved products when done (we can recreate them as we need) 146 push @deletions, $template; 147 push @deletions, $ipprc->filename($tempName . ".MASK", $diff_base); 148 push @deletions, $ipprc->filename($tempName . ".VARIANCE", $diff_base); 149 150 unless ($ipprc->file_exists($template)) { 151 # Template doesn't exist (or can't be found); try to recreate it 152 my $tempPath = "/tmp/magic.$magic_id.$node.template"; 153 154 my $kernel = $ipprc->filename("PPSUB.OUTPUT.KERNELS", $diff_base); # Name of kernel file 155 &my_die("Unable to find kernel file", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel); 156 157 my ($image, $mask); # Image and mask 158 { 159 my $command = "$difftool -inputskyfile -diff_id $diff_id -skycell_id $node"; # Command to run 160 $command .= " -dbname $dbname" if defined $dbname; 161 if ($node->{inverse}) { 162 # Want the input because we're magicking the reference 163 $command .= " -input"; 164 } else { 165 # Want the reference because we're magicking the input 166 $command .= " -template"; 167 } 168 169 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 170 run(command => $command, verbose => $verbose); 171 unless ($success) { 172 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 173 &my_die("Unable to determine convolution inputs: $error_code", $magic_id, $node, $error_code); 174 } 175 176 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 177 &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR); 178 179 my $inputs = parse_md_list($metadata) or 180 &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR); 181 &my_die("Unexpected number of outputs", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless scalar @$inputs == 1; 182 my $input = $$inputs[0]; 183 my $path = $input->{path_base}; # Path of interest 184 if (defined $input->{warp_id} and $input->{warp_id} > 0) { 185 $image = $ipprc->filename("PSWARP.OUTPUT", $path); 186 $mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $path); 187 } elsif (defined $input->{stack_id} and $input->{stack_id} > 0) { 188 $image = $ipprc->filename("PPSTACK.UNCONV", $path); 189 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path); 190 } 191 &my_die("Unable to determine image and mask name", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless defined $image and defined $mask; 192 } 193 194 { 195 &my_die("Unable to find image and mask", $magic_id, $node, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image) and $ipprc->file_exists($mask); 196 197 my $command = "$ppSubConvolve $tempPath -image $image -mask $mask -kernel $kernel"; 198 $command .= " -reference" unless $node->{inverse}; 199 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 200 run(command => $command, verbose => $verbose); 201 unless ($success) { 202 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 203 &my_die("Unable to create template image: $error_code", $magic_id, $node, $error_code); 204 } 205 206 $template = $ipprc->filename("PPSUB.INPUT.CONV", $tempPath) or &my_die("Unable to determine filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 207 $template = $ipprc->file_resolve($template) or &my_die("Unable to resolve filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 208 &my_die("Unable to find created template", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template); 209 push @deletions, $template; 210 } 211 } 140 212 141 213 $command .= " --detect --image $image --mask $mask --weight $weight -k $template"; … … 226 298 print "Skipping command: $command\n"; 227 299 } 300 301 foreach my $file (@deletions) { 302 $ipprc->file_delete($file); 303 } 228 304 } 229 305 … … 387 463 } 388 464 389 sub resolve_template390 {391 my $node = shift;392 393 my $path_base = $node->{diff_path_base}; # Base name for name394 my $image = $node->{inverse} ? "PPSUB.INPUT.CONV" : "PPSUB.REF.CONV"; # File rule of interest395 396 $image = $ipprc->file_resolve($ipprc->filename($image, $path_base));397 398 return $image399 }400 401 465 sub file_check 402 466 { -
branches/pap_delete/ippconfig/recipes/ppSub.config
r26902 r27537 76 76 INVERSE BOOL FALSE # Generate inverse subtraction? 77 77 PHOTOMETRY BOOL FALSE # Perform photometry? 78 SAVE.CONVOLVED BOOL TRUE # Save convolved images?79 78 80 79 -
branches/pap_delete/ppSub/src/ppSub.h
r27109 r27537 45 45 bool photometry; // Perform photometry? 46 46 bool inverse; // Output inverse subtraction as well? 47 bool saveInConv; // Save convolved input? 48 bool saveRefConv; // Save convolved reference? 47 49 psString stamps; // Stamps file 48 50 pmPSF *psf; // Point Spread Function -
branches/pap_delete/ppSub/src/ppSubArguments.c
r27143 r27537 87 87 psMetadataAddBool(arguments, PS_LIST_TAIL, "-photometry", 0, "Perform photometry?", NULL); 88 88 psMetadataAddF32(arguments, PS_LIST_TAIL, "-zp", 0, "Zero point for photometry", NAN); 89 psMetadataAddBool(arguments, PS_LIST_TAIL, "-inverse", 0, "Generate inverse subtractions?", NULL); 89 psMetadataAddBool(arguments, PS_LIST_TAIL, "-inverse", 0, "Generate inverse subtractions?", false); 90 psMetadataAddBool(arguments, PS_LIST_TAIL, "-save-inconv", 0, "Save input convolved images?", false); 91 psMetadataAddBool(arguments, PS_LIST_TAIL, "-save-refconv", 0, "Save reference convolved images?", false); 90 92 psMetadataAddBool(arguments, PS_LIST_TAIL, "-visual", 0, "Show diagnostic plots", NULL); 91 93 … … 154 156 } 155 157 158 data->saveInConv = psMetadataLookupBool(NULL, arguments, "-save-inconv"); 159 data->saveRefConv = psMetadataLookupBool(NULL, arguments, "-save-refconv"); 160 156 161 if (psMetadataLookupBool(NULL, arguments, "-visual")) { 157 162 pmVisualSetVisual(true); -
branches/pap_delete/ppSub/src/ppSubCamera.c
r27040 r27537 219 219 data->photometry = psMetadataLookupBool(NULL, recipe, "PHOTOMETRY"); 220 220 221 bool mdok; // Status of MD lookup222 bool saveConv = psMetadataLookupBool(&mdok, recipe, "SAVE.CONVOLVED"); // Save convolved images?223 224 221 // Convolved input image 225 222 pmFPAfile *inConvImage = defineOutputFile(config, input, true, "PPSUB.INPUT.CONV", PM_FPA_FILE_IMAGE); … … 230 227 return false; 231 228 } 232 if (saveConv) { 233 inConvImage->save = true; 234 inConvMask->save = true; 235 } 229 inConvImage->save = data->saveInConv; 230 inConvMask->save = data->saveInConv; 236 231 if (inVar) { 237 232 pmFPAfile *inConvVar = defineOutputFile(config, inConvImage, false, "PPSUB.INPUT.CONV.VARIANCE", … … 241 236 return false; 242 237 } 243 if (saveConv) { 244 inConvVar->save = true; 245 } 238 inConvVar->save = data->saveInConv; 246 239 } 247 240 … … 254 247 return false; 255 248 } 256 if (saveConv) { 257 refConvImage->save = true; 258 refConvMask->save = true; 259 } 249 refConvImage->save = data->saveRefConv; 250 refConvMask->save = data->saveRefConv; 260 251 if (refVar) { 261 252 pmFPAfile *refConvVar = defineOutputFile(config, refConvImage, false, "PPSUB.REF.CONV.VARIANCE", … … 265 256 return false; 266 257 } 267 if (saveConv) { 268 refConvVar->save = true; 269 } 258 refConvVar->save = data->saveRefConv; 270 259 } 271 260 -
branches/pap_delete/ppSub/src/ppSubData.c
r27061 r27537 33 33 data->photometry = false; 34 34 data->inverse = false; 35 data->saveInConv = false; 36 data->saveRefConv = false; 35 37 data->stamps = NULL; 36 38 data->psf = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
