IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19881


Ignore:
Timestamp:
Oct 3, 2008, 11:00:18 AM (18 years ago)
Author:
eugene
Message:

converted pmMoments elements to Mxx, Myy, Mxxx, etc; using pmPeak position in most cases instead of moments

Location:
trunk/psphot/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/models/pmModel_STRAIL.c

    r15843 r19881  
    478478{
    479479    pmMoments *Smoments = source->moments;
     480    pmPeak    *peak    = source->peak;
    480481    psF32     *params  = model->params->data.F32;
    481482
     
    484485    psEllipseMoments moments;
    485486
    486     moments.x2 = PS_SQR(Smoments->Sx);
    487     moments.y2 = PS_SQR(Smoments->Sy);
    488     moments.xy = Smoments->Sxy;
     487    moments.x2 = Smoments->Mxx;
     488    moments.y2 = Smoments->Myy;
     489    moments.xy = Smoments->Mxy;
    489490    //sometimes these moment inputs are zero...why?
    490491
     
    494495    shape = psEllipseAxesToShape(axes);
    495496
    496     params[0] = Smoments->Sky;
    497     params[1] = Smoments->Peak - Smoments->Sky;
    498     params[2] = Smoments->x;
    499     params[3] = Smoments->y;
     497    params[PM_PAR_SKY]  = Smoments->Sky;
     498    params[PM_PAR_I0]   = peak->flux;
     499    params[PM_PAR_XPOS] = peak->xf;
     500    params[PM_PAR_YPOS] = peak->yf;
     501
    500502    params[7] = 2 * axes.major;
    501503    params[8] = axes.theta;
  • trunk/psphot/src/models/pmModel_TEST1.c

    r15843 r19881  
    126126{
    127127    pmMoments *moments = source->moments;
     128    pmPeak    *peak    = source->peak;
    128129    psF32     *PAR  = model->params->data.F32;
    129130
     131    psEllipseMoments emoments;
     132    emoments.x2 = moments->Mxx;
     133    emoments.y2 = moments->Myy;
     134    emoments.xy = moments->Mxy;
     135
     136    // force the axis ratio to be < 20.0
     137    psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0);
     138    psEllipseShape shape = psEllipseAxesToShape (axes);
     139
    130140    PAR[PM_PAR_SKY] = moments->Sky;
    131     PAR[PM_PAR_I0] = moments->Peak - moments->Sky;
    132     PAR[PM_PAR_XPOS] = moments->x;
    133     PAR[PM_PAR_YPOS] = moments->y;
    134     PAR[PM_PAR_SXX] = PS_MAX(0.5, moments->Sx);
    135     PAR[PM_PAR_SYY] = PS_MAX(0.5, moments->Sy);
     141    PAR[PM_PAR_I0]   = peak->flux;
     142    PAR[PM_PAR_XPOS] = peak->xf;
     143    PAR[PM_PAR_YPOS] = peak->yf;
     144    PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx);
     145    PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy);
     146    PAR[PM_PAR_SXY] = shape.sxy;
    136147    PAR[PM_PAR_SXY] = 0.0;  // XXX we can get this right if we do the integral
    137148
  • trunk/psphot/src/psphotBlendFit.c

    r19869 r19881  
    5555
    5656        // limit selection to some SN limit
    57         // XXX this should use peak?
    58         if (source->moments == NULL) continue;
    59         if (source->moments->SN < FIT_SN_LIM) continue;
     57        if (source->peak->SN < FIT_SN_LIM) continue;
    6058
    6159        // XXX this should use peak?
    62         if (source->moments->x < AnalysisRegion.x0) continue;
    63         if (source->moments->y < AnalysisRegion.y0) continue;
    64         if (source->moments->x > AnalysisRegion.x1) continue;
    65         if (source->moments->y > AnalysisRegion.y1) continue;
     60        if (source->peak->xf < AnalysisRegion.x0) continue;
     61        if (source->peak->yf < AnalysisRegion.y0) continue;
     62        if (source->peak->xf > AnalysisRegion.x1) continue;
     63        if (source->peak->yf > AnalysisRegion.y1) continue;
    6664
    6765        // if model is NULL, we don't have a starting guess
     
    9593            if (psphotFitBlob (readout, source, sources, psf, maskVal, markVal)) {
    9694                source->type = PM_SOURCE_TYPE_EXTENDED;
    97                 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->moments->x, source->moments->y);
     95                psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->peak->xf, source->peak->yf);
    9896                Next ++;
    9997                continue;
     
    102100            if (psphotFitBlend (readout, source, psf, maskVal, markVal)) {
    103101                source->type = PM_SOURCE_TYPE_STAR;
    104                 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->moments->x, source->moments->y);
     102                psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->peak->xf, source->peak->yf);
    105103                Npsf ++;
    106104                continue;
     
    108106        }
    109107
    110         psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->moments->x, source->moments->y);
     108        psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->peak->xf, source->peak->yf);
    111109        Nfail ++;
    112110
  • trunk/psphot/src/psphotChoosePSF.c

    r19793 r19881  
    474474        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
    475475
    476         // moments->Sx,Sy are roughly sigma_x,y
    477         moments.x2 = PS_SQR(source->moments->Sx);
    478         moments.y2 = PS_SQR(source->moments->Sy);
    479         moments.xy = source->moments->Sxy;
     476        moments.x2 = source->moments->Mxx;
     477        moments.y2 = source->moments->Myy;
     478        moments.xy = source->moments->Mxy;
    480479
    481480        // limit axis ratio < 20.0
  • trunk/psphot/src/psphotExtendedSourceAnalysis.c

    r17396 r19881  
    7171                // all measurements below require the radial profile; skip them all
    7272                // re-subtract the object, leave local sky
    73                 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     73                psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    7474                pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    7575                source->mode |= PM_SOURCE_MODE_SUBTRACTED;
     
    8181        if (doIsophotal) {
    8282            if (!psphotIsophotal (source, recipe, maskVal)) {
    83                 psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     83                psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    8484            } else {
    85                 psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     85                psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    8686                Nisophot ++;
    8787            }
     
    9191        if (doPetrosian) {
    9292            if (!psphotPetrosian (source, recipe, maskVal)) {
    93                 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     93                psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    9494            } else {
    95                 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     95                psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    9696                Npetro ++;
    9797            }
     
    101101        if (doKron) {
    102102            if (!psphotKron (source, recipe, maskVal)) {
    103                 psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     103                psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    104104            } else {
    105                 psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     105                psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    106106                Nkron ++;
    107107            }
     
    114114                return false;
    115115            }
    116             psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     116            psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    117117            Nannuli ++;
    118118        }
  • trunk/psphot/src/psphotExtendedSourceFits.c

    r19237 r19881  
    163163              modelFit = psphotPSFConvModel (readout, source, modelType, maskVal, markVal, psfSize);
    164164              if (!modelFit) {
    165                   psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->x, source->moments->y);
     165                  psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My);
    166166                  continue;
    167167              }
    168               psTrace ("psphot", 4, "fit psf-conv model for %f, %f : %s chisq = %f\n", source->moments->x, source->moments->y, pmModelClassGetName (modelFit->type), modelFit->chisq);
     168              psTrace ("psphot", 4, "fit psf-conv model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq);
    169169              Nconvolve ++;
    170170              if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {
     
    176176              modelFit = psphotFitEXT (readout, source, modelType, maskVal, markVal);
    177177              if (!modelFit) {
    178                   psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->x, source->moments->y);
     178                  psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My);
    179179                  continue;
    180180              }
    181181              pmSourceCacheModel (source, maskVal);
    182               psTrace ("psphot", 4, "fit plain model for %f, %f : %s chisq = %f\n", source->moments->x, source->moments->y, pmModelClassGetName (modelFit->type), modelFit->chisq);
     182              psTrace ("psphot", 4, "fit plain model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq);
    183183              Nplain ++;
    184184              if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {
     
    217217        if (minModel == -1) {
    218218          // re-subtract the object, leave local sky
    219           psTrace ("psphot", 5, "failed to fit extended source model to object at %f, %f", source->moments->x, source->moments->y);
     219          psTrace ("psphot", 5, "failed to fit extended source model to object at %f, %f", source->moments->Mx, source->moments->My);
    220220
    221221          // replace original model, subtract it
     
    257257        psFree (modelFluxes);
    258258
    259         psTrace ("psphot", 4, "best ext model for %f, %f : %s chisq = %f\n", source->moments->x, source->moments->y, pmModelClassGetName (source->modelEXT->type), source->modelEXT->chisq);
    260         psTrace ("psphot", 5, "extended source model for source at %7.1f, %7.1f", source->moments->x, source->moments->y);
     259        psTrace ("psphot", 4, "best ext model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (source->modelEXT->type), source->modelEXT->chisq);
     260        psTrace ("psphot", 5, "extended source model for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My);
    261261
    262262        if (savePics) {
  • trunk/psphot/src/psphotFakeSources.c

    r14655 r19881  
    1010        pmSource *source = pmSourceAlloc ();
    1111        source->moments = pmMomentsAlloc ();
    12         source->moments->x = 10;
    13         source->moments->y = 10;
    14         source->moments->Sx = 1;
    15         source->moments->Sy = 1;
    16         source->moments->Sxy = 0;
     12        source->moments->Mx = 10;
     13        source->moments->My = 10;
     14        source->moments->Mxx = 1;
     15        source->moments->Myy = 1;
     16        source->moments->Mxy = 0;
    1717        source->moments->Sum = 1000;
    1818        source->moments->Peak = 100;
  • trunk/psphot/src/psphotGuessModels.c

    r18555 r19881  
    5959            // these valuse are set in pmSourceModelGuess, should this rule be in there as well?
    6060            if (source->mode &  PM_SOURCE_MODE_SATSTAR) {
    61                 modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments->x;
    62                 modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments->y;
     61                modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments->Mx;
     62                modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments->My;
    6363            } else {
    6464                modelEXT->params->data.F32[PM_PAR_XPOS] = source->peak->xf;
  • trunk/psphot/src/psphotModelTest.c

    r18555 r19881  
    143143    source->peak->value = source->moments->Peak;
    144144
    145     fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments->x, source->moments->y);
    146     fprintf (stderr, "moments: %f, %f - %f\n", source->moments->Sx, source->moments->Sy, source->moments->Sxy);
     145    fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments->Mx, source->moments->My);
     146    fprintf (stderr, "moments: %f, %f - %f\n", source->moments->Mxx, source->moments->Myy, source->moments->Mxy);
    147147
    148148    psEllipseMoments moments;
    149     moments.x2 = source->moments->Sx;
    150     moments.y2 = source->moments->Sy;
    151     moments.xy = source->moments->Sxy;
     149    moments.x2 = source->moments->Mxx;
     150    moments.y2 = source->moments->Myy;
     151    moments.xy = source->moments->Mxy;
    152152    psEllipseAxes axes = psEllipseMomentsToAxes (moments, 20.0);
    153153
  • trunk/psphot/src/psphotMosaicSubimage.c

    r19869 r19881  
    3838                newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak;
    3939            } else {
    40                 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak;
     40                newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix];
    4141            }
    4242        }
  • trunk/psphot/src/psphotSourceFits.c

    r19869 r19881  
    218218    if (source->type == PM_SOURCE_TYPE_DEFECT) return false;
    219219    if (source->type == PM_SOURCE_TYPE_SATURATED) return false;
    220     if (source->moments->SN < EXT_MIN_SN) return false;
     220    if (source->peak->SN < EXT_MIN_SN) return false;
    221221
    222222    // recalculate the source moments using the larger extended-source moments radius
     
    331331    maskVal |= markVal;
    332332
     333    // XXX this is really poor: if we don't have moments for the source, we have no guess.
     334    // force the measurement?
     335    psAssert (source->moments, "moments are re-calculated for any extended source");
     336       
    333337    // make a guess at the position of the two sources
    334     moments.x2 = source->moments->Sx;
    335     moments.y2 = source->moments->Sy;
    336     moments.xy = source->moments->Sxy;
     338    moments.x2 = source->moments->Mxx;
     339    moments.xy = source->moments->Mxy;
     340    moments.y2 = source->moments->Myy;
    337341    axes = psEllipseMomentsToAxes (moments, 20.0);
    338342
     
    380384    psphotCheckRadiusEXT (readout, source, EXT, markVal);
    381385
    382     if ((source->moments->Sx < 1e-3) || (source->moments->Sx < 1e-3)) {
    383         psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Sx, source->moments->Sy);
     386    if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) {
     387        psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy);
    384388    }
    385389
  • trunk/psphot/src/psphotSummaryPlots.c

    r13477 r19881  
    6161        if (source->moments == NULL) continue;
    6262   
    63         xFaint->data.F32[nF] = source->moments->Sx;
    64         yFaint->data.F32[nF] = source->moments->Sy;
     63        xFaint->data.F32[nF] = source->moments->Mxx;
     64        yFaint->data.F32[nF] = source->moments->Myy;
    6565        nF++;
    6666   
     
    6868        if (source->moments->SN < 25) continue;
    6969
    70         xBright->data.F32[nB] = source->moments->Sx;
    71         yBright->data.F32[nB] = source->moments->Sy;
     70        xBright->data.F32[nB] = source->moments->Mxx;
     71        yBright->data.F32[nB] = source->moments->Myy;
    7272        nB++;
    7373    }
     
    160160
    161161        psEllipseMoments moments;
    162         moments.x2 = source->moments->Sx;
    163         moments.y2 = source->moments->Sy;
    164         moments.xy = source->moments->Sxy;
     162        moments.x2 = source->moments->Mxx;
     163        moments.xy = source->moments->Mxy;
     164        moments.y2 = source->moments->Myy;
    165165
    166166        psEllipseShape shape;
Note: See TracChangeset for help on using the changeset viewer.