Changeset 35531 for trunk/ppImage/src
- Timestamp:
- May 7, 2013, 4:01:35 PM (13 years ago)
- Location:
- trunk/ppImage/src
- Files:
-
- 6 edited
-
Makefile.am (modified) (1 diff)
-
ppImage.h (modified) (3 diffs)
-
ppImageAuxiliaryMask.c (modified) (8 diffs)
-
ppImageDetrendReadout.c (modified) (1 diff)
-
ppImageLoop.c (modified) (1 diff)
-
ppImageOptions.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/Makefile.am
r35081 r35531 65 65 ppImageMemory.c \ 66 66 ppImageAddNoise.c \ 67 ppImageRandomGaussian.c 67 ppImageRandomGaussian.c \ 68 ppImageAuxiliaryMask.c 68 69 69 70 CLEANFILES = *~ -
trunk/ppImage/src/ppImage.h
r35081 r35531 30 30 bool doMaskLow; // mask low pixels 31 31 bool doMask; // Mask bad pixels 32 bool doAuxMask; // apply auxillary mask 32 33 bool doNonLin; // Non-linearity correction 33 34 bool doOverscan; // Overscan subtraction … … 126 127 psU16 maskstat_magic; 127 128 psU16 maskstat_advisory; 129 130 psString auxVideoMask; // auxillary video mask file 128 131 129 132 } ppImageOptions; … … 312 315 void ppImageRandomGaussianFree(void); 313 316 317 bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options); 314 318 315 319 #endif -
trunk/ppImage/src/ppImageAuxiliaryMask.c
r35528 r35531 40 40 } 41 41 42 bool recordFileInHeader(pmChip *chip, psString tag, psString desc, psString filename) 43 { 44 pmHDU *hdu = pmHDUGetHighest(chip->parent, chip, NULL); 45 46 // strip off the directories and nebulous bits 47 char *base = filename; 48 for (char *new = base; (new = strpbrk(base, "/:")); base = new + 1); 49 50 psMetadataAddStr(hdu->header, PS_LIST_TAIL, tag, PS_META_DUPLICATE_OK, desc, base); 51 return true; 52 } 53 42 54 // In this function, we augment the mask with the more conservative auxiliary mask 43 55 bool ppImageAuxiliaryMask(pmConfig *config, const pmFPAview *view, const ppImageOptions *options) … … 51 63 } 52 64 53 bool status; // Status of MD lookup 65 bool status; 66 // Our target chip 54 67 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.CHIP"); // File to correct 55 68 if (!status) { … … 58 71 } 59 72 73 // Find a suitable detRun with type AUXMASK 74 60 75 psTime *time = psMetadataLookupPtr(NULL, input->fpa->concepts, "FPA.TIME"); 61 76 if (time->sec == 0 && time->nsec == 0) { … … 63 78 } 64 79 65 // XXX careful about this: is this set correctly in the camera.config files?66 80 char *cameraName = psMetadataLookupStr(NULL, input->fpa->concepts, "FPA.CAMERA"); 67 81 pmDetrendSelectOptions *detrendOptions = pmDetrendSelectOptionsAlloc(cameraName, *time, PM_DETREND_TYPE_AUXMASK); … … 80 94 } 81 95 82 #ifdef notdef 83 psMetadata *ppImageRecipe = psMetadataLookupPtr(NULL, config->recipes, RECIPE_NAME); 84 psAssert(ppImageRecipe, "Need PPIMAGE recipe"); 85 psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); 86 psAssert(psphotRecipe, "Need PSPHOT recipe"); 87 88 // XXX Should this be options->maskValue or options->maskValue & ~options->satMask? 89 // The latter will leave saturated pixels high 90 psImageMaskType maskVal = options->maskValue; 91 92 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 93 psMetadataAddImageMask(psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskVal); 94 #endif 95 96 // Go find the readout 97 // code to find the readouts was adapted from ppImageSubtractBackground 96 98 // XXX: shouldn't most of these psWarnings be psAsserts? 97 99 … … 129 131 psImage *mask = ro->mask; 130 132 131 // now read the mask file133 // now read the auxiliary mask file 132 134 psString class_id = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME"); 133 135 … … 139 141 140 142 psFree(results); 143 // record that we read this file in the config dump file. 144 // Note: this value isn't used during updates though. 145 pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXMASK", auxMaskFileName); 146 recordFileInHeader(chip, "DETREND.AUXMASK", "auxiliary mask", auxMaskFileName); 141 147 142 148 psImage *auxMask = readAuxiliaryMask(config, auxMaskFileName); 143 149 psFree(auxMaskFileName); 144 150 if (!auxMask) { 145 // readAuxiliaryMask prints enough diagnostic information151 psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary mask file"); 146 152 return false; 147 153 } … … 151 157 psImage *videoMask = readAuxiliaryMask(config, options->auxVideoMask); 152 158 if (!videoMask) { 159 psError(PS_ERR_UNKNOWN, false, "failed to read auxiliary video mask file"); 153 160 return false; 154 161 } 155 // auxMask *= videoMask 162 pmConfigRunFilenameAddRead(config, "PPIMAGE.AUXVIDEOMASK", options->auxVideoMask); 163 recordFileInHeader(chip, "DETREND.AUXVIDEOMASK", "auxiliary video mask", options->auxVideoMask); 164 165 // compute auxMask *= videoMask 156 166 if (!psBinaryOp(auxMask, auxMask, "*", videoMask)) { 157 167 psError(PS_ERR_UNKNOWN, false, "mulitplication of auxiliary mask and auxiliary video mask failed"); -
trunk/ppImage/src/ppImageDetrendReadout.c
r34082 r35531 50 50 char *Vptr = strchr(psMetadataLookupStr(NULL,input->parent->parent->hdu->header,"CELLMODE"),'V'); 51 51 if (Vptr) { 52 hasVideo = true;52 hasVideo = options->hasVideo = true; 53 53 psLogMsg ("ppImage.detrend", PS_LOG_INFO, "VIDEO: %d %d %d\n",(int) options->hasVideo,(int) options->useVideoDark, (int) options->useVideoMask); 54 54 } -
trunk/ppImage/src/ppImageLoop.c
r35081 r35531 188 188 ESCAPE("Unable to mosaic chip"); 189 189 } 190 191 if (!ppImageAuxiliaryMask(config, view, options)) { 192 ESCAPE("Unable to apply auxiliary mask"); 193 } 194 190 195 timeDetrend += psTimerClear(TIMER_DETREND); 191 196 -
trunk/ppImage/src/ppImageOptions.c
r35081 r35531 10 10 // psFree(options->nonLinearData); 11 11 // psFree(options->nonLinearSource); 12 psFree(options->auxVideoMask); 12 13 } 13 14 … … 24 25 options->doVarianceBuild = false; // Build internal variance 25 26 options->doMask = false; // Mask bad pixels 27 options->doAuxMask = false; // apply auxillary mask 26 28 options->doNonLin = false; // Non-linearity correction 27 29 options->doOverscan = false; // Overscan subtraction … … 116 118 options->normClass = NULL; // per-class normalizations refer to this class 117 119 120 options->auxVideoMask = NULL; // auxillary video mask file name 121 118 122 return options; 119 123 } … … 228 232 options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL"); 229 233 options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD"); 234 options->doAuxMask = psMetadataLookupBool(NULL, recipe, "MASK.AUXMASK"); 235 if (options->doAuxMask) { 236 // if we are applying an auxiliary mask we can optionally apply another 237 // mask to video cells only. 238 psString auxVideoMask = psMetadataLookupStr(NULL, recipe, "AUX.VIDEO.MASK"); 239 // save the value if defined and not the value "NULL" 240 if (auxVideoMask && strcmp(auxVideoMask, "NULL")) { 241 options->auxVideoMask = psStringCopy(auxVideoMask); 242 } 243 } 230 244 231 245 // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
Note:
See TracChangeset
for help on using the changeset viewer.
