IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 13, 2020, 2:48:11 PM (6 years ago)
Author:
tdeboer
Message:

adding detections to crosstalk and ghost masking

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroConvert.c

    r41367 r41434  
    1414// leak free 2006.04.27
    1515
     16// To select good stars, I want them to have a PSFmodel fit (PM_SOURCE_MODE_PSFMODEL & PM_SOURCE_MODE_FITTED) and exlcude things that are CR, EXT, FAIL, POOR
     17// Stars are allowed to be saturated, as long as the PSF model fits
     18# define PHOT_SOURCE_MASK (PM_SOURCE_MODE_FAIL | PM_SOURCE_MODE_BLEND | PM_SOURCE_MODE_BADPSF | \
     19                           PM_SOURCE_MODE_DEFECT | PM_SOURCE_MODE_CR_LIMIT | PM_SOURCE_MODE_EXT_LIMIT | \
     20                           PM_SOURCE_MODE_POOR) // Mask to apply to sources for rejection
     21
    1622static psArray *chooseStars(psArray *inStars, char *listName, psArray *sources, psVector *index, int nMax, float iMagMin, float iMagMax, pmSourceMode skip);
    1723
     
    142148        }
    143149    }
     150
     151    //also select a sample of stars which are allowed to be saturated and bright, as long as they are well fit by a PSF model
     152    int j = 0;
     153    psArray *calStars = psArrayAlloc(inStars->n);
     154
     155    for (int i = 0; (i < inStars->n) && (j < rawStars->n); i++) {
     156        int n = index->data.S32[i];
     157        pmSource *source = sources->data[n];
     158
     159        // we only want to use stars which are not bad. Use the source->mode to check for the rejection mask while keeping fitted PSFmodel
     160        if (source->mode & PHOT_SOURCE_MASK || !isfinite(source->psfMag)) {
     161            continue;
     162        }
     163
     164        //Ensure the source has a fitted PSF model
     165        if (!(source->mode & PM_SOURCE_MODE_PSFMODEL) || !(source->mode & PM_SOURCE_MODE_FITTED) ) {
     166            continue;
     167        }
     168
     169        calStars->data[j] = psMemIncrRefCounter (inStars->data[n]);
     170        j++;
     171    }
     172    calStars->n = j;
     173    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.CALSTARS", PS_DATA_ARRAY, "astrometry objects for masking", calStars);
    144174
    145175    psFree (index);
Note: See TracChangeset for help on using the changeset viewer.