- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (1 prop)
-
psphot/src/psphotOutput.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/psphot
-
Property svn:mergeinfo
set to (toggle deleted branches)
/trunk/psphot merged eligible /branches/eam_branches/stackphot.20100406/psphot 27622-27655 /branches/pap_delete/psphot 27530-27595
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
branches/simtest_nebulous_branches/psphot/src
- Property svn:ignore
-
old new 18 18 psphotVersionDefinitions.h 19 19 psphotMomentsStudy 20 psphotPetrosianStudy 21 psphotForced 22 psphotMakePSF 23 psphotStack
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/psphot/src/psphotOutput.c
r21366 r27840 31 31 } 32 32 return background; 33 } 34 35 // dump source stats for psf stars 36 bool psphotDumpStats (psArray *sources, char *stage) { 37 38 char filename[64]; 39 snprintf (filename, 64, "psf.%s.dat", stage); 40 FILE *f = fopen (filename, "w"); 41 for (int i = 0; i < sources->n; i++) { 42 pmSource *source = sources->data[i]; 43 if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue; 44 45 pmModel *model = source->modelPSF; 46 if (!model) continue; 47 48 // int xc = source->peak->x - source->pixels->col0; 49 // int yc = source->peak->y - source->pixels->row0; 50 // float mcore = source->modelFlux ? source->modelFlux->data.F32[yc][xc] : NAN; 51 // float mpeak = model ? model->params->data.F32[PM_PAR_I0] : NAN; 52 // bool subtracted = source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED; 53 // fprintf (stderr, "%d %d : %d : %f %f : %f %f\n", source->peak->x, source->peak->y, subtracted, source->peak->flux, source->pixels->data.F32[yc][xc], mcore, mpeak); 54 55 fprintf (f, "%6.1f %6.1f : %6.1f %6.1f : %8.3f %8.3f %8.3f : %f : %f %f %f : %f\n", 56 source->peak->xf, source->peak->yf, 57 model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS], 58 source->psfMag, source->apMag, source->errMag, 59 model->params->data.F32[PM_PAR_I0], 60 model->params->data.F32[PM_PAR_SXX], model->params->data.F32[PM_PAR_SXY], model->params->data.F32[PM_PAR_SYY], 61 model->params->data.F32[PM_PAR_7]); 62 } 63 fclose (f); 64 return true; 33 65 } 34 66 … … 94 126 } 95 127 96 bool psphotAddPhotcode (psMetadata *recipe, pmConfig *config, const pmFPAview *view, const char *filerule) { 97 98 bool status; 99 100 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, filerule); 101 PS_ASSERT (status, false); 102 103 // determine PHOTCODE from fpa & view, overwrite in recipe 104 char *photcode = pmConceptsPhotcodeForView (input, view); 128 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view) { 129 130 bool status = false; 131 132 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 133 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 134 135 // loop over the available readouts 136 for (int i = 0; i < num; i++) { 137 if (!psphotAddPhotcodeReadout (config, view, "PSPHOT.INPUT", i)) { 138 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i); 139 return false; 140 } 141 } 142 return true; 143 } 144 145 bool psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 146 147 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 148 PS_ASSERT (file, false); 149 150 pmReadout *readout = pmFPAviewThisReadout (view, file->fpa); 151 152 // determine PHOTCODE from fpa & view, overwrite in readout->analysis 153 char *photcode = pmConceptsPhotcodeForView (file, view); 105 154 PS_ASSERT (photcode, false); 106 155 107 psMetadataAddStr (re cipe, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "photcode from FPA concepts", photcode);156 psMetadataAddStr (readout->analysis, PS_LIST_TAIL, "PHOTCODE", PS_META_REPLACE, "photcode from FPA concepts", photcode); 108 157 psLogMsg ("psphot", 3, "PHOTCODE is %s", photcode); 109 158 … … 112 161 } 113 162 114 bool psphotSetHeaderNstars (psMetadata * recipe, psArray *sources) {163 bool psphotSetHeaderNstars (psMetadata *header, psArray *sources) { 115 164 116 165 int nSrc = 0; … … 141 190 } 142 191 143 psMetadataAddS32 (recipe, PS_LIST_TAIL, "NSTARS", PS_META_REPLACE, "Number of sources", nSrc); 144 psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_EXT", PS_META_REPLACE, "Number of extended sources", nEXT); 145 psMetadataAddS32 (recipe, PS_LIST_TAIL, "NDET_CR", PS_META_REPLACE, "Number of cosmic rays", nCR); 146 return true; 147 } 148 149 // these values are saved in an output header stub - they are added to either the 150 // PHU header (CMP) or the MEF table header (CMF) 151 psMetadata *psphotDefineHeader (psMetadata *recipe) { 192 psMetadataAddS32 (header, PS_LIST_TAIL, "NSTARS", PS_META_REPLACE, "Number of sources", nSrc); 193 psMetadataAddS32 (header, PS_LIST_TAIL, "NDET_EXT", PS_META_REPLACE, "Number of extended sources", nEXT); 194 psMetadataAddS32 (header, PS_LIST_TAIL, "NDET_CR", PS_META_REPLACE, "Number of cosmic rays", nCR); 195 return true; 196 } 197 198 // these values are saved in an output header stub - they are added to either the PHU header 199 // (CMP) or the MEF table header (CMF). before the header is created, each readout has these 200 // values stored on readout->analysis 201 psMetadata *psphotDefineHeader (psMetadata *analysis) { 202 203 bool status = true; 152 204 153 205 psMetadata *header = psMetadataAlloc (); 154 206 155 207 // write necessary information to output header 156 psMetadataItemSupplement (header, recipe, "ZERO_PT"); 157 psMetadataItemSupplement (header, recipe, "PHOTCODE"); 158 159 psMetadataItemSupplement (header, recipe, "APMIFIT"); 160 psMetadataItemSupplement (header, recipe, "DAPMIFIT"); 161 psMetadataItemSupplement (header, recipe, "NAPMIFIT"); 162 psMetadataItemSupplement (header, recipe, "SKYBIAS"); 163 psMetadataItemSupplement (header, recipe, "SKYSAT"); 208 psMetadataItemSupplement (&status, header, analysis, "ZERO_PT"); 209 psMetadataItemSupplement (&status, header, analysis, "PHOTCODE"); 210 211 psMetadataItemSupplement (&status, header, analysis, "APMIFIT"); 212 psMetadataItemSupplement (&status, header, analysis, "DAPMIFIT"); 213 psMetadataItemSupplement (&status, header, analysis, "NAPMIFIT"); 164 214 165 215 // PSF model parameters (shape values for image center) 166 psMetadataItemSupplement ( header, recipe, "NPSFSTAR");167 psMetadataItemSupplement ( header, recipe, "APLOSS");168 169 psMetadataItemSupplement ( header, recipe, "FWHM_MAJ");170 psMetadataItemSupplement ( header, recipe, "FW_MJ_SG");171 psMetadataItemSupplement ( header, recipe, "FW_MJ_LQ");172 psMetadataItemSupplement ( header, recipe, "FW_MJ_UQ");173 174 psMetadataItemSupplement ( header, recipe, "FWHM_MIN");175 psMetadataItemSupplement ( header, recipe, "FW_MN_SG");176 psMetadataItemSupplement ( header, recipe, "FW_MN_LQ");177 psMetadataItemSupplement ( header, recipe, "FW_MN_UQ");178 179 psMetadataItemSupplement ( header, recipe, "ANGLE");216 psMetadataItemSupplement (&status, header, analysis, "NPSFSTAR"); 217 psMetadataItemSupplement (&status, header, analysis, "APLOSS"); 218 219 psMetadataItemSupplement (&status, header, analysis, "FWHM_MAJ"); 220 psMetadataItemSupplement (&status, header, analysis, "FW_MJ_SG"); 221 psMetadataItemSupplement (&status, header, analysis, "FW_MJ_LQ"); 222 psMetadataItemSupplement (&status, header, analysis, "FW_MJ_UQ"); 223 224 psMetadataItemSupplement (&status, header, analysis, "FWHM_MIN"); 225 psMetadataItemSupplement (&status, header, analysis, "FW_MN_SG"); 226 psMetadataItemSupplement (&status, header, analysis, "FW_MN_LQ"); 227 psMetadataItemSupplement (&status, header, analysis, "FW_MN_UQ"); 228 229 psMetadataItemSupplement (&status, header, analysis, "ANGLE"); 180 230 181 231 // Image Quality measurements 182 psMetadataItemSupplement ( header, recipe, "IQ_NSTAR");183 184 psMetadataItemSupplement ( header, recipe, "IQ_FW1");185 psMetadataItemSupplement ( header, recipe, "IQ_FW1_E");186 psMetadataItemSupplement ( header, recipe, "IQ_FW2");187 psMetadataItemSupplement ( header, recipe, "IQ_FW2_E");188 189 psMetadataItemSupplement ( header, recipe, "IQ_M2");190 psMetadataItemSupplement ( header, recipe, "IQ_M2_ER");191 psMetadataItemSupplement ( header, recipe, "IQ_M2_LQ");192 psMetadataItemSupplement ( header, recipe, "IQ_M2_UQ");193 194 psMetadataItemSupplement ( header, recipe, "IQ_M2C");195 psMetadataItemSupplement ( header, recipe, "IQ_M2C_E");196 psMetadataItemSupplement ( header, recipe, "IQ_M2C_L");197 psMetadataItemSupplement ( header, recipe, "IQ_M2C_U");198 199 psMetadataItemSupplement ( header, recipe, "IQ_M2S");200 psMetadataItemSupplement ( header, recipe, "IQ_M2S_E");201 psMetadataItemSupplement ( header, recipe, "IQ_M2S_L");202 psMetadataItemSupplement ( header, recipe, "IQ_M2S_U");203 204 psMetadataItemSupplement ( header, recipe, "IQ_M3");205 psMetadataItemSupplement ( header, recipe, "IQ_M3_ER");206 psMetadataItemSupplement ( header, recipe, "IQ_M3_LQ");207 psMetadataItemSupplement ( header, recipe, "IQ_M3_UQ");208 209 psMetadataItemSupplement ( header, recipe, "IQ_M4");210 psMetadataItemSupplement ( header, recipe, "IQ_M4_ER");211 psMetadataItemSupplement ( header, recipe, "IQ_M4_LQ");212 psMetadataItemSupplement ( header, recipe, "IQ_M4_UQ");232 psMetadataItemSupplement (&status, header, analysis, "IQ_NSTAR"); 233 234 psMetadataItemSupplement (&status, header, analysis, "IQ_FW1"); 235 psMetadataItemSupplement (&status, header, analysis, "IQ_FW1_E"); 236 psMetadataItemSupplement (&status, header, analysis, "IQ_FW2"); 237 psMetadataItemSupplement (&status, header, analysis, "IQ_FW2_E"); 238 239 psMetadataItemSupplement (&status, header, analysis, "IQ_M2"); 240 psMetadataItemSupplement (&status, header, analysis, "IQ_M2_ER"); 241 psMetadataItemSupplement (&status, header, analysis, "IQ_M2_LQ"); 242 psMetadataItemSupplement (&status, header, analysis, "IQ_M2_UQ"); 243 244 psMetadataItemSupplement (&status, header, analysis, "IQ_M2C"); 245 psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_E"); 246 psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_L"); 247 psMetadataItemSupplement (&status, header, analysis, "IQ_M2C_U"); 248 249 psMetadataItemSupplement (&status, header, analysis, "IQ_M2S"); 250 psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_E"); 251 psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_L"); 252 psMetadataItemSupplement (&status, header, analysis, "IQ_M2S_U"); 253 254 psMetadataItemSupplement (&status, header, analysis, "IQ_M3"); 255 psMetadataItemSupplement (&status, header, analysis, "IQ_M3_ER"); 256 psMetadataItemSupplement (&status, header, analysis, "IQ_M3_LQ"); 257 psMetadataItemSupplement (&status, header, analysis, "IQ_M3_UQ"); 258 259 psMetadataItemSupplement (&status, header, analysis, "IQ_M4"); 260 psMetadataItemSupplement (&status, header, analysis, "IQ_M4_ER"); 261 psMetadataItemSupplement (&status, header, analysis, "IQ_M4_LQ"); 262 psMetadataItemSupplement (&status, header, analysis, "IQ_M4_UQ"); 213 263 214 264 // XXX these need to be defined from elsewhere 215 265 psMetadataAdd (header, PS_LIST_TAIL, "FSATUR", PS_DATA_F32 | PS_META_REPLACE, "SATURATION MAG", 0.0); 216 266 psMetadataAdd (header, PS_LIST_TAIL, "FLIMIT", PS_DATA_F32 | PS_META_REPLACE, "COMPLETENESS MAG", 0.0); 217 psMetadataItemSupplement ( header, recipe, "NSTARS");218 219 psMetadataItemSupplement ( header, recipe, "NDET_EXT");220 psMetadataItemSupplement ( header, recipe, "NDET_CR");267 psMetadataItemSupplement (&status, header, analysis, "NSTARS"); 268 269 psMetadataItemSupplement (&status, header, analysis, "NDET_EXT"); 270 psMetadataItemSupplement (&status, header, analysis, "NDET_CR"); 221 271 222 272 // sky background model statistics 223 psMetadataItemSupplement ( header, recipe, "MSKY_MN");224 psMetadataItemSupplement ( header, recipe, "MSKY_SIG");225 psMetadataItemSupplement ( header, recipe, "MSKY_MIN");226 psMetadataItemSupplement ( header, recipe, "MSKY_MAX");227 psMetadataItemSupplement ( header, recipe, "MSKY_NX");228 psMetadataItemSupplement ( header, recipe, "MSKY_NY");273 psMetadataItemSupplement (&status, header, analysis, "MSKY_MN"); 274 psMetadataItemSupplement (&status, header, analysis, "MSKY_SIG"); 275 psMetadataItemSupplement (&status, header, analysis, "MSKY_MIN"); 276 psMetadataItemSupplement (&status, header, analysis, "MSKY_MAX"); 277 psMetadataItemSupplement (&status, header, analysis, "MSKY_NX"); 278 psMetadataItemSupplement (&status, header, analysis, "MSKY_NY"); 229 279 230 280 psMetadataAddF32 (header, PS_LIST_TAIL, "DT_PHOT", PS_META_REPLACE, "elapsed psphot time", psTimerMark ("psphotReadout")); 231 232 // XXX : don't require any of these about values to exist233 psErrorClear ();234 281 235 282 return header; … … 256 303 psImageKeepCircle (source->maskObj, x, y, radius, "OR", markVal); 257 304 pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal); 258 psImage KeepCircle (source->maskObj, x, y, radius, "AND", PS_NOT_IMAGE_MASK(markVal));305 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 259 306 } 260 307
Note:
See TracChangeset
for help on using the changeset viewer.
