IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10075


Ignore:
Timestamp:
Nov 17, 2006, 9:31:44 PM (20 years ago)
Author:
magnier
Message:

working on new linear fit process

Location:
trunk/psModules
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAMaskWeight.c

    r9830 r10075  
    210210    psImage *image = readout->image;    // The image pixels
    211211    readout->weight = (psImage*)psBinaryOp(readout->weight, image, "/", psScalarAlloc(gain, PS_TYPE_F32));
     212
     213    // a negative weight is non-sensical. if the image value drops below 1, the weight must be 1.
     214    readout->weight = (psImage*)psUnaryOp(readout->weight, readout->weight, "abs");
     215    readout->weight = (psImage*)psBinaryOp(readout->weight, readout->weight, "max", psScalarAlloc(1, PS_TYPE_F32));
     216
    212217    readout->weight = (psImage*)psBinaryOp(readout->weight, readout->weight, "+",
    213218                                           psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32));
  • trunk/psModules/src/objects/pmPSFtry.c

    r10011 r10075  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-11-16 01:45:50 $
     7 *  @version $Revision: 1.27 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-11-18 07:31:44 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    168168        psImageKeepCircle (source->mask, x, y, RADIUS, "OR", PM_MASK_MARK);
    169169        status = pmSourceFitModel (source, source->modelPSF, PM_SOURCE_FIT_PSF);
     170        // pmModelSub (source->pixels, source->mask, source->modelPSF, false, false);
    170171        psImageKeepCircle (source->mask, x, y, RADIUS, "AND", PS_NOT_U8(PM_MASK_MARK));
    171172
     
    291292
    292293    // XXX test dump of fitted model (dump when tracing?)
    293     if (0) {
     294    if (1) {
    294295        FILE *f = fopen ("resid.dat", "w");
    295296        psVector *apfit = psPolynomial1DEvalVector (poly, r2rflux);
     
    403404
    404405    // XXX test dump of star parameters vs position (compare with fitted values)
    405     if (0) {
     406    if (1) {
    406407        FILE *f = fopen ("params.dat", "w");
    407408
  • trunk/psModules/src/objects/pmSource.c

    r10049 r10075  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-11-17 23:01:30 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-11-18 07:31:44 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3131static void sourceFree(pmSource *tmp)
    3232{
    33     psTrace(__func__, 5, "---- begin ----\n");
     33    psTrace("psModules.objects", 5, "---- begin ----\n");
    3434    psFree(tmp->peak);
    3535    psFree(tmp->pixels);
     
    4040    psFree(tmp->modelEXT);
    4141    psFree(tmp->blends);
    42     psTrace(__func__, 5, "---- end ----\n");
     42    psTrace("psModules.objects", 5, "---- end ----\n");
    4343}
    4444
     
    6565pmSource *pmSourceAlloc()
    6666{
    67     psTrace(__func__, 5, "---- begin ----\n");
     67    psTrace("psModules.objects", 5, "---- begin ----\n");
    6868    static int id = 1;
    6969    pmSource *source = (pmSource *) psAlloc(sizeof(pmSource));
     
    9090    source->pixWeight = NAN;
    9191
    92     psTrace(__func__, 5, "---- end ----\n");
     92    psTrace("psModules.objects", 5, "---- end ----\n");
    9393    return(source);
    9494}
     
    205205pmPSFClump pmSourcePSFClump(psArray *sources, psMetadata *recipe)
    206206{
    207     psTrace(__func__, 5, "---- begin ----\n");
     207    psTrace("psModules.objects", 5, "---- begin ----\n");
    208208
    209209    # define NPIX 10
     
    291291        stats = psImageStats (stats, splane, NULL, 0);
    292292        peaks = pmFindImagePeaks (splane, stats[0].max / 2);
    293         psTrace (__func__, 2, "clump threshold is %f\n", stats[0].max/2);
     293        psTrace ("psModules.objects", 2, "clump threshold is %f\n", stats[0].max/2);
    294294
    295295        const bool keep_psf_clump = psMetadataLookupBool(NULL, recipe, "KEEP_PSF_CLUMP");
     
    323323        psArraySort (peaks, pmPeaksCompareDescend);
    324324        clump = peaks->data[0];
    325         psTrace (__func__, 2, "clump is at %d, %d (%f)\n", clump->x, clump->y, clump->counts);
     325        psTrace ("psModules.objects", 2, "clump is at %d, %d (%f)\n", clump->x, clump->y, clump->counts);
    326326
    327327        // define section window for clump
     
    369369        psfClump.dY = stats->clippedStdev;
    370370
    371         psTrace (__func__, 2, "clump  X,  Y: %f, %f\n", psfClump.X, psfClump.Y);
    372         psTrace (__func__, 2, "clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY);
     371        psTrace ("psModules.objects", 2, "clump  X,  Y: %f, %f\n", psfClump.X, psfClump.Y);
     372        psTrace ("psModules.objects", 2, "clump DX, DY: %f, %f\n", psfClump.dX, psfClump.dY);
    373373        // these values should be pushed on the recipe somewhere
    374374
     
    379379    }
    380380
    381     psTrace(__func__, 5, "---- end ----\n");
     381    psTrace("psModules.objects", 5, "---- end ----\n");
    382382    return (psfClump);
    383383}
     
    391391bool pmSourceRoughClass(psArray *sources, psMetadata *recipe, pmPSFClump clump)
    392392{
    393     psTrace(__func__, 5, "---- begin ----");
     393    psTrace("psModules.objects", 5, "---- begin ----");
    394394
    395395    psBool rc = true;
     
    498498    psFree (starsn);
    499499
    500     psTrace (__func__, 2, "Nstar:    %3d\n", Nstar);
    501     psTrace (__func__, 2, "Npsf:     %3d\n", Npsf);
    502     psTrace (__func__, 2, "Next:     %3d\n", Next);
    503     psTrace (__func__, 2, "Nsatstar: %3d\n", Nsatstar);
    504     psTrace (__func__, 2, "Nsat:     %3d\n", Nsat);
    505     psTrace (__func__, 2, "Ncr:      %3d\n", Ncr);
    506 
    507     psTrace(__func__, 5, "---- end ----\n");
     500    psTrace ("psModules.objects", 2, "Nstar:    %3d\n", Nstar);
     501    psTrace ("psModules.objects", 2, "Npsf:     %3d\n", Npsf);
     502    psTrace ("psModules.objects", 2, "Next:     %3d\n", Next);
     503    psTrace ("psModules.objects", 2, "Nsatstar: %3d\n", Nsatstar);
     504    psTrace ("psModules.objects", 2, "Nsat:     %3d\n", Nsat);
     505    psTrace ("psModules.objects", 2, "Ncr:      %3d\n", Ncr);
     506
     507    psTrace("psModules.objects", 5, "---- end ----\n");
    508508    return(rc);
    509509}
     
    531531                     psF32 radius)
    532532{
    533     psTrace(__func__, 5, "---- begin ----\n");
     533    psTrace("psModules.objects", 5, "---- begin ----\n");
    534534    PS_ASSERT_PTR_NON_NULL(source, false);
    535535    PS_ASSERT_PTR_NON_NULL(source->peak, false);
     
    637637    // XXX EAM - the limit is a bit arbitrary.  make it user defined?
    638638    if ((numPixels < 0.75*R2) || (Sum <= 0)) {
    639         psTrace (__func__, 3, "no valid pixels for source\n");
    640         psTrace(__func__, 5, "---- end (false) ----\n");
     639        psTrace ("psModules.objects", 3, "no valid pixels for source\n");
     640        psTrace("psModules.objects", 5, "---- end (false) ----\n");
    641641        return (false);
    642642    }
    643643
    644     psTrace (__func__, 4, "sky: %f  Sum: %f  X1: %f  Y1: %f  X2: %f  Y2: %f  XY: %f  Npix: %d\n",
     644    psTrace ("psModules.objects", 4, "sky: %f  Sum: %f  X1: %f  Y1: %f  X2: %f  Y2: %f  XY: %f  Npix: %d\n",
    645645             sky, Sum, X1, Y1, X2, Y2, XY, numPixels);
    646646
     
    653653    y = Y1/Sum;
    654654    if ((fabs(x) > radius) || (fabs(y) > radius)) {
    655         psTrace (__func__, 3, "large centroid swing; invalid peak %d, %d\n",
     655        psTrace ("psModules.objects", 3, "large centroid swing; invalid peak %d, %d\n",
    656656                 source->peak->x, source->peak->y);
    657         psTrace(__func__, 5, "---- end(false)  ----\n");
     657        psTrace("psModules.objects", 5, "---- end(false)  ----\n");
    658658        return (false);
    659659    }
     
    673673    source->moments->Sy = sqrt(PS_MAX(Y2/Sum - PS_SQR(y), 0));
    674674
    675     psTrace (__func__, 4,
     675    psTrace ("psModules.objects", 4,
    676676             "sky: %f  Sum: %f  x: %f  y: %f  Sx: %f  Sy: %f  Sxy: %f\n",
    677677             sky, Sum, source->moments->x, source->moments->y,
    678678             source->moments->Sx, source->moments->Sy, source->moments->Sxy);
    679679
    680     psTrace(__func__, 5, "---- end ----\n");
     680    psTrace("psModules.objects", 5, "---- end ----\n");
    681681    return(true);
    682682}
  • trunk/psModules/src/objects/pmSourceFitModel.c

    r9730 r10075  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-10-24 22:55:05 $
     8 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-11-18 07:31:44 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5151                       pmSourceFitMode mode)
    5252{
    53     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     53    psTrace("psModules.objects", 5, "---- %s() begin ----\n", __func__);
    5454    PS_ASSERT_PTR_NON_NULL(source, false);
    5555    PS_ASSERT_PTR_NON_NULL(source->moments, false);
     
    163163
    164164    if (nPix <  nParams + 1) {
    165         psTrace (".pmObjects.pmSourceFitModel", 4, "insufficient valid pixels\n");
    166         psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);
     165        psTrace ("psModules.objects", 4, "insufficient valid pixels\n");
     166        psTrace ("psModules.objects", 5, "---- %s(false) end ----\n", __func__);
    167167        model->status = PM_MODEL_BADARGS;
    168168        psFree (x);
     
    189189    psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F64);
    190190
    191     psTrace (".pmObjects.pmSourceFitModel", 5, "fitting function\n");
     191    psTrace (__func__, 5, "fitting function\n");
    192192
    193193    fitStatus = psMinimizeLMChi2(myMin, covar, params, constrain, x, y, yErr, modelFunc);
    194194    for (int i = 0; i < dparams->n; i++) {
     195        psTrace ("psModules.objects", 4, "%f ", params->data.F32[i]);
    195196        if ((paramMask != NULL) && paramMask->data.U8[i])
    196197            continue;
    197198        dparams->data.F32[i] = sqrt(covar->data.F64[i][i]);
    198199    }
     200    psTrace ("psModules.objects", 4, "niter: %d, chisq: %f", myMin->iter, myMin->value);
    199201
    200202    // save the resulting chisq, nDOF, nIter
     
    245247
    246248    rc = (onPic && fitStatus);
    247     psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);
     249    psTrace("psModules.objects", 5, "---- %s(%d) end ----\n", __func__, rc);
    248250    return(rc);
    249251}
  • trunk/psModules/src/objects/pmSourceIO_RAW.c

    r9810 r10075  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-10-31 19:38:44 $
     5 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-11-18 07:31:44 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    267267        if (peak == NULL)
    268268            continue;
    269         fprintf (f, "%5d %5d  %7.1f\n",
    270                  peak->x, peak->y, peak->counts);
    271     }
    272     fclose (f);
    273     return true;
    274 }
    275 
     269        fprintf (f, "%5d %5d  %7.1f %7.2f %7.2f\n",
     270                 peak->x, peak->y, peak->counts, peak->xf, peak->yf);
     271    }
     272    fclose (f);
     273    return true;
     274}
     275
Note: See TracChangeset for help on using the changeset viewer.