Changeset 23239 for branches/cnb_branches/cnb_branch_20090215/ppSub
- Timestamp:
- Mar 9, 2009, 3:41:26 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090215
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
ppSub/src/Makefile.am (modified) (1 diff)
-
ppSub/src/ppSubArguments.c (modified) (6 diffs)
-
ppSub/src/ppSubCamera.c (modified) (5 diffs)
-
ppSub/src/ppSubMakePSF.c (modified) (1 diff)
-
ppSub/src/ppSubMatchPSFs.c (modified) (2 diffs)
-
ppSub/src/ppSubVersion.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090215
- Property svn:mergeinfo changed
/branches/eam_branches/eam_branch_20090303 (added) merged: 23158,23175-23181,23202-23210,23220-23225 /trunk merged: 23211-23219,23226-23238
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090215/ppSub/src/Makefile.am
r23199 r23239 1 1 bin_PROGRAMS = ppSub ppSubKernel 2 2 3 PPSUB_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 PPSUB_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 PPSUB_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 3 # PPSUB_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 4 # PPSUB_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi` 5 # PPSUB_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 6 # 7 # # Force recompilation of ppSubVersion.c, since it gets the version information 8 # ppSubVersion.c: FORCE 9 # touch ppSubVersion.c 10 # FORCE: ; 6 11 7 # Force recompilation of ppSubVersion.c, since it gets the version information 8 ppSubVersion.c: FORCE 9 touch ppSubVersion.c 10 FORCE: ; 11 12 ppSub_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPSUB_CFLAGS) -DPPSUB_VERSION=\"$(PPSUB_VERSION)\" -DPPSUB_BRANCH=\"$(PPSUB_BRANCH)\" -DPPSUB_SOURCE=\"$(PPSUB_SOURCE)\" 12 ppSub_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPSUB_CFLAGS) -DPPSUB_VERSION=$(SVN_VERSION) -DPPSUB_BRANCH=$(SVN_BRANCH) -DPPSUB_SOURCE=$(SVN_SOURCE) 13 13 ppSub_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PPSUB_LIBS) 14 14 -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubArguments.c
r23199 r23239 30 30 fprintf(stderr, "\nPan-STARRS PSF-matched image subtraction\n\n"); 31 31 fprintf(stderr, "Usage: %s INPUT.fits REFERENCE.fits OUTPUT_ROOT \n" 32 "\t[-psf REFERENCE.psf.fits] [-sources REFERENCE.cmf]\n\n"32 "\t[-psf REFERENCE.psf.fits]\n\n" 33 33 "This subtracts the convolved REFERENCE from the INPUT, by default.\n", 34 34 program); … … 201 201 202 202 203 pmConfigFileSetsMD(config->arguments, &argc, argv, "PPSUB.SOURCES", "-sources", NULL);204 205 203 psMetadata *arguments = config->arguments; // Command-line arguments 206 204 psMetadataAddStr(arguments, PS_LIST_TAIL, "-inmask", 0, "Input mask image", NULL); 207 205 psMetadataAddStr(arguments, PS_LIST_TAIL, "-invariance", 0, "Input variance image", NULL); 206 psMetadataAddStr(arguments, PS_LIST_TAIL, "-insources", 0, "Input source list", NULL); 208 207 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refmask", 0, "Reference mask image", NULL); 209 208 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refvariance", 0, "Reference variance image", NULL); 209 psMetadataAddStr(arguments, PS_LIST_TAIL, "-refsources", 0, "Reference source list", NULL); 210 210 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Statistics file", NULL); 211 211 psMetadataAddF32(arguments, PS_LIST_TAIL, "-region", 0, "Size of iso-kernel region", NAN); … … 224 224 psMetadataAddF32(arguments, PS_LIST_TAIL, "-spacing", 0, "Typical stamp spacing (pixels)", NAN); 225 225 psMetadataAddS32(arguments, PS_LIST_TAIL, "-footprint", 0, "Stamp footprint half-size (pixels)", -1); 226 psMetadataAddF32(arguments, PS_LIST_TAIL, "-source-radius", 0, "Source matching radius (pixels)", NAN); 226 227 psMetadataAddS32(arguments, PS_LIST_TAIL, "-stride", 0, "Size of convolution patches (pixels)", -1); 227 228 psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold", 0, "Minimum threshold for stamps (ADU)", NAN); … … 268 269 fileList("INPUT.VARIANCE", inVariance, "Name of the input variance image", config); 269 270 } 271 const char *inSources = psMetadataLookupStr(NULL, arguments, "-insources"); // Name of input source list 272 if (inSources && strlen(inSources) > 0) { 273 fileList("INPUT.SOURCES", inSources, "Name of the input source list", config); 274 } 270 275 271 276 const char *refMask = psMetadataLookupStr(NULL, arguments, "-refmask"); // Name of reference mask … … 276 281 if (refVariance && strlen(refVariance) > 0) { 277 282 fileList("REF.VARIANCE", refVariance, "Name of the reference variance image", config); 283 } 284 const char *refSources = psMetadataLookupStr(NULL, arguments, "-refsources"); // Name of ref source list 285 if (refSources && strlen(refSources) > 0) { 286 fileList("REF.SOURCES", refSources, "Name of the reference source list", config); 278 287 } 279 288 … … 300 309 } 301 310 302 VALUE_ARG_RECIPE_FLOAT("-region", "REGION.SIZE", F32); 303 VALUE_ARG_RECIPE_INT("-size", "KERNEL.SIZE", S32, 0); 304 VALUE_ARG_RECIPE_INT("-order", "SPATIAL.ORDER", S32, -1); 305 VALUE_ARG_RECIPE_FLOAT("-spacing", "STAMP.SPACING", F32); 306 VALUE_ARG_RECIPE_INT("-rings-order", "RINGS.ORDER", S32, -1); 307 VALUE_ARG_RECIPE_INT("-inner", "INNER", S32, -1); 308 VALUE_ARG_RECIPE_INT("-spam-binning", "SPAM.BINNING", S32, 0); 309 VALUE_ARG_RECIPE_INT("-footprint", "STAMP.FOOTPRINT", S32, -1); 310 VALUE_ARG_RECIPE_INT("-stride", "STRIDE", S32, -1); 311 VALUE_ARG_RECIPE_FLOAT("-threshold", "STAMP.THRESHOLD", F32); 312 VALUE_ARG_RECIPE_INT("-iter", "ITER", S32, -1); 313 VALUE_ARG_RECIPE_FLOAT("-rej", "REJ", F32); 314 VALUE_ARG_RECIPE_FLOAT("-sys", "SYS", F32); 315 VALUE_ARG_RECIPE_FLOAT("-badfrac", "BADFRAC", F32); 316 VALUE_ARG_RECIPE_FLOAT("-penalty", "PENALTY", F32); 317 VALUE_ARG_RECIPE_FLOAT("-poor-frac", "POOR.FRACTION", F32); 318 VALUE_ARG_RECIPE_INT("-bin1", "BIN1", S32, 0); 319 VALUE_ARG_RECIPE_INT("-bin2", "BIN2", S32, 0); 311 VALUE_ARG_RECIPE_FLOAT("-region", "REGION.SIZE", F32); 312 VALUE_ARG_RECIPE_INT("-size", "KERNEL.SIZE", S32, 0); 313 VALUE_ARG_RECIPE_INT("-order", "SPATIAL.ORDER", S32, -1); 314 VALUE_ARG_RECIPE_FLOAT("-spacing", "STAMP.SPACING", F32); 315 VALUE_ARG_RECIPE_INT("-rings-order", "RINGS.ORDER", S32, -1); 316 VALUE_ARG_RECIPE_INT("-inner", "INNER", S32, -1); 317 VALUE_ARG_RECIPE_INT("-spam-binning", "SPAM.BINNING", S32, 0); 318 VALUE_ARG_RECIPE_INT("-footprint", "STAMP.FOOTPRINT", S32, -1); 319 VALUE_ARG_RECIPE_FLOAT("-source-radius", "SOURCE.RADIUS", F32); 320 VALUE_ARG_RECIPE_INT("-stride", "STRIDE", S32, -1); 321 VALUE_ARG_RECIPE_FLOAT("-threshold", "STAMP.THRESHOLD", F32); 322 VALUE_ARG_RECIPE_INT("-iter", "ITER", S32, -1); 323 VALUE_ARG_RECIPE_FLOAT("-rej", "REJ", F32); 324 VALUE_ARG_RECIPE_FLOAT("-sys", "SYS", F32); 325 VALUE_ARG_RECIPE_FLOAT("-badfrac", "BADFRAC", F32); 326 VALUE_ARG_RECIPE_FLOAT("-penalty", "PENALTY", F32); 327 VALUE_ARG_RECIPE_FLOAT("-poor-frac", "POOR.FRACTION", F32); 328 VALUE_ARG_RECIPE_INT("-bin1", "BIN1", S32, 0); 329 VALUE_ARG_RECIPE_INT("-bin2", "BIN2", S32, 0); 320 330 321 331 valueArgRecipeStr(arguments, recipe, "-mask-in", "MASK.IN", recipe); -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubCamera.c
r22419 r23239 40 40 pmFPAfile *inputMask = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.MASK", "INPUT.MASK"); 41 41 if (!status) { 42 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.MASK");42 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.MASK"); 43 43 return NULL; 44 44 } … … 51 51 pmFPAfile *inputVariance = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE"); 52 52 if (!status) { 53 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.VARIANCE");53 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.VARIANCE"); 54 54 return NULL; 55 55 } 56 56 if (inputVariance && inputVariance->type != PM_FPA_FILE_VARIANCE) { 57 57 psError(PS_ERR_IO, true, "PPSUB.INPUT.VARIANCE is not of type VARIANCE"); 58 return false; 59 } 60 61 // Input source list 62 pmFPAfile *inputSources = pmFPAfileBindFromArgs(&status, input, config, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES"); 63 if (!status) { 64 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.INPUT.SOURCES"); 65 return NULL; 66 } 67 if (inputSources && inputSources->type != PM_FPA_FILE_CMF) { 68 psError(PS_ERR_IO, true, "PPSUB.INPUT.SOURCES is not of type CMF"); 58 69 return false; 59 70 } … … 74 85 pmFPAfile *refMask = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.MASK", "REF.MASK"); 75 86 if (!status) { 76 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.MASK");87 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.MASK"); 77 88 return NULL; 78 89 } … … 85 96 pmFPAfile *refVariance = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.VARIANCE", "REF.VARIANCE"); 86 97 if (!status) { 87 psError (PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.VARIANCE");98 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.VARIANCE"); 88 99 return NULL; 89 100 } 90 101 if (refVariance && refVariance->type != PM_FPA_FILE_VARIANCE) { 91 102 psError(PS_ERR_IO, true, "PPSUB.REF.VARIANCE is not of type VARIANCE"); 103 return false; 104 } 105 106 // Reference source list 107 pmFPAfile *refSources = pmFPAfileBindFromArgs(&status, ref, config, "PPSUB.REF.SOURCES", "REF.SOURCES"); 108 if (!status) { 109 psError(PS_ERR_UNKNOWN, false, "Failed to load file definition PPSUB.REF.SOURCES"); 110 return NULL; 111 } 112 if (refSources && refSources->type != PM_FPA_FILE_CMF) { 113 psError(PS_ERR_IO, true, "PPSUB.REF.SOURCES is not of type CMF"); 92 114 return false; 93 115 } … … 241 263 outKernels->save = true; 242 264 243 #if 0244 if (!pmFPAAddSourceFromFormat(output->fpa, "Subtraction", output->format)) {245 psError(PS_ERR_UNKNOWN, false, "Unable to generate output FPA.");246 return false;247 }248 #endif249 250 pmFPAfile *sources = pmFPAfileDefineFromArgs(&status, config, "PPSUB.SOURCES", "PPSUB.SOURCES");251 if (!status) {252 psError(PS_ERR_IO, false, "Failed to load file definition PPSUB.SOURCES");253 return false;254 }255 if (sources && sources->type != PM_FPA_FILE_CMF) {256 psError(PS_ERR_IO, true, "PPSUB.SOURCES is not of type CMF");257 return false;258 }259 265 260 266 psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubMakePSF.c
r23197 r23239 81 81 // Extract the loaded sources from the associated readout, and generate PSF 82 82 // Here, we assume the image is background-subtracted 83 pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); 84 psArray *sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES"); 83 psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES"); 85 84 if (!psphotReadoutFindPSF(config, view, sources)) { 86 85 psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on subtracted image."); -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubMatchPSFs.c
r22419 r23239 50 50 51 51 // Sources in image, used for stamps: these must be loaded from previous analysis stages 52 pmReadout *sourcesRO = pmFPAfileThisReadout(config->files, view, "PPSUB.SOURCES"); // Readout with sources 53 psArray *sources = NULL; // Sources in image; used for stamps 54 if (sourcesRO) { 55 sources = psMetadataLookupPtr(&mdok, sourcesRO->analysis, "PSPHOT.SOURCES"); 52 psArray *inSources = psMetadataLookupPtr(&mdok, inRO->analysis, "PSPHOT.SOURCES"); // Input source list 53 psArray *refSources = psMetadataLookupPtr(&mdok, refRO->analysis, "PSPHOT.SOURCES"); // Ref source list 54 55 psArray *sources = NULL; // Merged list of sources 56 if (inSources && refSources) { 57 float radius = psMetadataLookupF32(NULL, recipe, "SOURCE.RADIUS"); // Matching radius 58 psArray *lists = psArrayAlloc(2); // Source lists 59 lists->data[0] = psMemIncrRefCounter(inSources); 60 lists->data[1] = psMemIncrRefCounter(refSources); 61 sources = pmSourceMatchMerge(lists, radius); 62 psFree(lists); 63 if (!sources) { 64 psError(PS_ERR_UNKNOWN, false, "Unable to merge source lists"); 65 return false; 66 } 67 } else if (inSources) { 68 sources = psMemIncrRefCounter(inSources); 69 } else if (refSources) { 70 sources = psMemIncrRefCounter(refSources); 56 71 } 72 73 psMetadataAddArray(inConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, 74 "Merged source list", sources); 75 psMetadataAddArray(refConv->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_META_REPLACE, 76 "Merged source list", sources); 77 psFree(sources); // Drop reference 57 78 58 79 int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size … … 129 150 130 151 // XXX drop the pixels associated with inRO and refRO (now that we have inConv and refConf) 131 152 #ifdef TESTING 132 153 psphotSaveImage (NULL, inRO->image, "inRO.fits"); 133 154 psphotSaveImage (NULL, refRO->image, "refRO.fits"); 134 155 psphotSaveImage (NULL, inConv->image, "inConv.fits"); 135 156 psphotSaveImage (NULL, refConv->image, "refConv.fits"); 157 #endif 136 158 137 159 return true; -
branches/cnb_branches/cnb_branch_20090215/ppSub/src/ppSubVersion.c
r23199 r23239 23 23 #include "ppSub.h" 24 24 25 psString ppSubVersion(void)26 {27 25 #ifndef PPSUB_VERSION 28 26 #error "PPSUB_VERSION is not set" … … 31 29 #error "PPSUB_BRANCH is not set" 32 30 #endif 33 return psStringCopy(PPSUB_BRANCH "@" PPSUB_VERSION); 31 #ifndef PPSUB_SOURCE 32 #error "PPSUB_SOURCE is not set" 33 #endif 34 35 #define xstr(s) str(s) 36 #define str(s) #s 37 38 psString ppSubVersion(void) 39 { 40 char *value = NULL; 41 psStringAppend(&value, "%s@%s", xstr(PPSUB_BRANCH), xstr(PPSUB_VERSION)); 42 return value; 34 43 } 35 44 36 45 psString ppSubSource(void) 37 46 { 38 #ifndef PPSUB_SOURCE 39 #error "PPSUB_SOURCE is not set" 40 #endif 41 return psStringCopy(PPSUB_SOURCE); 47 return psStringCopy(xstr(PPSUB_SOURCE)); 42 48 } 43 49
Note:
See TracChangeset
for help on using the changeset viewer.
