Changeset 23229 for trunk/ppImage/src
- Timestamp:
- Mar 8, 2009, 4:50:46 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
ppImage/src/Makefile.am (modified) (1 diff)
-
ppImage/src/ppImage.h (modified) (1 diff)
-
ppImage/src/ppImageArguments.c (modified) (2 diffs)
-
ppImage/src/ppImageDetrendReadout.c (modified) (6 diffs)
-
ppImage/src/ppImageOptions.c (modified) (2 diffs)
-
ppImage/src/ppImageVersion.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/eam_branches/eam_branch_20090303 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/ppImage/src/Makefile.am
r23125 r23229 4 4 ppImage.h 5 5 6 PPIMAGE_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`7 PPIMAGE_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`8 PPIMAGE_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`6 #PPIMAGE_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi` 7 #PPIMAGE_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` 8 #PPIMAGE_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi` 9 9 10 10 # Force recompilation of ppImageVersion.c, since it gets the version information 11 ppImageVersion.c: FORCE12 touch ppImageVersion.c13 FORCE: ;11 # ppImageVersion.c: FORCE 12 # touch ppImageVersion.c 13 # FORCE: ; 14 14 15 ppImage_CFLAGS = $(PPIMAGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSASTRO_CFLAGS) $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPPIMAGE_VERSION= \"$(PPIMAGE_VERSION)\" -DPPIMAGE_BRANCH=\"$(PPIMAGE_BRANCH)\" -DPPIMAGE_SOURCE=\"$(PPIMAGE_SOURCE)\"15 ppImage_CFLAGS = $(PPIMAGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSASTRO_CFLAGS) $(PSPHOT_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -DPPIMAGE_VERSION=$(SVN_VERSION) -DPPIMAGE_BRANCH=$(SVN_BRANCH) -DPPIMAGE_SOURCE=$(SVN_SOURCE) 16 16 ppImage_LDFLAGS = $(PPIMAGE_LIBS) $(PSASTRO_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) 17 17 ppImage_SOURCES = \ -
trunk/ppImage/src/ppImage.h
r23195 r23229 86 86 int remnanceSize; // Size for remnance detection 87 87 float remnanceThresh; // Threshold for remnance detection 88 89 char *normClass; // class to use for per-class normalization 88 90 } ppImageOptions; 89 91 -
trunk/ppImage/src/ppImageArguments.c
r19943 r23229 14 14 fprintf(stderr, "\t-chip CHIPNUM: Only process this chip number.\n"); 15 15 fprintf(stderr, "\t-norm VALUE: Divide through by this value when done.\n"); 16 fprintf(stderr, "\t-normlist file.mdc: normalizations by class_id.\n"); 16 17 fprintf(stderr, "\n"); 17 18 fprintf(stderr, "Input options (single file / file list):\n"); … … 128 129 } 129 130 130 // Optional normali sation factor131 // Optional normalization factor 131 132 if ((argnum = psArgumentGet(argc, argv, "-norm"))) { 132 133 psArgumentRemove(argnum, &argc, argv); 133 134 float norm = atof(argv[argnum]); 134 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "NORMALI SATION", 0,135 psMetadataAddF32(config->arguments, PS_LIST_TAIL, "NORMALIZATION", 0, 135 136 "Normalisation to apply", norm); 137 psArgumentRemove(argnum, &argc, argv); 138 } 139 140 // Optional per-class normalization table 141 if ((argnum = psArgumentGet(argc, argv, "-normlist"))) { 142 psArgumentRemove(argnum, &argc, argv); 143 144 unsigned int nFail = 0; 145 psMetadata *normlist = psMetadataConfigRead (NULL, &nFail, argv[argnum], false); 146 // XXX allow this file to be in nebulous? 147 148 psMetadataAddMetadata(config->arguments, PS_LIST_TAIL, "NORMALIZATION.TABLE", 0, "Normalization to apply", normlist); 149 psFree (normlist); 136 150 psArgumentRemove(argnum, &argc, argv); 137 151 } -
trunk/ppImage/src/ppImageDetrendReadout.c
r21364 r23229 54 54 if (!pmBiasSubtract(input, options->overscan, bias, oldDark, view)) { 55 55 psError(PS_ERR_UNKNOWN, false, "Unable to subtract bias."); 56 psFree(detview); 56 57 return false; 57 58 } … … 67 68 if (!pmDarkApply(input, dark, options->maskValue)) { 68 69 psError(PS_ERR_UNKNOWN, false, "Unable to subtract dark."); 70 psFree(detview); 69 71 return false; 70 72 } … … 75 77 options->remnanceSize, options->remnanceThresh)) { 76 78 psError(PS_ERR_UNKNOWN, false, "Unable to mask remnance."); 79 psFree(detview); 77 80 return false; 78 81 } … … 83 86 pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER"); 84 87 if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) { 88 psFree(detview); 85 89 return false; 86 90 } … … 91 95 pmReadout *flat = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.FLAT"); 92 96 if (!pmFlatField(input, flat, options->flatMask)) { 97 psFree(detview); 93 98 return false; 94 99 } 95 100 } 96 101 97 // Normali sation by a(known) constant102 // Normalization by a single (known) constant 98 103 bool mdok; // Status of MD lookup 99 float norm = psMetadataLookupF32(&mdok, config->arguments, "NORMALI SATION");104 float norm = psMetadataLookupF32(&mdok, config->arguments, "NORMALIZATION"); 100 105 if (mdok && isfinite(norm) && norm != 1.0) { 101 106 pmHDU *hdu = pmHDUFromReadout(input); // HDU of interest … … 108 113 } 109 114 115 # if (1) 116 // Normalization by per-class values 117 psMetadata *normlist = psMetadataLookupMetadata(&mdok, config->arguments, "NORMALIZATION.TABLE"); 118 if (normlist) { 119 pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT"); 120 121 // get the menu of class IDs 122 psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 123 if (!menu) { 124 psError(PS_ERR_IO, false, "Unable to find CLASSID metadata in camera configuration"); 125 psFree(detview); 126 return false; 127 } 128 // get the rule for class_id for the desired class 129 const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 130 if (!rule) { 131 psError(PS_ERR_IO, false, "Unable to find NORM.CLASS value %s in CLASSID in camera configuration", options->normClass); 132 psFree(detview); 133 return false; 134 } 135 // get the class_id from the rule 136 char *classID = pmFPAfileNameFromRule(rule, inputFile, view); 137 if (!classID) { 138 psError(PS_ERR_IO, false, "error converting CLASSID rule %s to name\n", rule); 139 psFree(detview); 140 return false; 141 } 142 143 // get normalization from the class_id 144 float norm = psMetadataLookupF32 (&mdok, normlist, classID); 145 146 pmHDU *hdu = pmHDUFromReadout(input); // HDU of interest 147 psString comment = NULL; // Comment to add 148 psStringAppend(&comment, "Normalization: %f", norm); 149 psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, ""); 150 psFree(comment); 151 152 // apply the normalization 153 psBinaryOp(input->image, input->image, "*", psScalarAlloc(norm, PS_TYPE_F32)); 154 155 psFree (classID); 156 } 157 # endif 158 110 159 if (options->doFringe) { 111 160 pmCell *fringe = pmFPAfileThisCell(config->files, detview, "PPIMAGE.FRINGE"); 112 161 if (!ppImageDetrendFringeMeasure(input, fringe, false, options)) { 162 psFree(detview); 113 163 return false; 114 164 } -
trunk/ppImage/src/ppImageOptions.c
r21364 r23229 81 81 options->remnanceThresh = 25.0; // Threshold for remnance detection 82 82 83 // per-class normalization source 84 options->normClass = NULL; // per-class normalizations refer to this class 85 83 86 return options; 84 87 } … … 278 281 options->remnanceThresh = psMetadataLookupS32(NULL, recipe, "REMNANCE.THRESH"); 279 282 283 // per-class normalization source (just a reference; don't free) 284 options->normClass = psMetadataLookupStr(NULL, recipe, "NORM.CLASS"); 285 280 286 return options; 281 287 } -
trunk/ppImage/src/ppImageVersion.c
r23195 r23229 5 5 #include "ppImage.h" 6 6 7 psString ppImageVersion(void)8 {9 7 #ifndef PPIMAGE_VERSION 10 8 #error "PPIMAGE_VERSION is not set" … … 13 11 #error "PPIMAGE_BRANCH is not set" 14 12 #endif 15 return psStringCopy(PPIMAGE_BRANCH "@" PPIMAGE_VERSION); 13 #ifndef PPIMAGE_SOURCE 14 #error "PPIMAGE_SOURCE is not set" 15 #endif 16 17 #define xstr(s) str(s) 18 #define str(s) #s 19 20 psString ppImageVersion(void) 21 { 22 char *value = NULL; 23 psStringAppend(&value, "%s@%s", xstr(PPIMAGE_BRANCH), xstr(PPIMAGE_VERSION)); 24 return value; 16 25 } 17 26 18 27 psString ppImageSource(void) 19 28 { 20 #ifndef PPIMAGE_SOURCE 21 #error "PPIMAGE_SOURCE is not set" 22 #endif 23 return psStringCopy(PPIMAGE_SOURCE); 29 return psStringCopy (xstr(PPIMAGE_SOURCE)); 24 30 } 25 31 … … 27 33 { 28 34 psString version = ppImageVersion(); // Version, to return 29 psString source = ppImageSource(); // Source35 psString source = ppImageSource(); // Source 30 36 31 37 psStringPrepend(&version, "ppImage ");
Note:
See TracChangeset
for help on using the changeset viewer.
