IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 23, 2020, 3:29:09 PM (6 years ago)
Author:
tdeboer
Message:

added procedure to remove pixel NaNing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO_Ghosts.c

    r41367 r41382  
    5555#include "pmAstrometryWCS.h"
    5656
    57 # include "psastroInternal.h"
     57# include "pmSourceInternal.h"
    5858static psVector *chipXmin = NULL;
    5959static psVector *chipXmax = NULL;
     
    6868    md = psMetadataLookupMetadata (&status, ghostModel, NAME); \
    6969    if (!md) { \
    70         psError(PSASTRO_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
     70        psError(PM_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
    7171        goto escape; \
    7272    } \
    7373    OUT = psPolynomial2DfromMetadata(md); \
    7474    if (!OUT) { \
    75         psError(PSASTRO_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
     75        psError(PM_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
    7676        goto escape; \
    7777    }
     
    8080    md = psMetadataLookupMetadata (&status, ghostModel, NAME); \
    8181    if (!md) { \
    82         psError(PSASTRO_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
     82        psError(PM_ERR_CONFIG, true, "Missing %s in model file %s", NAME, ghostFile); \
    8383        goto escape; \
    8484    } \
    8585    OUT = psPolynomial1DfromMetadata(md);       \
    8686    if (!OUT) { \
    87         psError(PSASTRO_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
     87        psError(PM_ERR_CONFIG, true, "Trouble interpretting %s in model file %s", NAME, ghostFile); \
    8888        goto escape; \
    8989    }
     
    116116    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
    117117    if (!recipe) {
    118         psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
     118        psError(PM_ERR_CONFIG, true, "Can't find PSASTRO recipe");
    119119        return false;
    120120    }
     
    129129
    130130    if (!pmConfigFileRead (&ghostModel, ghostFile, "GHOST MODEL")) {
    131         psError(PSASTRO_ERR_CONFIG, true, "Trouble loading ghost model");
     131        psError(PM_ERR_CONFIG, true, "Trouble loading ghost model");
    132132        return false;
    133133    }
     
    156156    pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    157157    if (!astrom) {
    158         psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     158        psError(PM_ERR_CONFIG, true, "Can't find input data");
    159159        goto escape;
    160160    }
     
    162162
    163163    // really error-out here?  or just skip?
    164     if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
     164    if (!pmSourceZeroPointFromRecipeGlint (&zeropt, &exptime, &MAX_MAG,NULL, fpa_ast, recipe)) {
    165165        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    166166        goto escape;
     
    202202                        if (ref->Mag > MAX_MAG) continue;
    203203
    204                         psastroGhost *ghost = psastroGhostAlloc ();
     204                        pmSourceGhost *ghost = pmSourceGhostAlloc ();
    205205                        ghost->srcFP->x = ref->FP->x;
    206206                        ghost->srcFP->y = ref->FP->y;
     
    239239                        // XXX this code yields a single chip: we need to provide results for any chips
    240240                        // which encompass the full size of the ghost
    241                         pmChip *ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y);
    242                         ghostChip = psastroFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
     241                        pmChip *ghostChip = pmSourceFindChip (&ghost->chip->x, &ghost->chip->y, fpa, -ghost->srcFP->x, -ghost->srcFP->y);
     242                        ghostChip = pmSourceFindChip (&ghost->chip->x, &ghost->chip->y, fpa, ghost->FP->x, ghost->FP->y);
    243243
    244244                        //do a rudimentary check of whether the ghost is on the pixel FPA
     
    331331}
    332332
    333 static void psastroGhostFree (psastroGhost *ghost) {
     333static void pmSourceGhostFree (pmSourceGhost *ghost) {
    334334
    335335    if (ghost == NULL) return;
     
    342342}
    343343
    344 psastroGhost *psastroGhostAlloc (void) {
    345 
    346     psastroGhost *ghost = (psastroGhost *) psAlloc(sizeof(psastroGhost));
    347     psMemSetDeallocator(ghost, (psFreeFunc) psastroGhostFree);
     344pmSourceGhost *pmSourceGhostAlloc (void) {
     345
     346    pmSourceGhost *ghost = (pmSourceGhost *) psAlloc(sizeof(pmSourceGhost));
     347    psMemSetDeallocator(ghost, (psFreeFunc) pmSourceGhostFree);
    348348
    349349    ghost->srcFP = psPlaneAlloc();
     
    365365
    366366
    367 bool psastroChipBounds (pmFPA *fpa) {
     367bool pmSourceChipBounds (pmFPA *fpa) {
    368368
    369369    chipXmin = psVectorAlloc (fpa->chips->n, PS_TYPE_F32);
     
    416416}
    417417
    418 pmChip *psastroFindChip (double *xChip, double *yChip, pmFPA *fpa, double xFPA, double yFPA) {
     418pmChip *pmSourceFindChip (double *xChip, double *yChip, pmFPA *fpa, double xFPA, double yFPA) {
    419419
    420420    *xChip = NAN;
     
    422422
    423423    if (!chipXmin) {
    424         psastroChipBounds (fpa);
     424        pmSourceChipBounds (fpa);
    425425    }
    426426
     
    458458
    459459// identify chips which land on this column (FP coords)
    460 bool psastroFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
     460bool pmSourceFindChipInXrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
    461461
    462462    if (!chipXmin || !chipXmax) {
     
    470470
    471471// identify chips which land on this row (FP coords)
    472 bool psastroFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
     472bool pmSourceFindChipInYrange (pmFPA *fpa, int nChip, double xFPA, double yFPA) {
    473473
    474474    if (!chipYmin || !chipYmax) {
     
    482482
    483483// return the FPA coordinates of the Y edges of the chip
    484 bool psastroFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
     484bool pmSourceFindChipYedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
    485485
    486486    *yFPAs = chipYmin->data.F32[nChip];
     
    490490
    491491// return the FPA coordinates of the X edges of the chip
    492 bool psastroFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
     492bool pmSourceFindChipXedges (double *yFPAs, double *yFPAe, pmFPA *fpa, int nChip) {
    493493
    494494    *yFPAs = chipXmin->data.F32[nChip];
     
    498498
    499499// convert FPA to Chip coordinates
    500 bool psastroFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA) {
     500bool pmSourceFPAtoChip (double *xChip, double *yChip, pmFPA *fpa, int nChip, double xFPA, double yFPA) {
    501501
    502502    pmChip *chip = fpa->chips->data[nChip];
     
    512512}
    513513
    514 bool psastroExtractFreeChipBounds () {
     514bool pmSourceExtractFreeChipBounds () {
    515515 
    516516  psFree (chipXmin);
Note: See TracChangeset for help on using the changeset viewer.