- Timestamp:
- Jan 12, 2015, 12:36:24 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects
- Files:
-
- 12 edited
-
. (modified) (1 prop)
-
Makefile.am (modified) (3 diffs)
-
mksource.pl (modified) (1 diff)
-
pmPSFtryMakePSF.c (modified) (2 diffs)
-
pmSource.c (modified) (1 diff)
-
pmSource.h (modified) (1 diff)
-
pmSourceExtendedPars.c (modified) (1 diff)
-
pmSourceExtendedPars.h (modified) (1 diff)
-
pmSourceIO.c (modified) (6 diffs)
-
pmSourceIO.h (modified) (1 diff)
-
pmSourceIO_CMF.c.in (modified) (11 diffs, 1 prop)
-
pmTrend2D.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects
- Property svn:ignore
-
old new 16 16 pmSourceIO_CMF_PS1_SV2.c 17 17 pmSourceIO_CMF_PS1_SV3.c 18 pmSourceIO_CMF_PS1_SV4.c 18 19 pmSourceIO_CMF_PS1_DV1.c 19 20 pmSourceIO_CMF_PS1_DV2.c 20 21 pmSourceIO_CMF_PS1_DV3.c 21 22 pmSourceIO_CMF_PS1_DV4.c 23
-
- Property svn:ignore
-
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/Makefile.am
r36890 r37828 53 53 pmSourceIO_CMF_PS1_SV2.c \ 54 54 pmSourceIO_CMF_PS1_SV3.c \ 55 pmSourceIO_CMF_PS1_SV4.c \ 55 56 pmSourceIO_CMF_PS1_DV1.c \ 56 57 pmSourceIO_CMF_PS1_DV2.c \ … … 157 158 pmSourceIO_CMF_PS1_SV1.c \ 158 159 pmSourceIO_CMF_PS1_SV2.c \ 159 pmSourceIO_CMF_PS1_SV3.c 160 pmSourceIO_CMF_PS1_SV3.c \ 161 pmSourceIO_CMF_PS1_SV4.c 160 162 161 163 pmSourceIO_CMF_PS1_V1.c : pmSourceIO_CMF.c.in mksource.pl … … 195 197 mksource.pl pmSourceIO_CMF.c.in PS1_SV3 pmSourceIO_CMF_PS1_SV3.c 196 198 199 pmSourceIO_CMF_PS1_SV4.c : pmSourceIO_CMF.c.in mksource.pl 200 mksource.pl pmSourceIO_CMF.c.in PS1_SV4 pmSourceIO_CMF_PS1_SV4.c 201 197 202 # EXTRA_DIST = pmErrorCodes.h.in pmErrorCodes.dat pmErrorCodes.c.in -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/mksource.pl
r36864 r37828 29 29 "PS1_SV2", 2, 30 30 "PS1_SV3", 3, 31 "PS1_SV4", 4, 31 32 ); 32 33 -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmPSFtryMakePSF.c
r36858 r37828 45 45 #include "pmSourceVisual.h" 46 46 47 bool pmPSF_DataDump (char *filename, psVector *x, psVector *y, psVector *e0, psVector *e1, psVector *e2, psVector *mask); 48 47 49 /***************************************************************************** 48 50 pmPSFFromPSFtry (psfTry): build a PSF model from a collection of source->modelEXT entries … … 356 358 } 357 359 360 bool pmPSF_DataDump (char *filename, psVector *x, psVector *y, psVector *e0, psVector *e1, psVector *e2, psVector *mask) { 361 362 363 FILE *f = fopen (filename, "w"); 364 if (!f) return false; 365 366 for (int i = 0; i < x->n; i++) { 367 368 fprintf (f, "%6.1f %6.1f : %5.2f %5.2f %5.2f : %2d\n", 369 x->data.F32[i], 370 y->data.F32[i], 371 e0->data.F32[i], 372 e1->data.F32[i], 373 e2->data.F32[i], 374 mask->data.U8[i]); 375 } 376 fclose (f); 377 return true; 378 } -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSource.c
r36860 r37828 176 176 source->parent = NULL; 177 177 source->tmpPtr = NULL; 178 source->chipNum = -1; 179 source->chipX = -1000; 180 source->chipY = -1000; 178 181 source->imageID = -1; 179 182 source->nFrames = 0; -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSource.h
r36860 r37828 127 127 pmSource *parent; ///< reference to the master source from which this is derived 128 128 psPtr *tmpPtr; ///< pointer that may be used to store data in a particular module. e.g. psphotKronIterate. 129 short chipNum; ///< camera dependent of chip suppling pixels for fullforce source 130 short chipX; ///< chip space X coord of fullforce source 131 short chipY; ///< chip space Y coord of fullforce source 129 132 int imageID; 130 133 psU16 nFrames; -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceExtendedPars.c
r36375 r37828 226 226 pars->petrosianR50 = NAN; 227 227 pars->petrosianR50Err = NAN; 228 pars->ghalfLightRadius = NAN; 229 pars->gRT = NAN; 230 pars->gRA = NAN; 231 pars->gS2 = NAN; 232 pars->gA = NAN; 233 pars->gbumpy = NAN; 228 234 return pars; 229 235 } -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceExtendedPars.h
r36747 r37828 65 65 float petrosianR50Err; 66 66 float petrosianFill; 67 float ghalfLightRadius; 68 float gRT; // total residual (from eliptically symmetric model) Simard 2002 69 float gRA; // assymetric residual (from eliptically symmetric model) Simard 2002 70 float gS2; // (un) smoothness (Simard, 2011 Cheng 2011) 71 float gA; // assymetry index (Gyory & Bell 2010) 72 float gbumpy; // Blakeslee bumpiness 67 73 } pmSourceExtendedPars; 68 74 -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO.c
r37051 r37828 602 602 PM_SOURCES_WRITE("PS1_SV2", CMF_PS1_SV2); 603 603 PM_SOURCES_WRITE("PS1_SV3", CMF_PS1_SV3); 604 PM_SOURCES_WRITE("PS1_SV4", CMF_PS1_SV4); 604 605 PM_SOURCES_WRITE("PS1_DV1", CMF_PS1_DV1); 605 606 PM_SOURCES_WRITE("PS1_DV2", CMF_PS1_DV2); … … 1124 1125 PM_SOURCES_READ_PSF("PS1_SV2", CMF_PS1_SV2); 1125 1126 PM_SOURCES_READ_PSF("PS1_SV3", CMF_PS1_SV3); 1127 PM_SOURCES_READ_PSF("PS1_SV4", CMF_PS1_SV4); 1126 1128 PM_SOURCES_READ_PSF("PS1_DV1", CMF_PS1_DV1); 1127 1129 PM_SOURCES_READ_PSF("PS1_DV2", CMF_PS1_DV2); … … 1412 1414 PM_SOURCES_READ_XSRC("PS1_SV2", CMF_PS1_SV2); 1413 1415 PM_SOURCES_READ_XSRC("PS1_SV3", CMF_PS1_SV3); 1416 PM_SOURCES_READ_XSRC("PS1_SV4", CMF_PS1_SV4); 1414 1417 PM_SOURCES_READ_XSRC("PS1_DV1", CMF_PS1_DV1); 1415 1418 PM_SOURCES_READ_XSRC("PS1_DV2", CMF_PS1_DV2); … … 1454 1457 PM_SOURCES_READ_XFIT("PS1_SV2", CMF_PS1_SV2); 1455 1458 PM_SOURCES_READ_XFIT("PS1_SV3", CMF_PS1_SV3); 1459 PM_SOURCES_READ_XFIT("PS1_SV4", CMF_PS1_SV4); 1456 1460 PM_SOURCES_READ_XFIT("PS1_DV1", CMF_PS1_DV1); 1457 1461 PM_SOURCES_READ_XFIT("PS1_DV2", CMF_PS1_DV2); … … 1495 1499 PM_SOURCES_READ_XRAD("PS1_SV2", CMF_PS1_SV2); 1496 1500 PM_SOURCES_READ_XRAD("PS1_SV3", CMF_PS1_SV3); 1501 PM_SOURCES_READ_XRAD("PS1_SV4", CMF_PS1_SV4); 1497 1502 PM_SOURCES_READ_XRAD("PS1_DV1", CMF_PS1_DV1); 1498 1503 PM_SOURCES_READ_XRAD("PS1_DV2", CMF_PS1_DV2); … … 1536 1541 PM_SOURCES_READ_XGAL("PS1_SV2", CMF_PS1_SV2); 1537 1542 PM_SOURCES_READ_XGAL("PS1_SV3", CMF_PS1_SV3); 1543 PM_SOURCES_READ_XGAL("PS1_SV4", CMF_PS1_SV4); 1538 1544 PM_SOURCES_READ_XGAL("PS1_DV1", CMF_PS1_DV1); 1539 1545 PM_SOURCES_READ_XGAL("PS1_DV2", CMF_PS1_DV2); -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO.h
r36890 r37828 41 41 MK_PROTO(CMF_PS1_SV2); 42 42 MK_PROTO(CMF_PS1_SV3); 43 MK_PROTO(CMF_PS1_SV4); 43 44 MK_PROTO(CMF_PS1_DV1); 44 45 MK_PROTO(CMF_PS1_DV2); -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO_CMF.c.in
- Property svn:mergeinfo set to
r36892 r37828 222 222 } 223 223 224 // if lensing params exist also include the backmapped chipID and chip coordinates 225 if (source->lensingPSF && source->lensingPSF->shear) { 226 @>PS1_V4@ psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_NUM", PS_DATA_S16, "id of warp input chip", source->chipNum); 227 @>PS1_V4@ psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_X", PS_DATA_S16, "x coord in warp input chip", source->chipX); 228 @>PS1_V4@ psMetadataAdd (row, PS_LIST_TAIL, "SRC_CHIP_Y", PS_DATA_S16, "y coord in warp input chip", source->chipY); 229 @>PS1_V4@ psMetadataAdd (row, PS_LIST_TAIL, "PADDING3", PS_DATA_S16, "more padding", 0); 230 } 231 224 232 @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1", PS_DATA_F32, "first radial moment", moments.Mrf); 225 233 @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH", PS_DATA_F32, "half radial moment", moments.Mrh); … … 311 319 312 320 // define PSF model type 313 int modelType = pmModelClassGetType ("PS_MODEL_GAUSS"); 321 int defaultModelType = pmModelClassGetType ("PS_MODEL_GAUSS"); 322 int modelType = -1; 314 323 315 324 // if header does not define the model, default to a gaussian … … 318 327 modelType = pmModelClassGetType (PSF_NAME); 319 328 } 320 assert (modelType > -1); 329 // work around bug in psphotFullForce 330 if (modelType < 0) { 331 modelType = defaultModelType; 332 } 333 // assert (modelType > -1); 321 334 322 335 // do we expect to find lensing parameters? … … 448 461 @>PS1_V4@ source->lensingOBJ->shear->e2 = psMetadataLookupF32 (&status, row, "LENS_E2_SH_OBJ"); 449 462 } 463 464 @>PS1_V4@ source->chipNum = psMetadataLookupS16 (&status, row, "SRC_CHIP_NUM"); 465 @>PS1_V4@ source->chipX = psMetadataLookupS16 (&status, row, "SRC_CHIP_X"); 466 @>PS1_V4@ source->chipY = psMetadataLookupS16 (&status, row, "SRC_CHIP_Y"); 450 467 451 468 if (haveLensPSF) { … … 620 637 // XXX note that this mag is either calibrated or instrumental depending on existence of zero point 621 638 float mag = (extpars->petrosianFlux > 0.0) ? -2.5*log10(extpars->petrosianFlux) + magOffset : NAN; // XXX zero point 639 // XXX NOTE EAM 20140806 : PETRO_MAG_ERR is inverted!! oops!! 622 640 float magErr = (extpars->petrosianFlux > 0.0) ? extpars->petrosianFlux / extpars->petrosianFluxErr : NAN; // XXX zero point 623 641 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG", PS_DATA_F32, "Petrosian Magnitude", mag); … … 630 648 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_90_ERR", PS_DATA_F32, "Petrosian R90 Error (pix)", extpars->petrosianR90Err); 631 649 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_FILL", PS_DATA_F32, "Petrosian Fill Factor", extpars->petrosianFill); 650 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "HALF_LIGHT_RADIUS", 0, "Half Light Radius", extpars->ghalfLightRadius); 651 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_RT", 0, "total residual Sersic Model", extpars->gRT); 652 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_RA", 0, "assymetric residual Sersic Model", extpars->gRA); 653 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_S2", 0, "(un)smoothness paramter residual Sersic Model", extpars->gS2); 654 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_A", 0, "assymetry index", extpars->gA); 655 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_BUMPY", 0, "bumpiness", extpars->gbumpy); 632 656 } else { 633 657 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG", PS_DATA_F32, "Petrosian Magnitude", NAN); … … 640 664 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_90_ERR", PS_DATA_F32, "Petrosian R90 Error (pix)",NAN); 641 665 psMetadataAdd (row, PS_LIST_TAIL, "PETRO_FILL", PS_DATA_F32, "Petrosian Fill Factor", NAN); 666 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "HALF_LIGHT_RADIUS", 0, "Half Light Radius", NAN); 667 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_RT", 0, "total residual Sersic Model", NAN); 668 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_RA", 0, "assymetric residual Sersic Model", NAN); 669 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_S2", 0, "(un)smoothness paramter residual Sersic Model", NAN); 670 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_A", 0, "assymetry index", NAN); 671 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "G_BUMPY", 0, "bumpiness", NAN); 642 672 } 643 673 } … … 839 869 extpars->petrosianR90Err = psMetadataLookupF32(&status, row, "PETRO_RADIUS_90_ERR"); 840 870 extpars->petrosianFill = psMetadataLookupF32(&status, row, "PETRO_FILL"); 871 extpars->ghalfLightRadius = psMetadataLookupF32(&status, row, "HALF_LIGHT_RADIUS"); 872 extpars->gRT = psMetadataLookupF32(&status, row, "G_RT"); 873 extpars->gRA = psMetadataLookupF32(&status, row, "G_RA"); 874 extpars->gS2 = psMetadataLookupF32(&status, row, "G_S2"); 875 extpars->gA = psMetadataLookupF32(&status, row, "G_A"); 876 extpars->gbumpy = psMetadataLookupF32(&status, row, "G_BUMPY"); 841 877 842 878 psVector *radSB = psMetadataLookupVector(&status, row, "PROF_SB"); … … 906 942 } 907 943 908 @>PS1_DV2 @ pmChip *chip = readout->parent->parent;944 @>PS1_DV2,>PS1_SV3@ pmChip *chip = readout->parent->parent; 909 945 910 946 pmModelStatus badModel = PM_MODEL_STATUS_NONE; … … 965 1001 } 966 1002 967 @>PS1_DV2 @ psSphere ptSky = {0.0, 0.0, 0.0, 0.0};968 @>PS1_DV2 @ float posAngle = 0.0;969 @>PS1_DV2 @ float pltScale = 0.0;970 @>PS1_DV2 @ pmSourceLocalAstrometry (&ptSky, &posAngle, &pltScale, chip, xPos, yPos);971 @>PS1_DV2 @ double raPos = ptSky.r*PS_DEG_RAD;972 @>PS1_DV2 @ double decPos = ptSky.d*PS_DEG_RAD;973 @>PS1_DV2 @ posAngle *= PS_DEG_RAD;974 @>PS1_DV2 @ pltScale *= PS_DEG_RAD*3600.0;1003 @>PS1_DV2,>PS1_SV3@ psSphere ptSky = {0.0, 0.0, 0.0, 0.0}; 1004 @>PS1_DV2,>PS1_SV3@ float posAngle = 0.0; 1005 @>PS1_DV2,>PS1_SV3@ float pltScale = 0.0; 1006 @>PS1_DV2,>PS1_SV3@ pmSourceLocalAstrometry (&ptSky, &posAngle, &pltScale, chip, xPos, yPos); 1007 @>PS1_DV2,>PS1_SV3@ double raPos = ptSky.r*PS_DEG_RAD; 1008 @>PS1_DV2,>PS1_SV3@ double decPos = ptSky.d*PS_DEG_RAD; 1009 @>PS1_DV2,>PS1_SV3@ posAngle *= PS_DEG_RAD; 1010 @>PS1_DV2,>PS1_SV3@ pltScale *= PS_DEG_RAD*3600.0; 975 1011 976 1012 float kronFlux = source->moments ? source->moments->KronFlux : NAN; … … 986 1022 psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG", 0, "Sigma in EXT x coordinate", xErr); 987 1023 psMetadataAddF32 (row, PS_LIST_TAIL, "Y_EXT_SIG", 0, "Sigma in EXT y coordinate", yErr); 988 @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT", 0, "EXT model ra coordinate", raPos); 989 @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT", 0, "EXT model dec coordinate", decPos); 1024 @>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "SKY_EXT", 0, "EXT fit sky value", PAR ? PAR[PM_PAR_SKY] : NAN); 1025 @>PS1_DV2,>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "RA_EXT", 0, "EXT model ra coordinate", raPos); 1026 @>PS1_DV2,>PS1_SV3@ psMetadataAddF32 (row, PS_LIST_TAIL, "DEC_EXT", 0, "EXT model dec coordinate", decPos); 990 1027 @>PS1_DV2@ float instFlux = isfinite(model->mag) ? pow(10.0, -0.4*model->mag) : NAN; 991 1028 @>PS1_DV2@ psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_INST_FLUX", 0, "EXT fit instrumental counts", instFlux); -
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmTrend2D.c
r30044 r37828 211 211 // XXX need to add the API which adjusts the scale 212 212 status = psImageMapClipFit(pGoodFit, trend->map, trend->stats, mask, maskVal, x, y, f, df); 213 if (!status) { 214 psError(PS_ERR_UNKNOWN, true, "failed to build PSF model map"); 215 return false; 216 } 217 218 // the psf model map can have nan pixels: repair this by extrapolation / interpolation 219 // XXX TEST: p_psImagePrint(0, trend->map->map, "before"); 220 status = psImageMapRepair (trend->map->map); 221 // XXX TEST: p_psImagePrint(0, trend->map->map, "after"); 222 if (!status) { 223 psError(PS_ERR_UNKNOWN, true, "failed to repair PSF model map"); 224 return false; 225 } 213 226 break; 214 227 … … 217 230 } 218 231 return status; 232 } 233 234 bool psImageMapRepair (psImage *map) { 235 236 237 // XXX why is my repair not working?? 238 239 // patch over bad regions (use average of 8 possible neighbor pixels) 240 // XXX consider testing all pixels against the 8 neighbors and replacing outliers... 241 double Count = 0; // number of good pixels 242 double Value = 0; // sum of good pixel's value 243 for (int iy = 0; iy < map->numRows; iy++) { 244 for (int ix = 0; ix < map->numCols; ix++) { 245 if (isfinite(map->data.F32[iy][ix])) { 246 Value += map->data.F32[iy][ix]; 247 Count++; 248 continue; 249 } 250 251 double value = 0; 252 double count = 0; 253 for (int jy = iy - 1; jy <= iy + 1; jy++) { 254 if (jy < 0) continue; 255 if (jy >= map->numRows) continue; 256 for (int jx = ix - 1; jx <= ix + 1; jx++) { 257 if (!jx && !jy) continue; 258 if (jx < 0) continue; 259 if (jx >= map->numCols) continue; 260 if (!isfinite(map->data.F32[jy][jx])) continue; 261 value += map->data.F32[jy][jx]; 262 count += 1.0; 263 } 264 } 265 if (count > 0) { 266 // psLogMsg ("psphot", PS_LOG_DETAIL, "patching image map %d, %d: %f (%d pts)\n", ix, iy, (value / count), (int) count); 267 map->data.F32[iy][ix] = value / count; 268 } 269 } 270 } 271 if (Count == 0) { 272 psError(PS_ERR_UNKNOWN, true, "failed to repair PSF model map"); 273 return false; 274 } 275 Value /= Count; 276 277 // patch over remaining bad regions (use global average) 278 for (int iy = 0; iy < map->numRows; iy++) { 279 for (int ix = 0; ix < map->numCols; ix++) { 280 if (!isnan(map->data.F32[iy][ix])) continue; 281 map->data.F32[iy][ix] = Value; 282 } 283 } 284 return true; 219 285 } 220 286
Note:
See TracChangeset
for help on using the changeset viewer.
