IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31670


Ignore:
Timestamp:
Jun 22, 2011, 12:48:29 AM (15 years ago)
Author:
eugene
Message:

merge from trunk : various minor issues (kron radii; I/O fixes)

Location:
trunk/psModules/src/objects
Files:
12 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/Makefile.am

    r31451 r31670  
    128128
    129129CLEANFILES = *~
     130
     131# pmSourceID_CMF_* functions use a common framework
     132BUILT_SOURCES = pmSourceIO_CMF_PS1_V1.v1.c pmSourceIO_CMF_PS1_V2.v1.c pmSourceIO_CMF_PS1_V3.v1.c
     133
     134pmSourceIO_CMF_PS1_V1.v1.c : pmSourceIO_CMF.c.in mksource.pl
     135        mksource.pl pmSourceIO_CMF.c.in PS1_V1 pmSourceIO_CMF_PS1_V1.v1.c
     136
     137pmSourceIO_CMF_PS1_V2.v1.c : pmSourceIO_CMF.c.in mksource.pl
     138        mksource.pl pmSourceIO_CMF.c.in PS1_V2 pmSourceIO_CMF_PS1_V2.v1.c
     139
     140pmSourceIO_CMF_PS1_V3.v1.c : pmSourceIO_CMF.c.in mksource.pl
     141        mksource.pl pmSourceIO_CMF.c.in PS1_V2 pmSourceIO_CMF_PS1_V3.v1.c
     142
     143# EXTRA_DIST = pmErrorCodes.h.in pmErrorCodes.dat pmErrorCodes.c.in
  • trunk/psModules/src/objects/models/pmModel_PS1_V1.c

    r31538 r31670  
    296296    psF64 sigma = axes.major;
    297297
     298    // we can solve directly if PAR_7 goes to 0.0
    298299    if (PAR[PM_PAR_7] == 0.0) {
    299300        psF32 z =  powf(PAR[PM_PAR_I0] / flux - 1.0, 1.0 / ALPHA);
    300301        return ( sigma * sqrt (2.0 * z) );
    301302    }
    302 
    303303    psF64 limit = flux / PAR[PM_PAR_I0];
    304304
  • trunk/psModules/src/objects/models/pmModel_QGAUSS.c

    r31451 r31670  
    289289    if (PAR[PM_PAR_I0] <= 0) return 1.0;
    290290    if (flux >= PAR[PM_PAR_I0]) return 1.0;
    291     if (PAR[PM_PAR_7] == 0.0) return powf(PAR[PM_PAR_I0] / flux - 1.0, 1.0 / ALPHA);
     291
     292    // if (PAR[PM_PAR_7] == 0.0) return powf(PAR[PM_PAR_I0] / flux - 1.0, 1.0 / ALPHA);
    292293
    293294    shape.sx  = PAR[PM_PAR_SXX] / M_SQRT2;
     
    297298    psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0);
    298299    psF64 sigma = axes.major;
     300
     301    // we can solve directly if PAR_7 goes to 0.0
     302    if (PAR[PM_PAR_7] == 0.0) {
     303        psF32 z =  powf(PAR[PM_PAR_I0] / flux - 1.0, 1.0 / ALPHA);
     304        return ( sigma * sqrt (2.0 * z) );
     305    }
    299306
    300307    psF64 limit = flux / PAR[PM_PAR_I0];
  • trunk/psModules/src/objects/pmSource.c

    r31451 r31670  
    362362*****************************************************************************/
    363363
    364 pmPSFClump pmSourcePSFClump(psImage **savedImage, psRegion *region, psArray *sources, float PSF_SN_LIM, float PSF_CLUMP_GRID_SCALE, psF32 SX_MAX, psF32 SY_MAX, psF32 AR_MAX)
     364pmPSFClump pmSourcePSFClump(psImage **savedImage, psRegion *region, psArray *sources, float PSF_SN_LIM, float PSF_CLUMP_GRID_SCALE, psF32 SX_MAX, psF32 SY_MAX, psF32 SX_MIN, psF32 SY_MIN, psF32 AR_MAX)
    365365{
    366366    psTrace("psModules.objects", 10, "---- begin ----\n");
     
    422422
    423423            // Sx,Sy are limited at 0.  a peak at 0,0 is artificial
    424             if (fabs(Mxx) < 0.05 || fabs(Myy < 0.05)) {
     424            if (fabs(Mxx) < SX_MIN || fabs(Myy < SY_MIN)) {
    425425                psTrace("psModules.objects", 10,
    426426                        "Rejecting source from clump because of low moments (%f,%f)\n",
  • trunk/psModules/src/objects/pmSource.h

    r31451 r31670  
    219219    psF32 SX_MAX,
    220220    psF32 SY_MAX,
     221    psF32 SX_MIN,
     222    psF32 SY_MIN,
    221223    psF32 AR_MAX
    222224);
  • trunk/psModules/src/objects/pmSourceIO.c

    r30621 r31670  
    727727
    728728    psMetadata *fileData = psMetadataLookupMetadata(NULL, file->format, "FILE"); // File information
    729     const char *fpaNameHdr = psMetadataLookupStr(NULL, fileData, "FPA.OBS");
     729    const char *fpaNameHdr = psMetadataLookupStr(&status, fileData, "FPA.OBS");
    730730    if (fpaNameHdr && strlen(fpaNameHdr) > 0) {
    731         const char *fpaName = psMetadataLookupStr(NULL, fpa->concepts, "FPA.OBS");
    732         psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE,
    733                          "FPA observation identifier", fpaName);
     731        const char *fpaName = psMetadataLookupStr(&status, fpa->concepts, "FPA.OBS");
     732        if (fpaName) {
     733            psMetadataAddStr(outhead, PS_LIST_TAIL, fpaNameHdr, PS_META_REPLACE, "FPA observation identifier", fpaName);
     734        }
    734735    }
    735736
  • trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c

    r31451 r31670  
    113113        psMetadataAdd (row, PS_LIST_TAIL, "X_PSF_SIG",        PS_DATA_F32, "Sigma in PSF x coordinate",                  outputs.xErr); // XXX this is only measured for non-linear fits
    114114        psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG",        PS_DATA_F32, "Sigma in PSF y coordinate",                  outputs.yErr); // XXX this is only measured for non-linear fits
     115
    115116        psMetadataAdd (row, PS_LIST_TAIL, "POSANGLE",         PS_DATA_F32, "position angle at source (degrees)",         outputs.posAngle);
    116117        psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE",         PS_DATA_F32, "plate scale at source (arcsec/pixel)",       outputs.pltScale);
  • trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V3.c

    r31451 r31670  
    270270        source->skyErr    = dPAR[PM_PAR_SKY];
    271271
    272         // XXX use these to determine PAR[PM_PAR_I0]?
    273272        source->psfMag    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG");
    274         source->psfMagErr    = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
     273        source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");
    275274        source->apMag     = psMetadataLookupF32 (&status, row, "AP_MAG");
     275        source->apMagRaw  = psMetadataLookupF32 (&status, row, "AP_MAG_RAW");
     276
     277        // XXX use these to determine PAR[PM_PAR_I0] if they exist?
     278        source->psfFlux   = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX");
     279        source->psfFluxErr = psMetadataLookupF32 (&status, row, "PSF_INST_FLUX_SIG");
    276280
    277281        // XXX this scaling is incorrect: does not include the 2 \pi AREA factor
  • trunk/psModules/src/objects/pmSourceMasks.h

    r31451 r31670  
    5353
    5454    PM_SOURCE_MODE2_PASS1_SRC        = 0x00000080, ///< source detected in first pass analysis
     55
     56    PM_SOURCE_MODE2_HAS_BRIGHTER_NEIGHBOR = 0x00000100, ///< peak is not the brightest in its footprint
     57    PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_1     = 0x00000200, ///< flux_n / (r^2 flux_p) > 1
     58    PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_10    = 0x00000400, ///< flux_n / (r^2 flux_p) > 10
    5559} pmSourceMode2;
    5660
  • trunk/psModules/src/objects/pmSourceMoments.c

    r31451 r31670  
    264264
    265265    // if Mrf (first radial moment) is very small, we are getting into low-significance
    266     // territory.  saturate at minKronRadius.  conversely, if Mrf is > radius, we are clearly
    267     // making an error.  saturate at radius.
    268     float kronRefRadius = MIN(radius, MAX(minKronRadius, source->moments->Mrf));
     266    // territory.  saturate at minKronRadius.  conversely, if Mrf is >> radius for faint
     267    // sources, we are clearly making an error.  saturate at radius.
     268    float kronRefRadius = MAX(minKronRadius, source->moments->Mrf);
     269    if (source->moments->SN < 10) {
     270        kronRefRadius = MIN(radius, kronRefRadius);
     271    }
    269272
    270273    float radKinner = 1.0*kronRefRadius;
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r31451 r31670  
    134134    // measure PSF model photometry
    135135    status = pmSourcePhotometryModel (&source->psfMag, &source->psfFlux, modelPSF);
    136     source->psfFluxErr = source->psfFlux * source->psfMagErr;
     136    source->psfFluxErr = fabs(source->psfFlux * source->psfMagErr);
    137137
    138138# if (0)
     
    191191    }
    192192
     193    pmSourceNeighborFlags (source);
     194
    193195    // measure the aperture magnitude, if (SN > AP_MIN_SN)
    194196    if (!isfinite(SN)) {
     
    264266
    265267*/
     268
     269bool pmSourceNeighborFlags (pmSource *source) {
     270
     271    return false;
     272
     273    // source must have a peak to have a footprint
     274    if (!source) return false;
     275    if (!source->peak) return false;
     276    if (!source->peak->footprint) return false;
     277    if (!source->peak->footprint->peaks) return false;
     278    if (!source->peak->footprint->peaks->n) return false;
     279
     280    // find the brightest peak (first peak)
     281    pmPeak *brightPeak = source->peak->footprint->peaks->data[0];
     282
     283    // are we the brightest peak?
     284    if (source->peak == brightPeak) return true;
     285
     286    // if not, raise a flag:
     287    source->mode2 |= PM_SOURCE_MODE2_HAS_BRIGHTER_NEIGHBOR;
     288
     289    // but, this is a common situation.  more interesting is if the ratio flux_n / (r^2 flux_o) is large
     290
     291    float radius2 = PS_SQR(source->peak->xf - brightPeak->xf) + PS_SQR(source->peak->yf - brightPeak->yf);
     292
     293    float ratio = brightPeak->rawFlux / (source->peak->rawFlux * radius2);
     294
     295    if (ratio > 1) {
     296        source->mode2 |= PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_1;
     297    }
     298
     299    if (ratio > 10) {
     300        source->mode2 |= PM_SOURCE_MODE2_BRIGHT_NEIGHBOR_10;
     301    }
     302
     303    return true;
     304}
    266305
    267306// return source model magnitude
  • trunk/psModules/src/objects/pmSourcePhotometry.h

    r31451 r31670  
    7979double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor, psImageMaskType maskVal);
    8080
     81bool pmSourceNeighborFlags (pmSource *source);
     82
    8183// retire these:
    8284// double pmSourceCrossProduct(const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum);
Note: See TracChangeset for help on using the changeset viewer.