IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2015, 12:36:24 PM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects

    • Property svn:ignore
      •  

        old new  
        1616pmSourceIO_CMF_PS1_SV2.c
        1717pmSourceIO_CMF_PS1_SV3.c
         18pmSourceIO_CMF_PS1_SV4.c
        1819pmSourceIO_CMF_PS1_DV1.c
        1920pmSourceIO_CMF_PS1_DV2.c
        2021pmSourceIO_CMF_PS1_DV3.c
        2122pmSourceIO_CMF_PS1_DV4.c
         23
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/Makefile.am

    r36890 r37828  
    5353        pmSourceIO_CMF_PS1_SV2.c \
    5454        pmSourceIO_CMF_PS1_SV3.c \
     55        pmSourceIO_CMF_PS1_SV4.c \
    5556        pmSourceIO_CMF_PS1_DV1.c \
    5657        pmSourceIO_CMF_PS1_DV2.c \
     
    157158pmSourceIO_CMF_PS1_SV1.c \
    158159pmSourceIO_CMF_PS1_SV2.c \
    159 pmSourceIO_CMF_PS1_SV3.c
     160pmSourceIO_CMF_PS1_SV3.c \
     161pmSourceIO_CMF_PS1_SV4.c
    160162
    161163pmSourceIO_CMF_PS1_V1.c : pmSourceIO_CMF.c.in mksource.pl
     
    195197        mksource.pl pmSourceIO_CMF.c.in PS1_SV3 pmSourceIO_CMF_PS1_SV3.c
    196198
     199pmSourceIO_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
    197202# EXTRA_DIST = pmErrorCodes.h.in pmErrorCodes.dat pmErrorCodes.c.in
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/mksource.pl

    r36864 r37828  
    2929                "PS1_SV2", 2,
    3030                "PS1_SV3", 3,
     31                "PS1_SV4", 4,
    3132    );
    3233
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmPSFtryMakePSF.c

    r36858 r37828  
    4545#include "pmSourceVisual.h"
    4646
     47bool pmPSF_DataDump (char *filename, psVector *x, psVector *y, psVector *e0, psVector *e1, psVector *e2, psVector *mask);
     48
    4749/*****************************************************************************
    4850pmPSFFromPSFtry (psfTry): build a PSF model from a collection of source->modelEXT entries
     
    356358}
    357359
     360bool 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  
    176176    source->parent = NULL;
    177177    source->tmpPtr = NULL;
     178    source->chipNum = -1;
     179    source->chipX = -1000;
     180    source->chipY = -1000;
    178181    source->imageID = -1;
    179182    source->nFrames = 0;
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSource.h

    r36860 r37828  
    127127    pmSource *parent;                   ///< reference to the master source from which this is derived
    128128    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
    129132    int imageID;
    130133    psU16 nFrames;
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceExtendedPars.c

    r36375 r37828  
    226226    pars->petrosianR50 = NAN;
    227227    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;
    228234    return pars;
    229235}
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceExtendedPars.h

    r36747 r37828  
    6565    float petrosianR50Err;
    6666    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
    6773} pmSourceExtendedPars;
    6874
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO.c

    r37051 r37828  
    602602            PM_SOURCES_WRITE("PS1_SV2",   CMF_PS1_SV2);
    603603            PM_SOURCES_WRITE("PS1_SV3",   CMF_PS1_SV3);
     604            PM_SOURCES_WRITE("PS1_SV4",   CMF_PS1_SV4);
    604605            PM_SOURCES_WRITE("PS1_DV1",   CMF_PS1_DV1);
    605606            PM_SOURCES_WRITE("PS1_DV2",   CMF_PS1_DV2);
     
    11241125            PM_SOURCES_READ_PSF("PS1_SV2",   CMF_PS1_SV2);
    11251126            PM_SOURCES_READ_PSF("PS1_SV3",   CMF_PS1_SV3);
     1127            PM_SOURCES_READ_PSF("PS1_SV4",   CMF_PS1_SV4);
    11261128            PM_SOURCES_READ_PSF("PS1_DV1",   CMF_PS1_DV1);
    11271129            PM_SOURCES_READ_PSF("PS1_DV2",   CMF_PS1_DV2);
     
    14121414        PM_SOURCES_READ_XSRC("PS1_SV2",   CMF_PS1_SV2);
    14131415        PM_SOURCES_READ_XSRC("PS1_SV3",   CMF_PS1_SV3);
     1416        PM_SOURCES_READ_XSRC("PS1_SV4",   CMF_PS1_SV4);
    14141417        PM_SOURCES_READ_XSRC("PS1_DV1",   CMF_PS1_DV1);
    14151418        PM_SOURCES_READ_XSRC("PS1_DV2",   CMF_PS1_DV2);
     
    14541457        PM_SOURCES_READ_XFIT("PS1_SV2",   CMF_PS1_SV2);
    14551458        PM_SOURCES_READ_XFIT("PS1_SV3",   CMF_PS1_SV3);
     1459        PM_SOURCES_READ_XFIT("PS1_SV4",   CMF_PS1_SV4);
    14561460        PM_SOURCES_READ_XFIT("PS1_DV1",   CMF_PS1_DV1);
    14571461        PM_SOURCES_READ_XFIT("PS1_DV2",   CMF_PS1_DV2);
     
    14951499        PM_SOURCES_READ_XRAD("PS1_SV2",   CMF_PS1_SV2);
    14961500        PM_SOURCES_READ_XRAD("PS1_SV3",   CMF_PS1_SV3);
     1501        PM_SOURCES_READ_XRAD("PS1_SV4",   CMF_PS1_SV4);
    14971502        PM_SOURCES_READ_XRAD("PS1_DV1",   CMF_PS1_DV1);
    14981503        PM_SOURCES_READ_XRAD("PS1_DV2",   CMF_PS1_DV2);
     
    15361541        PM_SOURCES_READ_XGAL("PS1_SV2",   CMF_PS1_SV2);
    15371542        PM_SOURCES_READ_XGAL("PS1_SV3",   CMF_PS1_SV3);
     1543        PM_SOURCES_READ_XGAL("PS1_SV4",   CMF_PS1_SV4);
    15381544        PM_SOURCES_READ_XGAL("PS1_DV1",   CMF_PS1_DV1);
    15391545        PM_SOURCES_READ_XGAL("PS1_DV2",   CMF_PS1_DV2);
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO.h

    r36890 r37828  
    4141MK_PROTO(CMF_PS1_SV2);
    4242MK_PROTO(CMF_PS1_SV3);
     43MK_PROTO(CMF_PS1_SV4);
    4344MK_PROTO(CMF_PS1_DV1);
    4445MK_PROTO(CMF_PS1_DV2);
  • branches/eam_branches/ipp-pv3-20140717-merge/psModules/src/objects/pmSourceIO_CMF.c.in

    r36892 r37828  
    222222        }
    223223
     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
    224232        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1",       PS_DATA_F32, "first radial moment",                        moments.Mrf);
    225233        @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH",       PS_DATA_F32, "half radial moment",                         moments.Mrh);
     
    311319
    312320    // define PSF model type
    313     int modelType = pmModelClassGetType ("PS_MODEL_GAUSS");
     321    int defaultModelType = pmModelClassGetType ("PS_MODEL_GAUSS");
     322    int modelType = -1;
    314323
    315324    // if header does not define the model, default to a gaussian
     
    318327        modelType = pmModelClassGetType (PSF_NAME);
    319328    }
    320     assert (modelType > -1);
     329    // work around bug in psphotFullForce
     330    if (modelType < 0) {
     331        modelType = defaultModelType;
     332    }
     333    // assert (modelType > -1);
    321334
    322335    // do we expect to find lensing parameters?
     
    448461          @>PS1_V4@ source->lensingOBJ->shear->e2  = psMetadataLookupF32 (&status, row, "LENS_E2_SH_OBJ");
    449462        }
     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");
    450467
    451468        if (haveLensPSF) {
     
    620637                // XXX note that this mag is either calibrated or instrumental depending on existence of zero point
    621638                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!!
    622640                float magErr = (extpars->petrosianFlux > 0.0) ? extpars->petrosianFlux / extpars->petrosianFluxErr : NAN; // XXX zero point
    623641                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude", mag);
     
    630648                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_90_ERR", PS_DATA_F32, "Petrosian R90 Error (pix)", extpars->petrosianR90Err);
    631649                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);
    632656            } else {
    633657                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_MAG",        PS_DATA_F32, "Petrosian Magnitude",       NAN);
     
    640664                psMetadataAdd (row, PS_LIST_TAIL, "PETRO_RADIUS_90_ERR", PS_DATA_F32, "Petrosian R90 Error (pix)",NAN);
    641665                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);
    642672            }
    643673        }
     
    839869        extpars->petrosianR90Err   = psMetadataLookupF32(&status, row, "PETRO_RADIUS_90_ERR");
    840870        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");
    841877
    842878        psVector *radSB   = psMetadataLookupVector(&status, row, "PROF_SB");
     
    906942    }
    907943
    908     @>PS1_DV2@ pmChip *chip = readout->parent->parent;
     944    @>PS1_DV2,>PS1_SV3@ pmChip *chip = readout->parent->parent;
    909945
    910946    pmModelStatus badModel = PM_MODEL_STATUS_NONE;
     
    9651001            }
    9661002
    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;
    9751011
    9761012            float kronFlux = source->moments ? source->moments->KronFlux : NAN;
     
    9861022            psMetadataAddF32 (row, PS_LIST_TAIL, "X_EXT_SIG",        0, "Sigma in EXT x coordinate",                  xErr);
    9871023            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);
    9901027            @>PS1_DV2@ float instFlux = isfinite(model->mag) ? pow(10.0, -0.4*model->mag) : NAN;
    9911028            @>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  
    211211        // XXX need to add the API which adjusts the scale
    212212        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        }
    213226        break;
    214227
     
    217230    }
    218231    return status;
     232}
     233
     234bool 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;
    219285}
    220286
Note: See TracChangeset for help on using the changeset viewer.