IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 41382


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

added procedure to remove pixel NaNing

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippconfig/recipes/ppImage.config

    r41372 r41382  
    2020AUX.VIDEO.MASK     STR     NULL            # name of aditional masking for video cells
    2121APPLY.BURNTOOL     BOOL    FALSE           # apply burntool coorection
     22APPLY.PIXELZERO    BOOL    TRUE            # apply zero'ing of pixels underneath masks
    2223VARIANCE.BUILD     BOOL    FALSE           # Build internal variance image
    2324ADDNOISE           BOOL    FALSE           # Add noise to degrade an MD image to a 3pi image?
  • trunk/ippconfig/recipes/ppSub.config

    r40603 r41382  
    1717NORM.FRAC       F32     0.02            # Fraction of window for normalisation window
    1818COVAR.FRAC      F32     0.01            # Fraction of kernel to truncate before calculating covariance
     19APPLY.PIXELNAN  BOOL    TRUE            # Apply NAN'ing of pixels underneath masks
    1920
    2021MASK.VAL        STR     MASK.VALUE,CONV.BAD     # Mask value for input
  • trunk/ippconfig/recipes/pswarp.config

    r40802 r41382  
    1212PSF                     BOOL    TRUE            # Measure PSF for warped image?
    1313SOURCES                 BOOL    TRUE            # Write source list for warped image?
     14APPLY.PIXELNAN          BOOL    TRUE            # Apply NAN'ing of pixels underneath masks
    1415
    1516NO.COMPRESS             BOOL    FALSE           # turn off image compression (if enabled)
  • trunk/ppImage/src/ppImage.h

    r40453 r41382  
    2828    bool doVarianceBuild;               // Build internal variance map
    2929    bool doApplyBurntool;               // apply burntool correction
     30    bool doApplyPixelZero;              // put to zero pixels underneath mask
    3031    bool doMaskBurntool;                // mask potential burntool trails
    3132    bool doMaskSat;                     // mask saturated pixels
  • trunk/ppImage/src/ppImageOptions.c

    r38233 r41382  
    5353    options->useVideoDark    = false;   // Use video dark if we can?
    5454    options->useVideoMask    = false;   // Use video mask if we can?
     55    options->doApplyPixelZero  = true;   // option for zero'ing pixels under masks
     56
    5557    // output files requested
    5658    options->BaseFITS        = false;   // create output image
     
    234236    options->doMaskBurntool  = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL");
    235237    options->doApplyBurntool = psMetadataLookupBool(NULL, recipe, "APPLY.BURNTOOL");
     238    //TdB: read in switch for zero'ing pixels under masks
     239    options->doApplyPixelZero = psMetadataLookupBool(NULL, recipe, "APPLY.PIXELZERO");
    236240    options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD");
    237241    options->doAuxMask       = psMetadataLookupBool(NULL, recipe, "MASK.AUXMASK");
     
    245249        }
    246250    }
     251
    247252
    248253    // Mask recipe options (note that mask bit values are set in ppImageSetMaskBits.c)
  • trunk/ppImage/src/ppImageReplaceBackground.c

    r26895 r41382  
    144144    for (int y = 0; y < numRows; y++) {
    145145        for (int x = 0; x < numCols; x++) {
    146             if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
    147                 image->data.F32[y][x] = 0.0;
     146            if(options->doApplyPixelZero) {
     147              if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
     148                  image->data.F32[y][x] = 0.0;
     149              } else {
     150                float value = backData[y][x];
     151                if (!isfinite(value)) {
     152                    image->data.F32[y][x] = NAN;
     153                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     154                } else {
     155                    image->data.F32[y][x] -= value;
     156                }
     157              }
    148158            } else {
    149159                float value = backData[y][x];
     
    154164                    image->data.F32[y][x] -= value;
    155165                }
    156             }
     166            }
    157167        }
    158168    }
     
    162172    for (int y = 0; y < numRows; y++) {
    163173        for (int x = 0; x < numCols; x++) {
    164             if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
    165                 image->data.F32[y][x] = 0.0;
     174            if(options->doApplyPixelZero) {
     175              if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskVal) {
     176                  image->data.F32[y][x] = 0.0;
     177              } else {
     178                float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelRO->image, binning); // Background value
     179                if (!isfinite(value)) {
     180                    image->data.F32[y][x] = NAN;
     181                    mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] |= options->lowMask;
     182                } else {
     183                    image->data.F32[y][x] -= value;
     184                }
     185              }
    166186            } else {
    167187                float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelRO->image, binning); // Background value
  • trunk/ppSub/src/ppSub.h

    r31156 r41382  
    190190void ppSubSetThreads (void);
    191191
     192// ppSubMaskSetInMetadata examines named mask values and set the bits for maskValue and
     193// markValue.  Ensures that the below-named mask values are set, and calculates the mask value
     194// to catch all of the mask values marked as 'bad'.  Supplies the fallback name if the primary
     195// name is not found, or the default values if the fallback name is not found.
     196bool ppSubMaskSetInMetadata(psImageMaskType *outMaskValue, // Value of MASK.VALUE, returned
     197                               psImageMaskType *outMarkValue, // Value of MARK.VALUE, returned
     198                               psMetadata *source  // Source of mask bits
     199  );
     200
     201// lookup an image mask value by name from a psMetadata, without requiring the entry to
     202// be of type psImageMaskType, but verifying that it will fit in psImageMaskType
     203psImageMaskType psMetadataLookupImageMaskFromGeneric (bool *status, const psMetadata *md, const char *name);
     204
    192205///@}
    193206#endif
  • trunk/ppSub/src/ppSubBackground.c

    r29937 r41382  
    3333    psAssert(psphotRecipe, "Need PSPHOT recipe for binning");
    3434
     35    bool doApplyMaskNaN = psMetadataLookupBool(&mdok, ppSubRecipe, "APPLY.PIXELNAN"); // NaN the pixels underneath masks
     36
    3537    psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask
    3638
     
    6466        for (int x = 0; x < numCols; x++) {
    6567            // special case 1: NAN the masked pixels
    66             if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskBad) {
     68            if(doApplyMaskNaN) {
     69              if (mask && mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskBad) {
    6770                image->data.F32[y][x] = NAN;
    6871                continue;
    69             }
    70             // special case 1: NAN & mask pixels without a valid background model
     72              }
     73            }
     74            // special case 2: NAN & mask pixels without a valid background model
    7175            float value = psImageUnbinPixel(x + 0.5, y + 0.5, modelImage, binning); // Background value
    7276            if (!isfinite(value)) {
  • trunk/ppSub/src/ppSubReadoutSubtract.c

    r31435 r41382  
    3333    bool noConvolve = psMetadataLookupBool(&mdok, recipe, "NOCONVOLVE"); // Do not use convolved images.
    3434    bool addPair = psMetadataLookupBool(&mdok, recipe, "ADD.NOT.SUBTRACT"); // add instead of subtracting
     35    bool doApplyMaskNaN = psMetadataLookupBool(&mdok, recipe, "APPLY.PIXELNAN"); // NaN the pixels underneath masks
    3536
    3637    pmFPAview *view = ppSubViewReadout(); // View to readout
     
    7374    // NAN the masked pixels in the diff image (pixels masked in A are not yet NAN'ed in B)
    7475    psImageMaskType maskVal = pmConfigMaskGet("MASK.VALUE", config) | pmConfigMaskGet("BLANK", config); // Bits to mask in inputs
    75     for (int iy = 0; iy < outRO->image->numRows; iy++) {
     76    if(doApplyMaskNaN) {
     77      for (int iy = 0; iy < outRO->image->numRows; iy++) {
    7678        for (int ix = 0; ix < outRO->image->numCols; ix++) {
    7779            if ((outRO->mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) == 0) continue;
    7880            outRO->image->data.F32[iy][ix] = NAN;
    7981        }
     82      }
    8083    }
    8184
  • trunk/ppSub/src/ppSubSetMasks.c

    r30619 r41382  
    2222#include "ppSub.h"
    2323
     24// Structure to hold the properties of a mask value
     25typedef struct {
     26    char *badMaskName;                  // name for "bad" (i.e., mask me please) pixels
     27    char *fallbackName;                 // Fallback name in case a bad mask name is not defined
     28    psImageMaskType defaultMaskValue;   // Default value in case a bad mask name and its fallback are not defined
     29    bool isBad; // include this value as part of the MASK.VALUE entry (generically bad)
     30} pmConfigMaskInfo;
     31
     32static pmConfigMaskInfo skycellmasks[] = {
     33    // Features of the detector
     34    { "DETECTOR",  NULL,       0x01, false }, // Something is wrong with the detector
     35    { "FLAT",      "DETECTOR", 0x01, false }, // Pixel doesn't flat-field properly
     36    { "DARK",      "DETECTOR", 0x01, false }, // Pixel doesn't dark-subtract properly
     37    { "BLANK",     "DETECTOR", 0x01, true }, // Pixel doesn't contain valid data
     38    { "CTE",       "DETECTOR", 0x01, false }, // Pixel has poor CTE
     39    { "BURNTOOL",  NULL,       0x04, false }, // Pixel has been touched by burntool
     40    // Invalid signal ranges
     41    { "SAT",       NULL,       0x02, true  }, // Pixel is saturated or non-linear
     42    { "LOW",       "SAT",      0x02, true  }, // Pixel is low
     43    { "SUSPECT",   NULL,       0x04, false }, // Pixel is suspected of being bad
     44    // Non-astronomical structures
     45    { "CR",        NULL,       0x08, true  }, // Pixel contains a cosmic ray
     46    { "SPIKE",     NULL,       0x08, false  }, // Pixel contains a diffraction spike
     47    { "GHOST",     NULL,       0x08, false  }, // Pixel contains an optical ghost
     48    { "STREAK",    NULL,       0x08, false  }, // Pixel contains streak data
     49    { "STARCORE",  NULL,       0x08, false  }, // Pixel contains a bright star core
     50    // Effects of convolution and interpolation
     51    { "CONV.BAD",  NULL,       0x02, true  }, // Pixel is bad after convolution with a bad pixel
     52    { "CONV.POOR", NULL,       0x04, false }, // Pixel is poor after convolution with a bad pixel
     53};
     54
    2455bool ppSubSetMasks(pmConfig *config)
    2556{
    2657    psAssert(config, "Require configuration");
    2758
    28     psImageMaskType maskValue, markValue; // Mask values
    29     if (!pmConfigMaskSetBits(&maskValue, &markValue, config)) {
    30         psError(PPSUB_ERR_CONFIG, false, "Unable to determine mask value.");
    31         return false;
    32     }
    33 
    34     // Set the mask bits needed by psphot (in psphot recipe)
    35     psphotSetMaskRecipe(config, maskValue, markValue);
    36 
    3759    // Look up recipe values
    3860    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    3961    psAssert(recipe, "We checked this earlier, so it should be here.");
     62    bool doApplyMaskNaN = psMetadataLookupBool(NULL, recipe, "APPLY.PIXELNAN"); // NaN the pixels underneath masks
     63
     64    psImageMaskType maskValue, markValue; // Mask values
     65    if(doApplyMaskNaN) {
     66      if (!pmConfigMaskSetBits(&maskValue, &markValue, config)) {
     67          psError(PPSUB_ERR_CONFIG, false, "Unable to determine mask value.");
     68          return false;
     69      }
     70    } else {
     71      psMetadata *maskrecipe = psMetadataLookupMetadata(NULL, config->recipes, "MASKS"); // The recipe
     72      if (!maskrecipe) {
     73          psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find MASKS recipe.");
     74          return false;
     75      }
     76      if (!ppSubMaskSetInMetadata(&maskValue, &markValue, maskrecipe)) {
     77          psError(PPSUB_ERR_CONFIG, false, "Unable to determine mask value.");
     78          return false;
     79      }
     80    }
     81
     82    // Set the mask bits needed by psphot (in psphot recipe)
     83    psphotSetMaskRecipe(config, maskValue, markValue);
     84
    4085
    4186    psImageMaskType satValue = pmConfigMaskGet("SAT", config);
     
    121166    return true;
    122167}
     168
     169bool ppSubMaskSetInMetadata(psImageMaskType *outMaskValue, // Value of MASK.VALUE, returned
     170                               psImageMaskType *outMarkValue, // Value of MARK.VALUE, returned
     171                               psMetadata *source  // Source of mask bits
     172    )
     173{
     174    PS_ASSERT_METADATA_NON_NULL(source, false);
     175
     176    // Ensure all the bad mask names exist, and set the value to catch all bad pixels
     177    psImageMaskType maskValue = 0;           // Value to mask to catch all the bad pixels
     178    psImageMaskType allMasks = 0;            // Value to mask to catch all masked bits (to set MARK)
     179
     180    int nMasks = sizeof (skycellmasks) / sizeof (pmConfigMaskInfo);
     181
     182    for (int i = 0; i < nMasks; i++) {
     183        bool mdok;                      // Status of MD lookup
     184        psImageMaskType value = psMetadataLookupImageMaskFromGeneric(&mdok, source, skycellmasks[i].badMaskName); // Value of mask
     185        if (!mdok) {
     186            psWarning ("problem with mask value %s\n", skycellmasks[i].badMaskName);
     187        }
     188
     189        if (!value) {
     190            if (skycellmasks[i].fallbackName) {
     191                value = psMetadataLookupImageMaskFromGeneric(&mdok, source, skycellmasks[i].fallbackName);
     192            }
     193            if (!value) {
     194                value = skycellmasks[i].defaultMaskValue;
     195            }
     196            psMetadataAddImageMask(source, PS_LIST_TAIL, skycellmasks[i].badMaskName, PS_META_REPLACE, NULL, value);
     197        }
     198        if (skycellmasks[i].isBad) {
     199            maskValue |= value;
     200        }
     201        allMasks |= value;
     202    }
     203
     204    // search for an unset bit to use for MARK:
     205    psImageMaskType markValue = 0x00;
     206    psImageMaskType markTrial = 0x01;
     207
     208    int nBits = sizeof(psImageMaskType) * 8;
     209    for (int i = 0; !markValue && (i < nBits); i++) {
     210        if (allMasks & markTrial) {
     211            markTrial <<= 1;
     212        } else {
     213            markValue = markTrial;
     214        }
     215    }
     216    if (!markValue) {
     217        psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");
     218        return false;
     219    }
     220
     221    // update the list with the results
     222    psMetadataAddImageMask(source, PS_LIST_TAIL, "MASK.VALUE", PS_META_REPLACE, NULL, maskValue);
     223    psMetadataAddImageMask(source, PS_LIST_TAIL, "MARK.VALUE", PS_META_REPLACE, NULL, markValue);
     224
     225    if (outMaskValue) {
     226        *outMaskValue = maskValue;
     227    }
     228    if (outMarkValue) {
     229        *outMarkValue = markValue;
     230    }
     231
     232    return true;
     233}
     234
  • trunk/psModules/src/objects/pmSourceIO.h

    r41367 r41382  
    9191bool pmSourceIO_ReadMatchedRefs (psFits *fits, pmFPA *fpa, const pmConfig *config);
    9292
    93 bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe);
     93bool pmSourceZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe);
    9494bool pmSourceIO_WriteGlints (psFits *fits, pmFPA *fpa, pmConfig *config);
    9595bool pmSourceIO_WriteGhosts (psFits *fits, pmFPA *fpa, pmConfig *config);
  • 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);
  • trunk/psModules/src/objects/pmSourceIO_Glints.c

    r41367 r41382  
    5555#include "pmAstrometryWCS.h"
    5656
    57 # include "psastroInternal.h"
     57# include "pmSourceInternal.h"
    5858
    5959# define ESCAPE(MSG) { \
     
    7171    psMetadata *recipe  = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE);
    7272    if (!recipe) {
    73         psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe");
     73        psError(PM_ERR_CONFIG, true, "Can't find PSASTRO recipe");
    7474        return false;
    7575    }
     
    110110    pmFPAfile *astrom = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
    111111    if (!astrom) {
    112         psError(PSASTRO_ERR_CONFIG, true, "Can't find input data");
     112        psError(PM_ERR_CONFIG, true, "Can't find input data");
    113113        return false;
    114114    }
     
    117117    // use the zero point and exposure time to convert to apparent mags: M_ap = M_inst + C_0 + 2.5*log(exptime)
    118118    pmFPA *fpa_ast = astrom->fpa;
    119     if (!psastroZeroPointFromRecipeGlint (&zeropt, &exptime, NULL,&GLINT_MAX_MAG, fpa_ast, recipe)) {
     119    if (!pmSourceZeroPointFromRecipeGlint (&zeropt, &exptime, NULL,&GLINT_MAX_MAG, fpa_ast, recipe)) {
    120120        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    121121        return false;
     
    237237}
    238238
    239 bool psastroZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) {
     239bool pmSourceZeroPointFromRecipeGlint (float *zeropt, float *exptime, float *ghostMaxMag, double *glintMaxMag, pmFPA *fpa, psMetadata *recipe) {
    240240
    241241    bool status;
  • trunk/pswarp/src/pswarpTransformReadout.c

    r35563 r41382  
    2727    int nGridX = psMetadataLookupS32(NULL, config->arguments, "GRID.NX"); ///< Number of grid points in x
    2828    int nGridY = psMetadataLookupS32(NULL, config->arguments, "GRID.NY"); ///< Number of grid points in y
     29    bool doApplyMaskNaN = psMetadataLookupBool(NULL, config->arguments, "APPLY.PIXELNAN"); ///NaN the pixels underneath masks
     30
    2931    psImageInterpolateMode interpolationMode = psMetadataLookupS32(NULL, config->arguments,
    3032                                                                   "INTERPOLATION.MODE"); ///< Mode for interp
     
    3739
    3840    // output mask bits
    39     psImageMaskType maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
     41    psImageMaskType maskIn   = 0 ;
     42    if(doApplyMaskNaN) {
     43      maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
     44      psAssert(mdok, "MASK.INPUT was not defined");
     45    }
    4046    psImageMaskType maskPoor = pmConfigMaskGet("CONV.POOR", config);
    4147    if (!maskPoor) {
     
    4652        maskBad  = pmConfigMaskGet("BAD.WARP", config);
    4753    }
    48     psAssert(mdok, "MASK.INPUT was not defined");
    4954
    5055    if (!input->covariance) {
Note: See TracChangeset for help on using the changeset viewer.