IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42711


Ignore:
Timestamp:
Jul 5, 2024, 12:30:50 PM (2 years ago)
Author:
eugene
Message:

add option in psphot to fit the PSF star positions as well as shapes (default is false); add option to use robustMedian vs clippedMean for moments-based source sizes and PSF star selection; saturate variance to max value if signal is non NAN

Location:
branches/eam_branches/ipp-20230313/psphot/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20230313/psphot/src/psphotChoosePSF.c

    r42380 r42711  
    114114    options->psfTrendNy = psMetadataLookupS32 (&status, recipe, "PSF.TREND.NY");
    115115    assert (status);
     116
     117    // use poissonian errors or local-sky errors
     118    options->fitPSFstarCoords = psMetadataLookupBool (&status, recipe, "PSF_FIT_STAR_COORDS");
     119    if (!status) {
     120      options->fitPSFstarCoords = false;
     121    }
    116122
    117123    // get the fixed PSF fit radius
  • branches/eam_branches/ipp-20230313/psphot/src/psphotMakeResiduals.c

    r42510 r42711  
    369369
    370370                if (fabs(resid->Ro->data.F32[oy][ox]) < pixelSN*dRo/sqrt(nKeep)) {
     371                  // fprintf (stderr, "mask : %d, %d : %f +/- %f (%f for %d) : %d\n", ox, oy, resid->Ro->data.F32[oy][ox], dRo, dRo/sqrt(nKeep), nKeep, resid->mask->data.PM_TYPE_RESID_MASK_DATA[oy][ox]);
    371372                  resid->mask->data.PM_TYPE_RESID_MASK_DATA[oy][ox] = 1;
    372373                  resid->Ro->data.F32[oy][ox] = 0.0;
    373374                  resid->Rx->data.F32[oy][ox] = 0.0;
    374375                  resid->Ry->data.F32[oy][ox] = 0.0;
    375                 }
     376                } else {
     377                  // fprintf (stderr, "keep : %d, %d : %f +/- %f (%f for %d) : %d\n", ox, oy, resid->Ro->data.F32[oy][ox], dRo, dRo/sqrt(nKeep), nKeep, resid->mask->data.PM_TYPE_RESID_MASK_DATA[oy][ox]);
     378                }
    376379            }
    377380        }
  • branches/eam_branches/ipp-20230313/psphot/src/psphotMaskReadout.c

    r34293 r42711  
    5858            return false;
    5959        }
     60    }
     61
     62    // XXX test to repair variance
     63    if (true) {
     64      psImage *im = readout->image;
     65      psImage *wt = readout->variance;
     66      float maxVar = 0;
     67      // find the max value
     68      for (int j = 0; j < im->numRows; j++) {
     69        for (int i = 0; i < im->numCols; i++) {
     70            if (!isfinite(wt->data.F32[j][i])) continue;
     71            maxVar = PS_MAX (wt->data.F32[j][i], maxVar);
     72        }
     73      }
     74      // set pixels with nan variance and non-nan image to maxVar
     75      for (int j = 0; j < im->numRows; j++) {
     76        for (int i = 0; i < im->numCols; i++) {
     77            if (!isfinite(im->data.F32[j][i])) continue;
     78            if (isfinite(wt->data.F32[j][i])) continue;
     79            wt->data.F32[j][i] = maxVar;
     80        }
     81      }
    6082    }
    6183
  • branches/eam_branches/ipp-20230313/psphot/src/psphotRoughClass.c

    r36375 r42711  
    198198        }
    199199
    200         psfClump = pmSourcePSFClump (NULL, region, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
     200        // use clipped stats or robust stats to define the clump
     201        bool PSF_CLUMP_USE_CLIPPED_STATS = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_USE_CLIPPED_STATS");
     202        if (!status) { PSF_CLUMP_USE_CLIPPED_STATS = true; }
     203
     204        psfClump = pmSourcePSFClump (NULL, region, sources, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX, PSF_CLUMP_USE_CLIPPED_STATS);
    201205
    202206        psMetadataAddF32 (regionMD, PS_LIST_TAIL, "PSF.CLUMP.X",  PS_META_REPLACE, "psf clump center", psfClump.X);
  • branches/eam_branches/ipp-20230313/psphot/src/psphotSourceStats.c

    r42439 r42711  
    506506        MOMENTS_SY_MIN = 0.5;
    507507    }
     508
     509    // use clipped stats or robust stats to define the clump
     510    bool PSF_CLUMP_USE_CLIPPED_STATS = psMetadataLookupF32(&status, recipe, "PSF_CLUMP_USE_CLIPPED_STATS");
     511    if (!status) { PSF_CLUMP_USE_CLIPPED_STATS = true; }
    508512
    509513    // when we set the window, we are not attempting to measure spatial variations; we can use a somewhat higher S/N limit
     
    597601
    598602        // determine the PSF parameters from the source moment values
    599         pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sourceSubset, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX);
     603        pmPSFClump psfClump = pmSourcePSFClump (NULL, NULL, sourceSubset, PSF_SN_LIM, PSF_CLUMP_GRID_SCALE, MOMENTS_SX_MAX, MOMENTS_SY_MAX, MOMENTS_SX_MIN, MOMENTS_SY_MIN, MOMENTS_AR_MAX, PSF_CLUMP_USE_CLIPPED_STATS);
    600604        psLogMsg ("psphot", 3, "sigma guess (pix) %.1f, nStars: %d of %d in clump, nSigma: %5.2f, X,  Y: %f, %f (%f, %f)\n", sigma[i], psfClump.nStars, psfClump.nTotal, psfClump.nSigma, psfClump.X, psfClump.Y, sqrt(psfClump.X) / sigma[i], sqrt(psfClump.Y) / sigma[i]);
    601605
Note: See TracChangeset for help on using the changeset viewer.