Changeset 23229 for trunk/ppImage/src/ppImageDetrendReadout.c
- Timestamp:
- Mar 8, 2009, 4:50:46 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppImage/src/ppImageDetrendReadout.c (modified) (6 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/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 }
Note:
See TracChangeset
for help on using the changeset viewer.
