IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 8, 2023, 11:54:58 AM (3 years ago)
Author:
eugene
Message:

merge from eam_branches/ipp-20220316. if no PSF stars are defined, use all with S/N above some limit

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphotChoosePSF.c

    r42087 r42380  
    594594    psVector *psfExtra2 = psVectorAllocEmpty (100, PS_DATA_F32);
    595595
     596    // count how many PSF stars are defined
     597    int nPSFstars = 0; // count the number of PSF stars
    596598    for (int i = 0; i < sources->n; i++) {
    597 
    598599        pmSource *source = sources->data[i];
    599 
    600600        if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     601    }
     602
     603    for (int i = 0; i < sources->n; i++) {
     604
     605        pmSource *source = sources->data[i];
     606
     607        // If no sources are PSFSTARs, then let's just use all with S/N > 0.1.
     608        // (This can happen if all are supplied)
     609        if (nPSFstars) {
     610            if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue;
     611        } else {
     612            if (source->psfMagErr > 0.1) continue;
     613        }
    601614
    602615        float xc = source->peak->xf;
     
    638651        // float fwhmtest = pmPSFtoFWHM(psf, xc, yc);
    639652        // fprintf (stderr, "fwhm: %f, %f : %f\n", FWHM_MAJOR, FWHM_MINOR, fwhmtest);
     653    }
     654
     655    // XXX should we catch this case and exit immediately? (need to raise an error?)
     656    if (0 && !fwhmMajor->n) {
     657        psLogMsg ("psphot", PS_LOG_DETAIL, "no stars on the chip to measure PSF FWHM");
     658        goto escape;
    640659    }
    641660
     
    721740
    722741escape:
     742    // failed to measure the PSF stats
     743    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FWHM_MAJ",   PS_META_REPLACE, "PSF FWHM Major axis (mean)",           NAN);
     744    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_SG",   PS_META_REPLACE, "PSF FWHM Major axis (sigma)",          NAN);
     745    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_LQ",   PS_META_REPLACE, "PSF FWHM Major axis (lower quartile)", NAN);
     746    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MJ_UQ",   PS_META_REPLACE, "PSF FWHM Major axis (upper quartile)", NAN);
     747    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FWHM_MIN",   PS_META_REPLACE, "PSF FWHM Minor axis (mean)",           NAN);
     748    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_SG",   PS_META_REPLACE, "PSF FWHM Minor axis (sigma)",          NAN);
     749    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_LQ",   PS_META_REPLACE, "PSF FWHM Minor axis (lower quartile)", NAN);
     750    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_UQ",   PS_META_REPLACE, "PSF FWHM Minor axis (upper quartile)", NAN);
     751    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",      PS_META_REPLACE, "PSF angle",                            NAN);
     752    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR",   PS_META_REPLACE, "Number of stars used to make PSF", 0);
     753    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSF_OK",     PS_META_REPLACE, "Valid PSF Model?", false);
     754
    723755    psFree (fwhmMajor);
    724756    psFree (fwhmMinor);
Note: See TracChangeset for help on using the changeset viewer.