Changeset 30871
- Timestamp:
- Mar 10, 2011, 5:31:06 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 3 edited
-
psphotDeblendSatstars.c (modified) (1 diff)
-
psphotStackImageLoop.c (modified) (8 diffs)
-
psphotStackMatchPSFs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphotDeblendSatstars.c
r29936 r30871 86 86 // XXX filter? if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 87 87 if (source->mode & PM_SOURCE_MODE_BLEND) continue; 88 if (source->peak->flux < SAT URATION) continue;88 if (source->peak->flux < SAT_TEST_LEVEL) continue; 89 89 90 90 // save these for reference below -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackImageLoop.c
r30776 r30871 1 1 # include "psphotStandAlone.h" 2 #define WCS_NONLIN_TOL 0.001 // Non-linear tolerance for header WCS3 2 4 3 # define ESCAPE(MESSAGE) { \ … … 8 7 } 9 8 10 bool GetAstrometryFPA (pmConfig *config, pmFPAview *view); 11 bool SetAstrometryFPA (pmConfig *config, pmFPAview *view, bool bilevelAstrometry);12 bool GetAstrometryChip (pmConfig *config, pmFPAview *view, bool bilevelAstrometry);9 // XXX this implementation is not smart about multi-level astrometry headers 10 bool UpdateHeadersForFPA (pmConfig *config, pmFPAview *view); 11 bool UpdateHeadersForChip (pmConfig *config, pmFPAview *view); 13 12 14 13 bool psphotStackImageLoop (pmConfig *config) { … … 34 33 // XXX for now, just load the full set of images up front 35 34 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot."); 36 37 bool bilevelAstrometry = GetAstrometryFPA(config, view);38 35 39 36 // for psphot, we force data to be read at the chip level … … 83 80 } 84 81 85 GetAstrometryChip(config, view, bilevelAstrometry);82 UpdateHeadersForChip(config, view); 86 83 87 84 // save output which is saved at the chip level … … 90 87 psMemDump("doneloop"); 91 88 92 SetAstrometryFPA(config, view, bilevelAstrometry);93 89 UpdateHeadersForFPA(config, view); 90 94 91 // save output which is saved at the fpa level 95 92 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed ouput for FPA in psphot."); … … 104 101 } 105 102 106 /* 107 the easiest way to implement this is to assume we can pre-load the full set of images up front. 108 with 5 filters and 6000^2 (image, mask, var = 10 byte per pixel), we need 1.8GB, which is not too bad. 109 */ 110 111 # define UPDATE_HEADER 1 112 113 bool GetAstrometryFPA (pmConfig *config, pmFPAview *view) { 114 115 bool foundAstrometry = false; 116 bool bilevelAstrometry = false; 103 bool UpdateHeadersForChip (pmConfig *config, pmFPAview *view) { 117 104 118 105 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); … … 130 117 psAssert (input, "missing input file"); 131 118 132 // find the FPA phu 133 pmHDU *phu = pmFPAviewThisPHU(view, input->fpa); 134 if (!phu) { 135 psWarning("Unable to read bilevel mosaic astrometry for input FPA entry %d", i); 136 continue; 119 // just copy the input headers to the output headers, then update version info 120 pmChip *inChip = pmFPAviewThisChip(view, input->fpa); ///< Chip in the input 121 pmHDU *inHDU = pmFPAviewThisHDU (view, input->fpa); 122 123 pmChip *outChip = pmFPAviewThisChip(view, output->fpa); ///< Chip in the output 124 pmHDU *outHDU = pmFPAviewThisHDU (view, output->fpa); 125 if (!outHDU) { 126 pmFPAAddSourceFromView(output->fpa, view, output->format); 127 outHDU = pmFPAviewThisHDU (view, output->fpa); 128 psAssert (outHDU, "failed to make HDU"); 137 129 } 138 139 char *ctype = psMetadataLookupStr(NULL, phu->header, "CTYPE1"); 140 if (!ctype) { 141 psWarning("Error in WCS keywords for input FPA entry %d", i); 142 continue; 130 if (!outHDU->header) { 131 outHDU->header = psMetadataCopy(NULL, inHDU->header); 143 132 } 144 145 if (!foundAstrometry) { 146 bilevelAstrometry = !strcmp (&ctype[4], "-DIS"); 147 } else { 148 if (bilevelAstrometry != !strcmp (&ctype[4], "-DIS")) { 149 psAbort("astrometry type mis-match"); 150 } 151 } 152 153 if (bilevelAstrometry) { 154 // update the output structures 155 if (!pmAstromReadBilevelMosaic(output->fpa, phu->header)) { 156 psWarning("Unable to read bilevel mosaic astrometry for input FPA."); 157 } 158 } 133 outChip->toFPA = psMemIncrRefCounter(inChip->toFPA); 134 outChip->fromFPA = psMemIncrRefCounter(inChip->fromFPA); 159 135 } 160 return bilevelAstrometry;136 return true; 161 137 } 162 138 163 bool GetAstrometryChip (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) {139 bool UpdateHeadersForFPA (pmConfig *config, pmFPAview *view) { 164 140 165 141 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); … … 177 153 psAssert (input, "missing input file"); 178 154 179 // Need to update the output for astrometry. Read WCS data from the corresponding 180 // header and save in the output fpa 181 pmHDU *inHDU = pmFPAviewThisHDU (view, input->fpa); 182 pmChip *outChip = pmFPAviewThisChip(view, output->fpa); ///< Chip in the output 155 output->fpa->toTPA = psMemIncrRefCounter(input->fpa->toTPA); 156 output->fpa->fromTPA = psMemIncrRefCounter(input->fpa->fromTPA); 157 output->fpa->toSky = psMemIncrRefCounter(input->fpa->toSky); 183 158 184 pmHDU *outHDU = pmFPAviewThisHDU (view, output->fpa); 185 if (!outHDU) { 186 pmFPAAddSourceFromView(output->fpa, view, output->format); 187 outHDU = pmFPAviewThisHDU (view, output->fpa); 188 psAssert (outHDU, "failed to make HDU"); 189 } 190 if (!outHDU->header) { 191 outHDU->header = psMetadataAlloc(); 192 } 159 pmConceptsCopyFPA(output->fpa, input->fpa, true, true); 193 160 194 if (bilevelAstrometry) { 195 if (!pmAstromReadBilevelChip (outChip, inHDU->header)) { 196 psWarning("Unable to read bilevel chip astrometry for input FPA."); 197 continue; 198 } 199 if (!pmAstromWriteBilevelChip(outHDU->header, outChip, WCS_NONLIN_TOL)) { 200 psWarning("Unable to generate WCS header."); 201 continue; 202 } 203 } else { 204 // we use a default FPA pixel scale of 1.0 205 if (!pmAstromReadWCS (output->fpa, outChip, inHDU->header, 1.0)) { 206 psWarning("Unable to read WCS astrometry for input FPA."); 207 continue; 208 } 209 if (!pmAstromWriteWCS(outHDU->header, output->fpa, outChip, WCS_NONLIN_TOL)) { 210 psWarning("Unable to generate WCS header."); 211 continue; 212 } 213 } 161 // XXX TEST 162 // pmFPASetFileStatus(output->fpa, true); 163 // pmFPASetDataStatus(output->fpa, true); 164 // pmChip *chip = output->fpa->chips->data[0]; 165 // pmCell *cell = chip->cells->data[0]; 166 // pmReadout *readout = cell->readouts->data[0]; 214 167 } 215 216 168 return true; 217 169 } 218 170 219 bool SetAstrometryFPA (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) { 171 /* 172 the easiest way to implement this is to assume we can pre-load the full set of images up front. 173 with 5 filters and 6000^2 (image, mask, var = 10 byte per pixel), we need 1.8GB, which is not too bad. 174 */ 220 175 221 if (!bilevelAstrometry) return true;222 223 int num = psphotFileruleCount(config, "PSPHOT.INPUT");224 225 // loop over the available readouts226 for (int i = 0; i < num; i++) {227 228 // find the currently selected readout229 pmFPAfile *output = pmFPAfileSelectSingle(config->files, "PSPHOT.STACK.OUTPUT.IMAGE", i); // File of interest230 psAssert (output, "missing file?");231 232 pmHDU *PHU = pmFPAviewThisPHU(view, output->fpa);233 if (!PHU) {234 pmFPAAddSourceFromView(output->fpa, view, output->format);235 PHU = pmFPAviewThisPHU (view, output->fpa);236 psAssert (PHU, "failed to make PHU");237 }238 if (!PHU->header) {239 PHU->header = psMetadataAlloc();240 }241 242 if (!pmAstromWriteBilevelMosaic(PHU->header, output->fpa, WCS_NONLIN_TOL)) {243 psWarning("Unable to generate WCS header.");244 }245 }246 247 return true;248 } -
branches/eam_branches/ipp-20110213/psphot/src/psphotStackMatchPSFs.c
r30624 r30871 92 92 } 93 93 94 // copy the header data from Src to Out 95 // pmHDU *hduSrc = pmHDUFromReadout(readoutSrc); 96 // psAssert (hduSrc, "input missing hdu?"); 97 98 94 99 // set NAN pixels to 'SAT' 95 100 psImageMaskType maskSat = pmConfigMaskGet("SAT", config);
Note:
See TracChangeset
for help on using the changeset viewer.
