Changeset 24078
- Timestamp:
- May 5, 2009, 6:27:23 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendReadout.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendReadout.c
r23825 r24078 17 17 // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine. 18 18 if (options->doMaskBuild) { 19 psImageMaskType satMask = options->doMaskSat ? options->satMask : 0;20 psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0;19 psImageMaskType satMask = options->doMaskSat ? options->satMask : 0; 20 psImageMaskType lowMask = options->doMaskLow ? options->lowMask : 0; 21 21 pmReadoutGenerateMask(input, satMask, lowMask); 22 22 } … … 56 56 if (!pmBiasSubtract(input, options->overscan, bias, oldDark, view)) { 57 57 psError(PS_ERR_UNKNOWN, false, "Unable to subtract bias."); 58 psFree(detview);58 psFree(detview); 59 59 return false; 60 60 } … … 68 68 69 69 if (options->doDark && dark) { 70 if (!pmDarkApply(input, dark, options-> maskValue)) {70 if (!pmDarkApply(input, dark, options->flatMask)) { 71 71 psError(PS_ERR_UNKNOWN, false, "Unable to subtract dark."); 72 psFree(detview);72 psFree(detview); 73 73 return false; 74 74 } … … 79 79 options->remnanceSize, options->remnanceThresh)) { 80 80 psError(PS_ERR_UNKNOWN, false, "Unable to mask remnance."); 81 psFree(detview);81 psFree(detview); 82 82 return false; 83 83 } … … 88 88 pmReadout *shutter = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.SHUTTER"); 89 89 if (!pmShutterCorrectionApply(input, shutter, pmConfigMaskGet("FLAT", config))) { 90 psFree(detview);90 psFree(detview); 91 91 return false; 92 92 } … … 97 97 pmReadout *flat = pmFPAfileThisReadout(config->files, detview, "PPIMAGE.FLAT"); 98 98 if (!pmFlatField(input, flat, options->flatMask)) { 99 psFree(detview);99 psFree(detview); 100 100 return false; 101 101 } … … 119 119 psMetadata *normlist = psMetadataLookupMetadata(&mdok, config->arguments, "NORMALIZATION.TABLE"); 120 120 if (normlist) { 121 pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT");121 pmFPAfile *inputFile = psMetadataLookupPtr(&mdok, config->files, "PPIMAGE.INPUT"); 122 122 123 // get the menu of class IDs124 psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 123 // get the menu of class IDs 124 psMetadata *menu = psMetadataLookupMetadata(&mdok, inputFile->camera, "CLASSID"); 125 125 if (!menu) { 126 126 psError(PS_ERR_IO, false, "Unable to find CLASSID metadata in camera configuration"); 127 psFree(detview);127 psFree(detview); 128 128 return false; 129 129 } 130 // get the rule for class_id for the desired class131 const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 130 // get the rule for class_id for the desired class 131 const char *rule = psMetadataLookupStr(&mdok, menu, options->normClass); 132 132 if (!rule) { 133 133 psError(PS_ERR_IO, false, "Unable to find NORM.CLASS value %s in CLASSID in camera configuration", options->normClass); 134 psFree(detview);134 psFree(detview); 135 135 return false; 136 136 } 137 // get the class_id from the rule137 // get the class_id from the rule 138 138 char *classID = pmFPAfileNameFromRule(rule, inputFile, view); 139 139 if (!classID) { 140 140 psError(PS_ERR_IO, false, "error converting CLASSID rule %s to name\n", rule); 141 psFree(detview);141 psFree(detview); 142 142 return false; 143 143 } 144 144 145 // get normalization from the class_id146 float norm = psMetadataLookupF32 (&mdok, normlist, classID);147 if (!mdok) {148 psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID);149 psFree(detview);150 return false;151 }145 // get normalization from the class_id 146 float norm = psMetadataLookupF32 (&mdok, normlist, classID); 147 if (!mdok) { 148 psError(PS_ERR_IO, false, "failed to find class ID %s in normalization table\n", classID); 149 psFree(detview); 150 return false; 151 } 152 152 153 153 pmHDU *hdu = pmHDUFromReadout(input); // HDU of interest … … 157 157 psFree(comment); 158 158 159 // apply the normalization159 // apply the normalization 160 160 psBinaryOp(input->image, input->image, "*", psScalarAlloc(norm, PS_TYPE_F32)); 161 161 162 psFree (classID);162 psFree (classID); 163 163 } 164 164 # endif … … 167 167 pmCell *fringe = pmFPAfileThisCell(config->files, detview, "PPIMAGE.FRINGE"); 168 168 if (!ppImageDetrendFringeMeasure(input, fringe, false, options)) { 169 psFree(detview);169 psFree(detview); 170 170 return false; 171 171 }
Note:
See TracChangeset
for help on using the changeset viewer.
