- Timestamp:
- Nov 8, 2011, 2:56:56 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
- 1 copied
-
psModules/src/objects/Makefile.am (modified) (3 diffs)
-
psModules/src/objects/mksource.pl (modified) (1 diff)
-
psModules/src/objects/pmSource.c (modified) (1 diff)
-
psModules/src/objects/pmSource.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF.c.in (modified) (7 diffs)
-
psphot (modified) (1 prop)
-
psphot/src/Makefile.am (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (2 diffs)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
psphot/src/psphotFitSourcesLinear.c (modified) (1 diff)
-
psphot/src/psphotGuessModels.c (modified) (1 diff)
-
psphot/src/psphotKronIterate.c (modified) (3 diffs)
-
psphot/src/psphotRadialApertures.c (modified) (20 diffs)
-
psphot/src/psphotRadialProfileWings.c (copied) (copied from branches/eam_branches/ipp-20110906/psphot/src/psphotRadialProfileWings.c )
-
psphot/src/psphotReadout.c (modified) (2 diffs)
-
psphot/src/psphotSetThreads.c (modified) (1 diff)
-
psphot/src/psphotSourceFits.c (modified) (1 diff)
-
psphot/src/psphotSourceMatch.c (modified) (8 diffs)
-
psphot/src/psphotSourceSize.c (modified) (1 diff)
-
psphot/src/psphotSourceStats.c (modified) (1 diff)
-
psphot/src/psphotStackObjects.c (modified) (5 diffs)
-
psphot/src/psphotStackReadout.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/Makefile.am
r32347 r32633 45 45 pmSourceIO_CMF_PS1_V2.c \ 46 46 pmSourceIO_CMF_PS1_V3.c \ 47 pmSourceIO_CMF_PS1_V4.c \ 47 48 pmSourceIO_CMF_PS1_SV1.c \ 48 49 pmSourceIO_CMF_PS1_DV1.c \ … … 130 131 131 132 # pmSourceID_CMF_* functions use a common framework 132 BUILT_SOURCES = pmSourceIO_CMF_PS1_V1.c pmSourceIO_CMF_PS1_V2.c pmSourceIO_CMF_PS1_V3.c 133 BUILT_SOURCES = pmSourceIO_CMF_PS1_V1.c pmSourceIO_CMF_PS1_V2.c pmSourceIO_CMF_PS1_V3.c pmSourceIO_CMF_PS1_V4.c 133 134 134 135 pmSourceIO_CMF_PS1_V1.c : pmSourceIO_CMF.c.in mksource.pl … … 141 142 mksource.pl pmSourceIO_CMF.c.in PS1_V3 pmSourceIO_CMF_PS1_V3.c 142 143 144 pmSourceIO_CMF_PS1_V4.c : pmSourceIO_CMF.c.in mksource.pl 145 mksource.pl pmSourceIO_CMF.c.in PS1_V4 pmSourceIO_CMF_PS1_V4.c 146 143 147 # EXTRA_DIST = pmErrorCodes.h.in pmErrorCodes.dat pmErrorCodes.c.in -
trunk/psModules/src/objects/mksource.pl
r32347 r32633 16 16 %cmfmodes = ("PS1_V1", 1, 17 17 "PS1_V2", 2, 18 "PS1_V3", 3); 18 "PS1_V3", 3, 19 "PS1_V4", 4); 19 20 20 21 print "1: $cmfmodes{1}\n"; -
trunk/psModules/src/objects/pmSource.c
r32347 r32633 137 137 source->apFlux = NAN; 138 138 source->apFluxErr = NAN; 139 140 source->skyRadius = NAN; 141 source->skyFlux = NAN; 142 source->skySlope = NAN; 139 143 140 144 source->pixWeightNotBad = NAN; -
trunk/psModules/src/objects/pmSource.h
r32347 r32633 36 36 PM_SOURCE_TMPF_MOMENTS_MEASURED = 0x0010, 37 37 PM_SOURCE_TMPF_CANDIDATE_PSFSTAR = 0x0020, 38 PM_SOURCE_TMPF_STACK_KEEP = 0x0040, 39 PM_SOURCE_TMPF_STACK_SKIP = 0x0080, 38 PM_SOURCE_TMPF_RADIAL_KEEP = 0x0040, 39 PM_SOURCE_TMPF_RADIAL_SKIP = 0x0080, 40 PM_SOURCE_TMPF_PETRO_KEEP = 0x0100, 41 PM_SOURCE_TMPF_PETRO_SKIP = 0x0200, 40 42 } pmSourceTmpF; 41 43 … … 95 97 float apFluxErr; ///< apFluxErr corresponding to psfMag or extMag (depending on type) 96 98 99 float skyRadius; ///< radius at which profile hits local sky (or goes flat) 100 float skyFlux; ///< mean flux per pixel in aperture at which profile hits local sky (or goes flat) 101 float skySlope; ///< mean flux slope at which profile hits local sky (or goes flat) 102 97 103 float pixWeightNotBad; ///< PSF-weighted coverage of unmasked (not BAD) pixels 98 104 float pixWeightNotPoor; ///< PSF-weighted coverage of unmasked (not POOR) pixels -
trunk/psModules/src/objects/pmSourceIO.c
r31670 r32633 569 569 PM_SOURCES_WRITE("PS1_V2", CMF_PS1_V2); 570 570 PM_SOURCES_WRITE("PS1_V3", CMF_PS1_V3); 571 PM_SOURCES_WRITE("PS1_V4", CMF_PS1_V4); 571 572 PM_SOURCES_WRITE("PS1_SV1", CMF_PS1_SV1); 572 573 PM_SOURCES_WRITE("PS1_DV1", CMF_PS1_DV1); … … 1025 1026 sources = pmSourcesRead_CMF_PS1_V3 (file->fits, hdu->header); 1026 1027 } 1028 if (!strcmp (exttype, "PS1_V4")) { 1029 sources = pmSourcesRead_CMF_PS1_V4 (file->fits, hdu->header); 1030 } 1027 1031 if (!strcmp (exttype, "PS1_SV1")) { 1028 1032 sources = pmSourcesRead_CMF_PS1_SV1 (file->fits, hdu->header); -
trunk/psModules/src/objects/pmSourceIO.h
r30621 r32633 62 62 bool pmSourcesWrite_CMF_PS1_V3_XRAD(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 63 63 64 bool pmSourcesWrite_CMF_PS1_V4(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 65 bool pmSourcesWrite_CMF_PS1_V4_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 66 bool pmSourcesWrite_CMF_PS1_V4_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 67 bool pmSourcesWrite_CMF_PS1_V4_XRAD(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 68 64 69 bool pmSourcesWrite_CMF_PS1_SV1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 65 70 bool pmSourcesWrite_CMF_PS1_SV1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); … … 86 91 psArray *pmSourcesRead_CMF_PS1_V2 (psFits *fits, psMetadata *header); 87 92 psArray *pmSourcesRead_CMF_PS1_V3 (psFits *fits, psMetadata *header); 93 psArray *pmSourcesRead_CMF_PS1_V4 (psFits *fits, psMetadata *header); 88 94 psArray *pmSourcesRead_CMF_PS1_SV1 (psFits *fits, psMetadata *header); 89 95 psArray *pmSourcesRead_CMF_PS1_DV1 (psFits *fits, psMetadata *header); -
trunk/psModules/src/objects/pmSourceIO_CMF.c.in
r32347 r32633 127 127 128 128 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 129 @ =PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw);129 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw); 130 130 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", outputs.apRadius); 131 131 @<PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", outputs.peakMag); … … 138 138 @>PS1_V1@ psMetadataAdd (row, PS_LIST_TAIL, "DEC_PSF", PS_DATA_F64, "PSF DEC coordinate (degrees)", outputs.dec); 139 139 140 @ =PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", outputs.peakMag);140 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", outputs.peakMag); 141 141 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "SKY", PS_DATA_F32, "Sky level", source->sky); 142 142 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "SKY_SIGMA", PS_DATA_F32, "Sigma of sky level", source->skyErr); … … 150 150 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_THETA", PS_DATA_F32, "PSF orientation angle", outputs.psfTheta); 151 151 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF", PS_DATA_F32, "PSF coverage/quality factor (bad)", source->pixWeightNotBad); 152 @ =PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT", PS_DATA_F32, "PSF coverage/quality factor (poor)", source->pixWeightNotPoor);152 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT", PS_DATA_F32, "PSF coverage/quality factor (poor)", source->pixWeightNotPoor); 153 153 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_NDOF", PS_DATA_S32, "degrees of freedom", outputs.nDOF); 154 154 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_NPIX", PS_DATA_S32, "number of pixels in fit", outputs.nPix); … … 158 158 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_YY", PS_DATA_F32, "second moments (Y*Y)", moments.Myy); 159 159 160 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C", PS_DATA_F32, "third momemt cos theta", moments.M_c3); 161 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S", PS_DATA_F32, "third momemt sin theta", moments.M_s3); 162 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C", PS_DATA_F32, "fourth momemt cos theta", moments.M_c4); 163 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S", PS_DATA_F32, "fourth momemt sin theta", moments.M_s4); 164 165 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1", PS_DATA_F32, "first radial moment", moments.Mrf); 166 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH", PS_DATA_F32, "half radial moment", moments.Mrh); 167 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Krf); 168 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_ERR", PS_DATA_F32, "Kron Flux Error", moments.dKrf); 169 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kinner); 170 @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kouter); 171 172 // XXX do not keep this long term, just a TEST: 173 // @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_PSF", PS_DATA_F32, "Kron Flux", moments.KronPSF); 174 // @=PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_PSF_SIG",PS_DATA_F32, "Kron Flux", moments.KronPSFErr); 175 // Do NOT write these : not consistent with the definition of PS1_V3 in Ohana/src/libautocode/dev/cmf-ps1-v3.d 176 // psMetadataAdd (row, PS_LIST_TAIL, "KRON_CORE_FLUX", PS_DATA_F32, "Kron Flux (in 1.0 R1)", moments.KronCore); 177 // psMetadataAdd (row, PS_LIST_TAIL, "KRON_CORE_ERROR", PS_DATA_F32, "Kron Error (in 1.0 R1)", moments.KronCoreErr); 160 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C", PS_DATA_F32, "third momemt cos theta", moments.M_c3); 161 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S", PS_DATA_F32, "third momemt sin theta", moments.M_s3); 162 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C", PS_DATA_F32, "fourth momemt cos theta", moments.M_c4); 163 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S", PS_DATA_F32, "fourth momemt sin theta", moments.M_s4); 164 165 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1", PS_DATA_F32, "first radial moment", moments.Mrf); 166 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH", PS_DATA_F32, "half radial moment", moments.Mrh); 167 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Krf); 168 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_ERR", PS_DATA_F32, "Kron Flux Error", moments.dKrf); 169 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kinner); 170 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kouter); 171 172 @>PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_RAD", PS_DATA_F32, "Radius where object hits sky", source->skyRadius); 173 @>PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_FLUX", PS_DATA_F32, "Flux / pix where object hits sky", source->skyFlux); 174 @>PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "SKY_LIMIT_SLOPE", PS_DATA_F32, "d(Flux/pix)/dRadius where object hits sky", source->skySlope); 178 175 179 176 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "FLAGS", PS_DATA_U32, "psphot analysis flags", source->mode); 180 @ =PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2", PS_DATA_U32, "psphot analysis flags", source->mode2);181 @ =PS1_V3@ psMetadataAdd (row, PS_LIST_TAIL, "PADDING2", PS_DATA_S32, "more padding", 0);177 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2", PS_DATA_U32, "psphot analysis flags", source->mode2); 178 @>PS1_V2@ psMetadataAdd (row, PS_LIST_TAIL, "PADDING2", PS_DATA_S32, "more padding", 0); 182 179 183 180 // XXX not sure how to get this : need to load Nimages with weight? … … 286 283 @ALL@ source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 287 284 @ALL@ source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 288 @ =PS1_V3@ source->apMagRaw = psMetadataLookupF32 (&status, row, "AP_MAG_RAW");285 @>PS1_V2@ source->apMagRaw = psMetadataLookupF32 (&status, row, "AP_MAG_RAW"); 289 286 290 287 // XXX use these to determine PAR[PM_PAR_I0] if they exist? 291 @ =PS1_V3@ source->psfFlux = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX");292 @ =PS1_V3@ source->psfFluxErr= psMetadataLookupF32 (&status, row, "PSF_INST_FLUX_SIG");288 @>PS1_V2@ source->psfFlux = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX"); 289 @>PS1_V2@ source->psfFluxErr= psMetadataLookupF32 (&status, row, "PSF_INST_FLUX_SIG"); 293 290 294 291 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor … … 311 308 312 309 @ALL@ source->pixWeightNotBad = psMetadataLookupF32 (&status, row, "PSF_QF"); 313 @ =PS1_V3@ source->pixWeightNotPoor = psMetadataLookupF32 (&status, row, "PSF_QF_PERFECT");310 @>PS1_V2@ source->pixWeightNotPoor = psMetadataLookupF32 (&status, row, "PSF_QF_PERFECT"); 314 311 @ALL@ source->crNsigma = psMetadataLookupF32 (&status, row, "CR_NSIGMA"); 315 312 @ALL@ source->extNsigma = psMetadataLookupF32 (&status, row, "EXT_NSIGMA"); … … 329 326 @ALL@ source->moments->Myy = psMetadataLookupF32 (&status, row, "MOMENTS_YY"); 330 327 331 @=PS1_V3@ source->moments->Mrf = psMetadataLookupF32 (&status, row, "MOMENTS_R1"); 332 @=PS1_V3@ source->moments->Mrh = psMetadataLookupF32 (&status, row, "MOMENTS_RH"); 333 @=PS1_V3@ source->moments->KronFlux = psMetadataLookupF32 (&status, row, "KRON_FLUX"); 334 @=PS1_V3@ source->moments->KronFluxErr = psMetadataLookupF32 (&status, row, "KRON_FLUX_ERR"); 335 336 @=PS1_V3@ source->moments->KronFinner = psMetadataLookupF32 (&status, row, "KRON_FLUX_INNER"); 337 @=PS1_V3@ source->moments->KronFouter = psMetadataLookupF32 (&status, row, "KRON_FLUX_OUTER"); 328 @>PS1_V2@ source->moments->Mrf = psMetadataLookupF32 (&status, row, "MOMENTS_R1"); 329 @>PS1_V2@ source->moments->Mrh = psMetadataLookupF32 (&status, row, "MOMENTS_RH"); 330 @>PS1_V2@ source->moments->KronFlux = psMetadataLookupF32 (&status, row, "KRON_FLUX"); 331 @>PS1_V2@ source->moments->KronFluxErr = psMetadataLookupF32 (&status, row, "KRON_FLUX_ERR"); 332 333 @>PS1_V2@ source->moments->KronFinner = psMetadataLookupF32 (&status, row, "KRON_FLUX_INNER"); 334 @>PS1_V2@ source->moments->KronFouter = psMetadataLookupF32 (&status, row, "KRON_FLUX_OUTER"); 335 336 @>PS1_V3@ source->skyRadius = psMetadataLookupF32 (&status, row, "SKY_LIMIT_RAD"); 337 @>PS1_V3@ source->skyFlux = psMetadataLookupF32 (&status, row, "SKY_LIMIT_FLUX"); 338 @>PS1_V3@ source->skySlope = psMetadataLookupF32 (&status, row, "SKY_LIMIT_SLOPE"); 338 339 339 340 // XXX we do not save all of the 3rd and 4th moment parameters. when we load in data, 340 341 // we are storing enough information so the output will be consistent with the input 341 @ =PS1_V3@ source->moments->Mxxx = +1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3C");342 @ =PS1_V3@ source->moments->Mxxy = 0.0;343 @ =PS1_V3@ source->moments->Mxyy = 0.0;344 @ =PS1_V3@ source->moments->Myyy = -1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3S");345 346 @ =PS1_V3@ source->moments->Mxxxx = +1.00 * psMetadataLookupF32 (&status, row, "MOMENTS_M4C");347 @ =PS1_V3@ source->moments->Mxxxy = 0.0;348 @ =PS1_V3@ source->moments->Mxxyy = 0.0;349 @ =PS1_V3@ source->moments->Mxyyy = -0.25 * psMetadataLookupF32 (&status, row, "MOMENTS_M4S");350 @ =PS1_V3@ source->moments->Myyyy = 0.0;342 @>PS1_V2@ source->moments->Mxxx = +1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3C"); 343 @>PS1_V2@ source->moments->Mxxy = 0.0; 344 @>PS1_V2@ source->moments->Mxyy = 0.0; 345 @>PS1_V2@ source->moments->Myyy = -1.0 * psMetadataLookupF32 (&status, row, "MOMENTS_M3S"); 346 347 @>PS1_V2@ source->moments->Mxxxx = +1.00 * psMetadataLookupF32 (&status, row, "MOMENTS_M4C"); 348 @>PS1_V2@ source->moments->Mxxxy = 0.0; 349 @>PS1_V2@ source->moments->Mxxyy = 0.0; 350 @>PS1_V2@ source->moments->Mxyyy = -0.25 * psMetadataLookupF32 (&status, row, "MOMENTS_M4S"); 351 @>PS1_V2@ source->moments->Myyyy = 0.0; 351 352 352 353 @ALL@ source->mode = psMetadataLookupU32 (&status, row, "FLAGS"); 353 @ =PS1_V3@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2");354 @>PS1_V2@ source->mode2 = psMetadataLookupU32 (&status, row, "FLAGS2"); 354 355 assert (status); 355 356 -
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110906/psphot (added) merged: 32605-32606,32612-32613,32616,32619,32628,32630
- Property svn:mergeinfo changed
-
trunk/psphot/src/Makefile.am
r32348 r32633 185 185 psphotKronMasked.c \ 186 186 psphotKronIterate.c \ 187 psphotRadialProfileWings.c \ 187 188 psphotDeblendSatstars.c \ 188 189 psphotMosaicSubimage.c \ … … 201 202 psphotRadialBins.c \ 202 203 psphotRadialApertures.c \ 203 psphotRadialAperturesByObject.c \204 204 psphotPetrosian.c \ 205 205 psphotPetrosianRadialBins.c \ -
trunk/psphot/src/psphot.h
r32348 r32633 428 428 bool psphotRadialAperturesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, int entry); 429 429 bool psphotRadialApertures_Threaded (psThreadJob *job); 430 bool psphotRadialApertureSource (pmSource *source, psMetadata *recipe, psImageMaskType maskVal, const psVector *radMax, int entry); 430 bool psphotRadialApertureSource (pmSource *source, pmReadout *readout, int entry, psVector *pixRadius2, psVector *pixFlux, psVector *pixVer); 431 // bool psphotRadialApertureSource (pmSource *source, int entry); 431 432 432 433 bool psphotExtendedSourceAnalysisByObject (pmConfig *config, psArray *objects, const pmFPAview *view, const char *filerule); … … 466 467 bool psphotKronIterate_Threaded (psThreadJob *job); 467 468 469 bool psphotRadialProfileWings (pmConfig *config, const pmFPAview *view, const char *filerule); 470 bool psphotRadialProfileWingsReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources); 471 bool psphotRadialProfileWings_Threaded (psThreadJob *job); 472 468 473 bool psphotStackObjectsSelectForAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects); 469 474 -
trunk/psphot/src/psphotExtendedSourceAnalysis.c
r32348 r32633 209 209 // if we have checked the source validity on the basis of the object set, then 210 210 // we either skip these tests below or we skip the source completely 211 if (source->tmpFlags & PM_SOURCE_TMPF_ STACK_SKIP) continue;212 if (source->tmpFlags & PM_SOURCE_TMPF_ STACK_KEEP) goto keepSource;211 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_SKIP) continue; 212 if (source->tmpFlags & PM_SOURCE_TMPF_PETRO_KEEP) goto keepSource; 213 213 214 214 // skip PSF-like and non-astronomical objects -
trunk/psphot/src/psphotFitSourcesLinear.c
r32348 r32633 134 134 for (int i = 0; i < sources->n; i++) { 135 135 pmSource *source = sources->data[i]; 136 137 // psAssert (source->peak, "source without peak??"); 138 // psAssert (source->peak->footprint, "peak without footprint??"); 136 139 137 140 // turn this bit off and turn it on again if we pass this test -
trunk/psphot/src/psphotGuessModels.c
r32348 r32633 170 170 if (!source->peak) continue; 171 171 172 // psAssert (source->peak->footprint, "peak without footprint??"); 173 172 174 nSrc ++; 173 175 -
trunk/psphot/src/psphotKronIterate.c
r32348 r32633 151 151 } 152 152 # else 153 if (!psphot ExtendedSourceFits_Threaded(job)) {153 if (!psphotKronIterate_Threaded(job)) { 154 154 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 155 155 psFree(AnalysisRegion); … … 192 192 float MIN_KRON_RADIUS = PS_SCALAR_VALUE(job->args->data[6],F32); 193 193 194 for (int j = 0; j < 5; j++) { 194 // XXX TEST : set iteration to 1 195 for (int j = 0; j < 1; j++) { 195 196 for (int i = 0; i < sources->n; i++) { 196 197 … … 209 210 210 211 // use S/N to control max window size 211 float kronSN = source->moments->KronFlux / source->moments->KronFluxErr;212 // float kronSN = source->moments->KronFlux / source->moments->KronFluxErr; 212 213 213 214 // maxWindow -> 1.5*RADIUS for kronSN = 5.0, keeping S.B. constant (kronSN ~ flux) 214 215 // (kronSN / maxWindow^2) = (5.0 / (1.5 RADIUS)^2) 215 216 // maxWindow = 1.5 * RADIUS * sqrt(kronSN / 5.0) 216 float maxWindow = (isfinite(kronSN) && (kronSN > 5.0)) ? 1.5 * RADIUS * sqrt(kronSN / 5.0) : 1.5*RADIUS;217 // XXX float maxWindow = (isfinite(kronSN) && (kronSN > 5.0)) ? 1.5 * RADIUS * sqrt(kronSN / 5.0) : 1.5*RADIUS; 217 218 218 219 // iterate to the window radius 219 float windowRadius = PS_MIN(PS_MAX(RADIUS, 4.0*source->moments->Mrf), maxWindow); 220 // XXX float windowRadius = PS_MIN(PS_MAX(RADIUS, 4.0*source->moments->Mrf), maxWindow); 221 222 // XXX TEST : use a window based on the radial profile numbers: max is skyRadius, min is RADIUS 223 float maxWindow = source->skyRadius; 224 float windowRadius = PS_MAX(RADIUS, maxWindow); 220 225 221 226 // re-allocate image, weight, mask arrays for each peak with box big enough to fit BIG_RADIUS -
trunk/psphot/src/psphotRadialApertures.c
r32348 r32633 26 26 int num = psphotFileruleCount(config, filerule); 27 27 28 // skip the chisq image (optionally?) 29 int chisqNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.CHISQ.NUM"); 30 if (!status) chisqNum = -1; 31 28 32 // loop over the available readouts 29 33 for (int i = 0; i < num; i++) { 34 if (i == chisqNum) continue; // skip chisq image 35 30 36 if (!psphotRadialAperturesReadout (config, view, filerule, i, recipe, entry)) { 31 37 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for %s entry %d", filerule, i); … … 35 41 return true; 36 42 } 43 44 // these values are used by all threads repeatedly (and are not modified) 45 static psVector *aperRadii = NULL; 46 static psVector *aperRadii2 = NULL; 47 static float outerRadius = NAN; 48 static float SN_LIM = NAN; 49 static psImageMaskType maskVal = 0; 37 50 38 51 // aperture-like measurements for extended sources … … 75 88 nThreads = 0; 76 89 } 90 91 // aperRadii stores the upper bounds of the annuli 92 // XXX keep the same name here as for the petrosian / elliptical apertures? 93 aperRadii = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 94 psAssert (aperRadii, "annular bins (RADIAL.ANNULAR.BINS.UPPER) are not defined in the recipe"); 95 psAssert (aperRadii->n, "no valid annular bins (RADIAL.ANNULAR.BINS.UPPER) are define"); 96 97 outerRadius = aperRadii->data.F32[aperRadii->n - 1]; 98 99 // save the R^2 values as well for quicker comparison 100 aperRadii2 = psVectorAlloc(aperRadii->n, PS_TYPE_F32); 101 for (int i = 0; i < aperRadii->n; i++) { 102 aperRadii2->data.F32[i] = PS_SQR(aperRadii->data.F32[i]); 103 } 104 105 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 106 maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 107 assert (maskVal); 108 109 // S/N limit to perform full non-linear fits 110 SN_LIM = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 77 111 78 112 // source analysis is done in S/N order (brightest first) … … 117 151 psArrayAdd(job->args, 1, cells->data[j]); // sources 118 152 psArrayAdd(job->args, 1, AnalysisRegion); 119 psArrayAdd(job->args, 1, recipe);120 121 153 PS_ARRAY_ADD_SCALAR(job->args, entry, PS_TYPE_S32); 122 154 PS_ARRAY_ADD_SCALAR(job->args, nEntry, PS_TYPE_S32); 123 124 155 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nradial 125 156 126 // set this to 0 to run without threading157 // set this to 0 to run without threading 127 158 # if (1) 128 159 if (!psThreadJobAddPending(job)) { … … 138 169 } 139 170 psScalar *scalar = NULL; 140 scalar = job->args->data[ 6];171 scalar = job->args->data[5]; 141 172 Nradial += scalar->data.S32; 142 173 psFree(job); … … 158 189 } else { 159 190 psScalar *scalar = NULL; 160 scalar = job->args->data[ 6];191 scalar = job->args->data[5]; 161 192 Nradial += scalar->data.S32; 162 193 } … … 166 197 psFree (cellGroups); 167 198 psFree(AnalysisRegion); 199 psFree (aperRadii2); 168 200 169 201 psLogMsg ("psphot", PS_LOG_WARN, "radial source apertures: %f sec for %d objects\n", psTimerMark ("psphot.radial"), Nradial); … … 173 205 bool psphotRadialApertures_Threaded (psThreadJob *job) { 174 206 175 bool status;176 207 int Nradial = 0; 177 208 … … 180 211 psArray *sources = job->args->data[1]; 181 212 psRegion *region = job->args->data[2]; 182 psMetadata *recipe = job->args->data[3]; 183 184 int entry = PS_SCALAR_VALUE(job->args->data[4],S32); // which psf-matched image are we working on? (0 == unmatched) 185 int nEntry = PS_SCALAR_VALUE(job->args->data[5],S32); // total number of psf-matched images + 1 unmatched 186 187 // radMax stores the upper bounds of the annuli 188 // XXX keep the same name here as for the petrosian / elliptical apertures? 189 psVector *radMax = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 190 psAssert (radMax, "annular bins (RADIAL.ANNULAR.BINS.UPPER) are not defined in the recipe"); 191 psAssert (radMax->n, "no valid annular bins (RADIAL.ANNULAR.BINS.UPPER) are define"); 192 193 // user-defined masks to test for good/bad pixels (build from recipe list if not yet set) 194 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT"); // Mask value for bad pixels 195 assert (maskVal); 196 197 // S/N limit to perform full non-linear fits 198 float SN_LIM = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 199 200 float outerRadius = radMax->data.F32[radMax->n - 1]; 213 int entry = PS_SCALAR_VALUE(job->args->data[3],S32); // which psf-matched image are we working on? (0 == unmatched) 214 int nEntry = PS_SCALAR_VALUE(job->args->data[4],S32); // total number of psf-matched images + 1 unmatched 215 216 // storage for the derived pixel values (these are passed into psphotRadialApertureSource) 217 psVector *pixRadius2 = psVectorAllocEmpty(100, PS_TYPE_F32); 218 psVector *pixFlux = psVectorAllocEmpty(100, PS_TYPE_F32); 219 psVector *pixVar = psVectorAllocEmpty(100, PS_TYPE_F32); 201 220 202 221 // choose the sources of interest … … 204 223 205 224 pmSource *source = sources->data[i]; 225 226 // if we have checked the source validity on the basis of the object set, then 227 // we either skip these tests below or we skip the source completely 228 if (source->tmpFlags & PM_SOURCE_TMPF_RADIAL_SKIP) continue; 229 if (source->tmpFlags & PM_SOURCE_TMPF_RADIAL_KEEP) goto keepSource; 206 230 207 231 // skip PSF-like and non-astronomical objects … … 222 246 if (source->peak->x > region->x1) continue; 223 247 if (source->peak->y > region->y1) continue; 248 249 keepSource: 224 250 225 251 // allocate pmSourceExtendedParameters, if not already defined … … 240 266 } 241 267 242 // we need to change the view for the radial aperture analysis, but we want to recover exactly243 // the original view; the following elements get destroyed by pmSourceRedefinePixels so save them:244 psImage *oldMaskObj = psMemIncrRefCounter(source->maskObj);245 psImage *oldModelFlux = psMemIncrRefCounter(source->modelFlux);246 psImage *oldPSFimage = psMemIncrRefCounter(source->psfImage);247 psRegion oldRegion = source->region;248 249 268 Nradial ++; 250 269 251 // force source image to be a bit larger... 252 pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, outerRadius + 2); 253 254 if (!psphotRadialApertureSource (source, recipe, maskVal, radMax, entry)) { 270 if (!psphotRadialApertureSource (source, readout, entry, pixRadius2, pixFlux, pixVar)) { 255 271 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 256 272 } else { … … 258 274 } 259 275 260 pmSourceRedefinePixelsByRegion (source, readout, oldRegion);261 psFree(source->maskObj); source->maskObj = oldMaskObj;262 psFree(source->modelFlux); source->modelFlux = oldModelFlux;263 psFree(source->psfImage); source->psfImage = oldPSFimage;264 265 276 // re-subtract the object, leave local sky 266 277 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 267 278 } 268 psScalar *scalar = job->args->data[ 6];279 psScalar *scalar = job->args->data[5]; 269 280 scalar->data.S32 = Nradial; 281 282 psFree (pixRadius2); 283 psFree (pixFlux); 284 psFree (pixVar); 270 285 271 286 return true; 272 287 } 273 288 274 bool psphotRadialApertureSource (pmSource *source, p sMetadata *recipe, psImageMaskType maskVal, const psVector *aperRadii, int entry) {275 289 bool psphotRadialApertureSource (pmSource *source, pmReadout *readout, int entry, psVector *pixRadius2, psVector *pixFlux, psVector *pixVar) { 290 276 291 // if we are a child source, save the results to the parent source radial aperture array 277 292 psArray *radialAperSet = source->radialAper; … … 285 300 radialAperSet->data[entry] = radialAper; 286 301 287 // storage for the derived pixel values 288 psVector *pixRadius2 = psVectorAllocEmpty(100, PS_TYPE_F32); 289 psVector *pixFlux = psVectorAllocEmpty(100, PS_TYPE_F32); 290 psVector *pixVar = psVectorAllocEmpty(100, PS_TYPE_F32); 302 // find the largest aperture of interest (use only apertures with inner radii <= 303 // source->skyRadius) 304 int lastAp = aperRadii->n; 305 for (int i = 0; i < aperRadii->n; i++) { 306 if (aperRadii->data.F32[i] < source->skyRadius) continue; 307 lastAp = i + 1; 308 break; 309 } 291 310 292 311 // outer-most radius for initial truncation 293 float Rmax = aperRadii->data.F32[ aperRadii->n- 1];312 float Rmax = aperRadii->data.F32[lastAp - 1]; 294 313 float Rmax2 = PS_SQR(Rmax); 295 314 296 // store the R^2 values for the apertures 297 psVector *aperRadii2 = psVectorAlloc(aperRadii->n, PS_TYPE_F32); 298 for (int i = 0; i < aperRadii->n; i++) { 299 aperRadii2->data.F32[i] = PS_SQR(aperRadii->data.F32[i]); 300 } 315 // in this function, the operatins are relative to the full image (readout->image, etc) 301 316 302 317 float xCM = NAN, yCM = NAN; 303 318 if (pmSourcePositionUseMoments(source)) { 304 xCM = source->moments->Mx - 0.5 - source->pixels->col0; // coord of peak in subimage305 yCM = source->moments->My - 0.5 - source->pixels->row0; // coord of peak in subimage319 xCM = source->moments->Mx; // index coord of peak in readout 320 yCM = source->moments->My; // index coord of peak in readout 306 321 } else { 307 xCM = source->peak->xf - 0.5 - source->pixels->col0; // coord of peak in subimage 308 yCM = source->peak->yf - 0.5 - source->pixels->row0; // coord of peak in subimage 309 } 322 xCM = source->peak->xf; // index coord of peak in readout 323 yCM = source->peak->yf; // index coord of peak in readout 324 } 325 326 int Nx = readout->image->numCols; 327 int Ny = readout->image->numRows; 328 329 pixRadius2->n = 0; 330 pixFlux->n = 0; 331 pixVar->n = 0; 310 332 311 333 // one pass through the pixels to select the valid pixels and calculate R^2 312 for (int iy = 0; iy < source->pixels->numRows; iy++) { 313 314 float yDiff = iy - yCM; 315 if (fabs(yDiff) > Rmax) continue; 316 317 float *vPix = source->pixels->data.F32[iy]; 318 float *vWgt = source->variance->data.F32[iy]; 319 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[iy]; 320 321 for (int ix = 0; ix < source->pixels->numCols; ix++, vPix++, vWgt++) { 322 323 if (vMsk) { 324 if (*vMsk & maskVal) { 325 vMsk++; 326 continue; 327 } 328 vMsk++; 329 } 330 if (isnan(*vPix)) continue; 331 332 float xDiff = ix - xCM; 333 if (fabs(xDiff) > Rmax) continue; 334 for (int iy = -Rmax; iy < Rmax + 1; iy++) { 335 336 float yDiff = iy + 0.5 + yCM; // y-coordinate at this offse 337 int yPix = (int) yDiff; 338 339 if (yPix < 0) continue; 340 if (yPix > Ny - 1) continue; 341 if (fabs(iy) > Rmax) continue; 342 343 float *vPix = readout->image->data.F32[yPix]; 344 float *vWgt = readout->variance->data.F32[yPix]; 345 psImageMaskType *vMsk = readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[yPix]; 346 347 for (int ix = -Rmax; ix < Rmax + 1; ix++) { 348 349 float xDiff = ix + 0.5 + xCM; // x-coordinate at this offse 350 int xPix = (int) xDiff; 351 352 if (xPix < 0) continue; 353 if (xPix > Nx - 1) continue; 354 if (fabs(ix) > Rmax) continue; 355 356 if (vMsk[xPix] & maskVal) continue; 357 if (isnan(vPix[xPix])) continue; 334 358 335 359 // radius is just a function of (xDiff, yDiff) 336 float r2 = PS_SQR( xDiff) + PS_SQR(yDiff);360 float r2 = PS_SQR(ix) + PS_SQR(iy); 337 361 if (r2 > Rmax2) continue; 338 362 339 363 psVectorAppend(pixRadius2, r2); 340 psVectorAppend(pixFlux, *vPix);341 psVectorAppend(pixVar, *vWgt);364 psVectorAppend(pixFlux, vPix[xPix]); 365 psVectorAppend(pixVar, vWgt[xPix]); 342 366 } 343 367 } … … 348 372 psVector *fill = psVectorAlloc(aperRadii->n, PS_TYPE_F32); // surface brightness of radial bin 349 373 374 // init the apertures of interest to 0.0, the rest go to NAN 350 375 psVectorInit (flux, 0.0); 351 376 psVectorInit (fluxStd, 0.0); 352 377 psVectorInit (fluxErr, 0.0); 353 378 psVectorInit (fill, 0.0); 379 for (int i = lastAp; i < flux->n; i++) { 380 flux->data.F32[i] = NAN; 381 fluxStd->data.F32[i] = NAN; 382 fluxErr->data.F32[i] = NAN; 383 fill->data.F32[i] = NAN; 384 } 354 385 355 386 float *rPix2 = pixRadius2->data.F32; … … 358 389 int j = 0; 359 390 float *aRad2 = aperRadii2->data.F32; 360 for (; (*aRad2 < *rPix2) && (j < aperRadii2->n); j++, aRad2++); 361 for (; j < aperRadii2->n; j++, aRad2++) { 391 for (; (*aRad2 < *rPix2) && (j < lastAp); j++, aRad2++); 392 393 // XXX I can speed this up by only saving this single aperture 394 for (; j < lastAp; j++, aRad2++) { 362 395 flux->data.F32[j] += pixFlux->data.F32[i]; 363 396 fluxStd->data.F32[j] += PS_SQR(pixFlux->data.F32[i]); … … 371 404 2) the fractional fill factor (count of valid pixels / effective area of the aperture 372 405 3) the error on the flux within that aperture 373 */374 375 for (int i = 0; i < flux->n; i++) {406 */ 407 408 for (int i = 0; i < lastAp; i++) { 376 409 // calculate the total flux for bin 'nOut' 377 410 float Area = M_PI*aperRadii2->data.F32[i]; … … 383 416 // XXX report the total flux or the mask-corrected flux? 384 417 // flux->data.F32[i] = SBmean * Area; 385 // fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]) * Area / nPix;418 // fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]) * Area / Pinx; 386 419 387 420 fluxErr->data.F32[i] = sqrt(fluxErr->data.F32[i]); … … 393 426 } 394 427 428 # if (1) 395 429 radialAper->flux = flux; 396 430 radialAper->fluxStdev = fluxStd; 397 431 radialAper->fluxErr = fluxErr; 398 432 radialAper->fill = fill; 399 400 psFree (aperRadii2); 401 psFree (pixRadius2); 402 psFree (pixFlux); 403 psFree (pixVar); 433 # else 434 // XXX TEST 435 psFree(flux); 436 psFree(fluxStd); 437 psFree(fluxErr); 438 psFree(fill); 439 # endif 404 440 405 441 return true; 406 442 } 443 444 /*** below is a test to use a sort to speed this up, not very successfully ***/ 407 445 408 446 static int nCalls = 0; … … 495 533 // *** pmSourceRadialProfileSortPair is a utility function for sorting a pair of vectors 496 534 # define COMPARE_VECT(A,B) (radius->data.F32[A] < radius->data.F32[B]) 497 # define SWAP_VECT(TYPE,A,B) { \498 float tmp;\499 if (A != B) {\500 tmp = radius->data.F32[A];\501 radius->data.F32[A] = radius->data.F32[B];\502 radius->data.F32[B] = tmp;\503 tmp = pixFlux->data.F32[A];\504 pixFlux->data.F32[A] = pixFlux->data.F32[B];\505 pixFlux->data.F32[B] = tmp;\506 tmp = pixVar->data.F32[A];\507 pixVar->data.F32[A] = pixVar->data.F32[B];\508 pixVar->data.F32[B] = tmp;\509 }\510 }535 # define SWAP_VECT(TYPE,A,B) { \ 536 float tmp; \ 537 if (A != B) { \ 538 tmp = radius->data.F32[A]; \ 539 radius->data.F32[A] = radius->data.F32[B]; \ 540 radius->data.F32[B] = tmp; \ 541 tmp = pixFlux->data.F32[A]; \ 542 pixFlux->data.F32[A] = pixFlux->data.F32[B]; \ 543 pixFlux->data.F32[B] = tmp; \ 544 tmp = pixVar->data.F32[A]; \ 545 pixVar->data.F32[A] = pixVar->data.F32[B]; \ 546 pixVar->data.F32[B] = tmp; \ 547 } \ 548 } 511 549 512 550 bool psphotRadialAperturesSortFlux (psVector *radius, psVector *pixFlux, psVector *pixVar) { -
trunk/psphot/src/psphotReadout.c
r32348 r32633 190 190 psphotDumpChisqs (config, view, filerule); 191 191 192 // measure the radial profiles to the sky 193 psphotRadialProfileWings (config, view, filerule); 194 192 195 // re-measure the kron mags with models subtracted. this pass uses a circular window of size PSF_MOMENTS_RADIUS (same window used to measure the psf-scale moments) 193 196 … … 305 308 pass1finish: 306 309 310 // measure the radial profiles to the sky (only measures new objects) 311 psphotRadialProfileWings (config, view, filerule); 312 307 313 // re-measure the kron mags with models subtracted 308 314 // psphotKronMasked(config, view, filerule); -
trunk/psphot/src/psphotSetThreads.c
r32348 r32633 50 50 psFree(task); 51 51 52 task = psThreadTaskAlloc("PSPHOT_RADIAL_APERTURES", 7);52 task = psThreadTaskAlloc("PSPHOT_RADIAL_APERTURES", 6); 53 53 task->function = &psphotRadialApertures_Threaded; 54 psThreadTaskAdd(task); 55 psFree(task); 56 57 task = psThreadTaskAlloc("PSPHOT_RADIAL_PROFILE_WINGS", 3); 58 task->function = &psphotRadialProfileWings_Threaded; 54 59 psThreadTaskAdd(task); 55 60 psFree(task); -
trunk/psphot/src/psphotSourceFits.c
r32348 r32633 357 357 pmSource *newSrc = pmSourceCopy (source); 358 358 newSrc->modelPSF = psMemIncrRefCounter (DBL->data[1]); 359 newSrc->peak->footprint = source->peak->footprint; // just a reference; the peak does not own the footprint 360 psArrayAdd(newSrc->peak->footprint->peaks, 1, newSrc->peak); // the footprint owns the peak 359 361 360 362 // build cached models and subtract -
trunk/psphot/src/psphotSourceMatch.c
r32348 r32633 67 67 objects = psArraySort (objects, pmPhotObjSortByX); 68 68 69 psVector *found = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (found, 0); 69 psVector *foundSrc = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (foundSrc, 0); 71 72 psVector *foundObj = psVectorAlloc(sources->n, PS_TYPE_U8); 73 psVectorInit (foundObj, 0); 71 74 72 75 // match sources to existing objects … … 93 96 if (dx > +1.02*RADIUS) NEXT2; 94 97 98 /* this block will match a given detection to the closest object within range of that detection. 99 XXX note that this matches ALL detections within range of the single object to that same object 100 this is bad, but I cannot just go in linear order (ie, mark off each object as they are 101 used). I should make a list of all Nobj * Ndet pairs in range and choose the matches 102 based on their separations. UGH 103 */ 104 95 105 // we are within match range, look for matches: 96 106 int Jmin = -1; … … 98 108 for (int J = j; (dx > -1.02*RADIUS) && (J < objects->n); J++) { 99 109 110 // skip objects that are already assigned: 111 if (foundObj->data.U8[J]) continue; 100 112 obj = objects->data[J]; 101 113 … … 117 129 } 118 130 obj = objects->data[Jmin]; 131 foundObj->data.U8[Jmin] = 1; 119 132 120 133 // add to object 121 134 pmPhotObjAddSource (obj, src); 122 found ->data.U8[i] = 1;135 foundSrc->data.U8[i] = 1; 123 136 i++; 124 137 } … … 128 141 for (i = 0; i < sources->n; i++) { 129 142 130 if (found ->data.U8[i]) continue;143 if (foundSrc->data.U8[i]) continue; 131 144 132 145 pmSource *src = sources->data[i]; … … 139 152 psLogMsg ("psphot", PS_LOG_DETAIL, "matched sources (%ld vs %ld)", sources->n, objects->n); 140 153 141 psFree (found); 154 psFree (foundSrc); 155 psFree (foundObj); 142 156 return true; 143 157 } … … 234 248 235 249 // assign to a footprint on this readout->image 236 peak->footprint = pmFootprintCopyData(footprint, readout->image); 237 238 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 239 // footprint on detections->footprints so we can free it later 240 psArrayAdd(detections->footprints, 100, peak->footprint); 241 psFree (peak->footprint); 250 if (footprint) { 251 peak->footprint = pmFootprintCopyData(footprint, readout->image); 252 253 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 254 // footprint on detections->footprints so we can free it later 255 psArrayAdd(detections->footprints, 100, peak->footprint); 256 psFree (peak->footprint); 257 } 242 258 243 259 // create a new source … … 268 284 pmPhotObj *obj = objects->data[i]; 269 285 nSources += obj->sources->n; 286 psAssert (obj->sources->n == nImages, "failed to match sources?"); 270 287 } 271 288 psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages); -
trunk/psphot/src/psphotSourceSize.c
r32348 r32633 156 156 157 157 // XXX fix this (was source->n - first) 158 psLogMsg ("psphot.size", PS_LOG_ INFO, "measure source sizes for %ld sources: %f sec\n", sources->n, psTimerMark ("psphot.size"));158 psLogMsg ("psphot.size", PS_LOG_WARN, "measure source sizes for %ld sources: %f sec\n", sources->n, psTimerMark ("psphot.size")); 159 159 160 160 psphotVisualPlotSourceSize (recipe, readout->analysis, sources); -
trunk/psphot/src/psphotSourceStats.c
r32348 r32633 124 124 // add the peak 125 125 source->peak = psMemIncrRefCounter(peak); 126 127 // psAssert (source->peak->footprint, "peak without footprint??"); 126 128 127 129 // allocate space for moments -
trunk/psphot/src/psphotStackObjects.c
r32348 r32633 70 70 71 71 // S/N limit to perform full non-linear fits 72 float SN_LIM = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 72 float SN_LIM_PETRO = psMetadataLookupF32 (&status, recipe, "EXTENDED_SOURCE_SN_LIM"); 73 float SN_LIM_RADIAL = psMetadataLookupF32 (&status, recipe, "RADIAL_APERTURES_SN_LIM"); 73 74 74 75 bool doPetroStars = psMetadataLookupBool (&status, recipe, "PETROSIAN_FOR_STARS"); … … 81 82 // we check each source for an object and keep the object if any source is valid 82 83 83 bool keepObject = false; 84 bool keepObjectRadial = false; 85 bool keepObjectPetro = false; 84 86 for (int j = 0; j < object->sources->n; j++) { 85 87 … … 94 96 if (source->mode & PM_SOURCE_MODE_SATSTAR) continue; 95 97 96 // optionally allow non-extended objects to get petrosians as well97 if (!doPetroStars) {98 if (!(source->mode & PM_SOURCE_MODE_EXT_LIMIT)) continue;99 if (source->type == PM_SOURCE_TYPE_STAR) continue;100 }101 102 // limit selection to some SN limit103 // assert (source->peak); // how can a source not have a peak?104 // limit selection to some SN limit105 bool skipSource = false;106 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {107 skipSource = (source->moments->KronFlux < SN_LIM * source->moments->KronFluxErr);108 } else {109 skipSource = (sqrt(source->peak->detValue) < SN_LIM);110 }111 if (skipSource) continue;112 113 98 // limit selection by analysis region (this automatically apply 114 99 if (source->peak->x < AnalysisRegion.x0) continue; … … 117 102 if (source->peak->y > AnalysisRegion.y1) continue; 118 103 119 keepObject = true; 104 // SN limit tests for RADIAL APERTURES: 105 bool skipSourceRadial = false; 106 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 107 skipSourceRadial = (source->moments->KronFlux < SN_LIM_RADIAL * source->moments->KronFluxErr); 108 } else { 109 skipSourceRadial = (sqrt(source->peak->detValue) < SN_LIM_RADIAL); 110 } 111 if (!skipSourceRadial) keepObjectRadial = true; 112 113 // SN limit tests for PETRO 114 bool skipSourcePetro = false; 115 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 116 skipSourcePetro = (source->moments->KronFlux < SN_LIM_PETRO * source->moments->KronFluxErr); 117 } else { 118 skipSourcePetro = doPetroStars ? (sqrt(source->peak->detValue) < SN_LIM_PETRO) : true; 119 } 120 if (!skipSourcePetro) keepObjectPetro = true; 121 122 keepObjectPetro = true; 120 123 } 121 124 … … 128 131 // avoid the single-detection tests 129 132 130 if (keepObject ) {131 source->tmpFlags |= PM_SOURCE_TMPF_ STACK_KEEP;132 source->tmpFlags &= ~PM_SOURCE_TMPF_ STACK_SKIP;133 if (keepObjectPetro) { 134 source->tmpFlags |= PM_SOURCE_TMPF_PETRO_KEEP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_PETRO_SKIP; 133 136 } else { 134 source->tmpFlags |= PM_SOURCE_TMPF_STACK_SKIP; 135 source->tmpFlags &= ~PM_SOURCE_TMPF_STACK_KEEP; 137 source->tmpFlags |= PM_SOURCE_TMPF_PETRO_SKIP; 138 source->tmpFlags &= ~PM_SOURCE_TMPF_PETRO_KEEP; 139 } 140 141 if (keepObjectRadial) { 142 source->tmpFlags |= PM_SOURCE_TMPF_RADIAL_KEEP; 143 source->tmpFlags &= ~PM_SOURCE_TMPF_RADIAL_SKIP; 144 } else { 145 source->tmpFlags |= PM_SOURCE_TMPF_RADIAL_SKIP; 146 source->tmpFlags &= ~PM_SOURCE_TMPF_RADIAL_KEEP; 136 147 } 137 148 } -
trunk/psphot/src/psphotStackReadout.c
r32348 r32633 43 43 44 44 bool psphotStackReadout (pmConfig *config, const pmFPAview *view) { 45 46 psArray *objects = NULL; // used below after 'pass1finish' label 45 47 46 48 // measure the total elapsed time in psphotReadout. dtime is the elapsed time used jointly … … 169 171 psphotStackVisualFilerule(config, view, STACK_SRC); 170 172 173 // measure the radial profiles to the sky 174 psphotRadialProfileWings (config, view, STACK_SRC); 175 171 176 // re-measure the kron mags with models subtracted. this pass starts with a circular 172 177 // window of size PSF_MOMENTS_RADIUS (same window used to measure the psf-scale moments) … … 184 189 psphotReplaceAllSources (config, view, STACK_SRC); // pass 1 (detections->allSources) 185 190 191 // if we only do one pass, skip to extended source analysis 192 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish; 193 186 194 // linear fit to include all sources (subtract again) 187 195 // NOTE : apply to ALL sources (extended + psf) 188 196 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 2 (detections->allSources) 189 190 // if we only do one pass, skip to extended source analysis191 if (!strcasecmp (breakPt, "PASS1")) goto pass1finish;192 197 193 198 // NOTE: possibly re-measure background model here with objects subtracted / or masked … … 238 243 // XXX check on free of sources... 239 244 psphotMergeSources (config, view, STACK_SRC); // (detections->newSources + detections->allSources -> detections->allSources) 240 241 // NOTE: apply to ALL sources242 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 3 (detections->allSources)243 245 } 244 246 245 247 pass1finish: 248 249 // generate the objects (objects unify the sources from the different images) NOTE: could 250 // this just match the detections for the chisq image, and not bother measuring the source 251 // stats in that case...? 252 objects = psphotMatchSources (config, view, STACK_SRC); 253 psMemDump("matchsources"); 254 255 psphotStackObjectsUnifyPosition (objects); 256 257 psphotStackObjectsSelectForAnalysis (config, view, STACK_SRC, objects); 258 259 // NOTE: apply to ALL sources 260 psphotFitSourcesLinear (config, view, STACK_SRC, true); // pass 3 (detections->allSources) 261 262 // measure the radial profiles to the sky (only measures new objects) 263 psphotRadialProfileWings (config, view, STACK_SRC); 246 264 247 265 // re-measure the kron mags with models subtracted … … 254 272 255 273 psMemDump("psfstats"); 256 257 // generate the objects (objects unify the sources from the different images)258 // XXX this could just match the detections for the chisq image, and not bother measuring the259 // source stats in that case...260 psArray *objects = psphotMatchSources (config, view, STACK_SRC);261 psMemDump("matchsources");262 263 psphotStackObjectsUnifyPosition (objects);264 265 psphotStackObjectsSelectForAnalysis (config, view, STACK_SRC, objects);266 274 267 275 // measure elliptical apertures, petrosians (objects sorted by S/N) … … 281 289 282 290 // measure circular, radial apertures (objects sorted by S/N) 283 // XXX can we just use psphotRadialApertures 284 // XXX make sure the headers are consistent with this (which PSF convolutions, ie mark 'none') 285 // psphotRadialAperturesByObject (config, objectsRadial, view, STACK_SRC, nMatchedPSF); 291 // this forces photometry on the undetected sources from other images 286 292 psphotRadialApertures (config, view, STACK_SRC, 0); // XXX entry 0 == unmatched? 287 293 psMemDump("extmeas"); … … 323 329 psphotMagnitudes(config, view, STACK_SRC); 324 330 325 if (0 && !psphotEfficiency(config, view, STACK_DET)) { 331 // XXX NOTE: this function wants to have the PSF of the image, but we (so far) only measure the 332 // PSF of the SRC image. can we fake it by generating the PSF for DET as well (up above)? 333 if (false && !psphotEfficiency(config, view, STACK_DET)) { 326 334 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 327 335 psErrorClear();
Note:
See TracChangeset
for help on using the changeset viewer.
