- Timestamp:
- Apr 5, 2010, 10:16:10 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
-
. (modified) (1 prop)
-
Ohana/src/relastro (modified) (1 prop)
-
ippScripts/scripts/diff_skycell.pl (modified) (4 diffs)
-
ippScripts/scripts/magic_process.pl (modified) (6 diffs)
-
ippScripts/scripts/magic_tree.pl (modified) (1 diff)
-
ippconfig/recipes/ppSub.config (modified) (1 diff)
-
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
-
trunk
-
Property svn:mergeinfo
set to
/branches/pap_delete merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/src/relastro
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ippScripts/scripts/diff_skycell.pl
r27215 r27596 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"; -
trunk/ippScripts/scripts/magic_process.pl
r27240 r27596 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"); … … 80 82 $baseroot = $ipprc->file_resolve($baseroot); 81 83 my $outroot = "$baseroot.$node"; 84 $ipprc->outroot_prepare($outroot); 82 85 83 86 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files … … 116 119 $command .= " --threshold 2.35"; 117 120 121 my @deletions; # Files to delete 118 122 if (scalar @$inputs == 1 and $node ne "root") { 119 123 # … … 135 139 } 136 140 137 my $template = resolve_template($innode); 138 &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR) 139 unless defined $template; 141 my $diff_base = $innode->{diff_path_base}; # Base name for diff 142 my $tempName = $innode->{inverse} ? "PPSUB.INPUT.CONV" : "PPSUB.REF.CONV"; # File rule of interest 143 my $template = $ipprc->file_resolve($ipprc->filename($tempName, $diff_base)); 144 &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless defined $template; 145 146 # Delete the convolved products when done (we can recreate them as we need) 147 push @deletions, $template; 148 push @deletions, $ipprc->filename($tempName . ".MASK", $diff_base); 149 push @deletions, $ipprc->filename($tempName . ".VARIANCE", $diff_base); 150 151 unless ($ipprc->file_exists($template)) { 152 # Template doesn't exist (or can't be found); try to recreate it 153 my $tempPath = "/tmp/magic.$magic_id.$node.template"; 154 155 my $kernel = $ipprc->filename("PPSUB.OUTPUT.KERNELS", $diff_base); # Name of kernel file 156 &my_die("Unable to find kernel file", $magic_id, $node, $PS_EXIT_DATA_ERROR) unless $ipprc->file_exists($kernel); 157 158 my ($image, $mask); # Image and mask 159 { 160 my $command = "$difftool -inputskyfile -diff_id $diff_id -skycell_id $node"; # Command to run 161 $command .= " -dbname $dbname" if defined $dbname; 162 if ($innode->{inverse}) { 163 # Want the input because we're magicking the reference 164 $command .= " -input"; 165 } else { 166 # Want the reference because we're magicking the input 167 $command .= " -template"; 168 } 169 170 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 171 run(command => $command, verbose => $verbose); 172 unless ($success) { 173 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 174 &my_die("Unable to determine convolution inputs: $error_code", $magic_id, $node, $error_code); 175 } 176 177 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 178 &my_die("Unable to parse metadata config doc", $magic_id, $node, $PS_EXIT_PROG_ERROR); 179 180 my $inputs = parse_md_list($metadata) or 181 &my_die("Unable to parse metadata list", $magic_id, $node, $PS_EXIT_PROG_ERROR); 182 &my_die("Unexpected number of outputs", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless scalar @$inputs == 1; 183 my $input = $$inputs[0]; 184 my $path = $input->{path_base}; # Path of interest 185 if (defined $input->{warp_id} and $input->{warp_id} > 0) { 186 $image = $ipprc->filename("PSWARP.OUTPUT", $path); 187 $mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $path); 188 } elsif (defined $input->{stack_id} and $input->{stack_id} > 0) { 189 $image = $ipprc->filename("PPSTACK.UNCONV", $path); 190 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path); 191 } 192 &my_die("Unable to determine image and mask name", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless defined $image and defined $mask; 193 } 194 195 { 196 &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); 197 198 my $command = "$ppSubConvolve $tempPath -image $image -mask $mask -kernel $kernel"; 199 $command .= " -reference" unless $innode->{inverse}; 200 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 201 run(command => $command, verbose => $verbose); 202 unless ($success) { 203 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 204 &my_die("Unable to create template image: $error_code", $magic_id, $node, $error_code); 205 } 206 207 $template = $ipprc->filename("PPSUB.INPUT.CONV", $tempPath) or &my_die("Unable to determine filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 208 $template = $ipprc->file_resolve($template) or &my_die("Unable to resolve filename for created template", $magic_id, $node, $PS_EXIT_PROG_ERROR); 209 &my_die("Unable to find created template", $magic_id, $node, $PS_EXIT_PROG_ERROR) unless $ipprc->file_exists($template); 210 push @deletions, $template; 211 } 212 } 140 213 141 214 $command .= " --detect --image $image --mask $mask --weight $weight -k $template"; … … 223 296 file_check( $output ); 224 297 } 298 299 foreach my $file (@deletions) { 300 print "Deleting $file...\n"; 301 $ipprc->file_delete($file); 302 } 303 225 304 } else { 226 305 print "Skipping command: $command\n"; 227 306 } 307 228 308 } 229 309 … … 387 467 } 388 468 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 469 sub file_check 402 470 { -
trunk/ippScripts/scripts/magic_tree.pl
r26186 r27596 171 171 if ($xi == 0 and $eta == 0) { 172 172 $phi = 0; 173 $ eta = 0;173 $theta = 0; 174 174 } else { 175 175 $phi = atan2($eta,$xi) + pi/2; -
trunk/ippconfig/recipes/ppSub.config
r26902 r27596 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 -
trunk/ppSub/src/ppSub.h
r27109 r27596 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 -
trunk/ppSub/src/ppSubArguments.c
r27143 r27596 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); -
trunk/ppSub/src/ppSubCamera.c
r27040 r27596 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 -
trunk/ppSub/src/ppSubData.c
r27061 r27596 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.
