IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21235


Ignore:
Timestamp:
Jan 29, 2009, 5:29:04 PM (17 years ago)
Author:
Paul Price
Message:

Merging in mainline so that problems with mask and PSF can be dealt with --- I think I branched while the mainline was in the process of being updated.

Location:
branches/pap_branch_20090128/pswarp/src
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090128/pswarp/src/pswarpDefineSkycell.c

    r21225 r21235  
    5959    psFitsClose(fits);
    6060
    61     // XXX format needs to be equivalent to SIMPLE
    62     // determine the current format from the header
    63     // determine camera if not specified already
     61    // We need to force the format for the skycell to be equivalent to SIMPLE.  Determine
     62    // the current format from the header; Determine camera if not specified already
    6463    // XXX EAM : this operation should be defined as a pmConfig function (pmConfigCopy?)
    6564    skyConfig = pmConfigAlloc();
  • branches/pap_branch_20090128/pswarp/src/pswarpLoop.c

    r21234 r21235  
    11#include "pswarp.h"
    22#include <ppStats.h>
     3#include "pswarpFileNames.h"            // Lists of file rules used at different stages
    34
    45#define WCS_NONLIN_TOL 0.001            // Non-linear tolerance for header WCS
    5 #define PSPHOT_FIND_PSF 0               // Use psphot's findPSF function?
    6 //#define TESTING 1                       // Testing output?
    7 
    8 // Lists of file rules for the detectors and skycells, and an independent list of everything else
    9 // Lists must end with a NULL
    10 static char *detectorFiles[] = { "PSWARP.INPUT", "PSWARP.MASK", "PSWARP.VARIANCE", NULL };
    11 static char *skycellFiles[] = { "PSWARP.OUTPUT", "PSWARP.OUTPUT.MASK", "PSWARP.OUTPUT.VARIANCE", NULL };
    12 static char *photFiles[] = { "PSPHOT.INPUT", "PSPHOT.OUTPUT",
    13 #if PSPHOT_FIND_PSF
    14                              "PSPHOT.INPUT.CMF",
    15 #endif
    16                              "PSPHOT.RESID",
    17                              "PSPHOT.BACKMDL", "PSPHOT.BACKMDL.STDEV", "PSPHOT.BACKGND", "PSPHOT.BACKSUB",
    18                              "PSPHOT.PSF.SAVE", "SOURCE.PLOT.MOMENTS", "SOURCE.PLOT.PSFMODEL",
    19                              "SOURCE.PLOT.APRESID", NULL };
    20 static char *independentFiles[] = { "PSWARP.ASTROM", // Read independently from the input pixels
    21                                     "PSWARP.SKYCELL", // Don't care about the skycell once we have its WCS
    22                                     "PSWARP.OUTPUT.SOURCES", // Save these independently so we can do the PSF
    23                                     NULL };
    24 
     6#define PSPHOT_FIND_PSF 1               // Use psphot's findPSF function?
     7#define TESTING 0                       // Testing output?
     8
     9
     10// XXX these are generic functions which should be moved to psModules
    2511// Activate a list of files
    2612static void fileActivation(pmConfig *config, // Configuration
     
    8066
    8167    // output mask bits
    82     psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");
     68    psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT");
    8369    psAssert (status, "MASK.OUTPUT was not defined");
    8470
     
    141127
    142128    // Read the input astrometry
     129    // XXX rather than use the activations here, this should just explicitly loop over the desired filerule
    143130    {
    144131        pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
     
    373360        pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa);
    374361        float vf = psMetadataLookupF32(NULL, photRO->parent->concepts, "CELL.VARFACTOR"); // Variance factor
    375         psBinaryOp(photRO->weight, photRO->weight, "*", psScalarAlloc(vf, PS_TYPE_F32));
     362        psBinaryOp(photRO->variance, photRO->variance, "*", psScalarAlloc(vf, PS_TYPE_F32));
    376363
    377364        if (!psphotReadoutFindPSF(config, view)) {
     
    386373#endif
    387374
    388 #ifdef TESTING
     375#if (TESTING)
    389376        {
    390377            #define PSF_SIZE 20         // Half-size of PSF
  • branches/pap_branch_20090128/pswarp/src/pswarpPixelFraction.c

    r18558 r21235  
    2020    PS_ASSERT_IMAGE_NON_NULL(readout->mask, false);
    2121    PS_ASSERT_IMAGES_SIZE_EQUAL(readout->mask, readout->image, false);
    22     PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_MASK, false);
     22    PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_IMAGE_MASK, false);
    2323
    2424    if (stats) {
     
    4040
    4141    // output mask bits
    42     psMaskType maskValue = psMetadataLookupU8(&status, recipe, "MASK.OUTPUT");
     42    psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT");
    4343    psAssert (status, "MASK.OUTPUT was not defined");
    4444
     
    5555    for (int y = 0; y < numRows; y++) {
    5656        for (int x = 0; x < numCols; x++) {
    57             if (mask->data.PS_TYPE_MASK_DATA[y][x] & maskValue) {
     57            if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValue) {
    5858                numBad++;
    5959            } else {
  • branches/pap_branch_20090128/pswarp/src/pswarpSetMaskBits.c

    r21225 r21235  
    88// updated in the config metadata.
    99
    10 bool pswarpSetMaskBits (pmConfig *config)
    11 {
    12     psImageMaskType maskIn = 0x00;      // mask for the input image
    13     psImageMaskType markIn = 0x00;      // mark for the input image
    14     psImageMaskType maskOut = 0x00;     // mask for the output image
    15     psImageMaskType markOut = 0x00;     // mark for the output image
     10bool pswarpSetMaskBits (pmConfig *config) {
     11
     12    psImageMaskType maskIn = 0x00;                      // mask for the input image
     13    psImageMaskType markIn = 0x00;                      // mark for the input image
     14    psImageMaskType maskOut = 0x00;                     // mask for the output image
    1615
    1716    // this function sets the required single-image mask bits
     
    2221
    2322    // mask for non-linear flat regions (default to DETECTOR if not defined)
    24     psMaskType badMask = pmConfigMaskGet("BAD.WARP", config);
     23    psImageMaskType badMask = pmConfigMaskGet("BAD.WARP", config);
    2524    if (!badMask) {
    2625        badMask = 0x01;
     
    3029
    3130    // mask for non-linear flat regions (default to DETECTOR if not defined)
    32     psMaskType poorMask = pmConfigMaskGet("POOR.WARP", config);
     31    psImageMaskType poorMask = pmConfigMaskGet("POOR.WARP", config);
    3332    if (!poorMask) {
    3433        poorMask = 0x02;
     
    3837
    3938    // search for an unset bit to use for MARK:
    40     markOut = 0x80;
     39    psImageMaskType markOut   = 0x00;
     40    psImageMaskType markTrial = 0x01;
    4141
    42     int nBits = sizeof(psMaskType) * 8;
     42    int nBits = sizeof(psImageMaskType) * 8;
    4343    for (int i = 0; !markOut && (i < nBits); i++) {
    44         if (maskOut & markOut) {
    45             markOut >>= 1;
     44        if (maskOut & markTrial) {
     45            markTrial <<= 1;
    4646        } else {
    47             markOut = markOut;
     47            markOut = markTrial;
    4848        }
    4949    }
    50 
    5150    if (!markOut) {
    5251        psError (PS_ERR_UNKNOWN, true, "Unable to define the MARK bit mask: all bits taken!");
     
    6362    // set maskOut and markOut in the psphot recipe
    6463    // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here
    65     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MASK.INPUT",  PS_META_REPLACE, "user-defined mask", maskIn);
    66     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MARK.INPUT",  PS_META_REPLACE, "user-defined mask", markIn);
    67     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);
    68     psMetadataAddU8 (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);
     64    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.INPUT",  PS_META_REPLACE, "user-defined mask", maskIn);
     65    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.INPUT",  PS_META_REPLACE, "user-defined mask", markIn);
     66    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MASK.OUTPUT", PS_META_REPLACE, "user-defined mask", maskOut);
     67    psMetadataAddImageMask (warpRecipe, PS_LIST_TAIL, "MARK.OUTPUT", PS_META_REPLACE, "user-defined mask", markOut);
    6968
    7069    // update the psphot recipe
     
    7776    // set maskOut and markOut in the psphot recipe
    7877    // NOTE: psphot works on the output images, not input images, so set the MARK and MASK correctly here
    79     psMetadataAddU8 (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);
    80     psMetadataAddU8 (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);
     78    psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MARK.PSPHOT", PS_META_REPLACE, "user-defined mask", markOut);
     79    psMetadataAddImageMask (psphotRecipe, PS_LIST_TAIL, "MASK.PSPHOT", PS_META_REPLACE, "user-defined mask", maskOut);
    8180
    8281    return true;
  • branches/pap_branch_20090128/pswarp/src/pswarpTransformReadout.c

    r21233 r21235  
    2222
    2323    // output mask bits
    24     psMaskType maskIn   = psMetadataLookupU8(&mdok, recipe, "MASK.INPUT");
    25     psMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
    26     psMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
     24    psImageMaskType maskIn   = psMetadataLookupImageMask(&mdok, recipe, "MASK.INPUT");
     25    psImageMaskType maskPoor = pmConfigMaskGet("POOR.WARP", config);
     26    psImageMaskType maskBad  = pmConfigMaskGet("BAD.WARP", config);
    2727    psAssert(mdok, "MASK.INPUT was not defined");
    2828
     
    8080    }
    8181    if ((input->mask || maskPoor || maskBad) && !output->mask) {
    82         output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_MASK);
     82        output->mask = psImageAlloc(output->image->numCols, output->image->numRows, PS_TYPE_IMAGE_MASK);
    8383        psImageInit(output->mask, maskBad);
    8484    }
  • branches/pap_branch_20090128/pswarp/src/pswarpTransformTile.c

    r21225 r21235  
    4949    psF32 **outImageData     = args->output->image->data.F32;
    5050    psF32 **outVarData       = (args->output->variance) ? args->output->variance->data.F32 : NULL;
    51     psMaskType **outMaskData = (args->output->mask)   ? args->output->mask->data.PS_TYPE_MASK_DATA : NULL;
    52     psMaskType **inMaskData  = (args->input->mask)    ? args->input->mask->data.PS_TYPE_MASK_DATA : NULL;
     51    psImageMaskType **outMaskData = (args->output->mask)   ? args->output->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
     52    psImageMaskType **inMaskData  = (args->input->mask)    ? args->input->mask->data.PS_TYPE_IMAGE_MASK_DATA : NULL;
    5353
    5454    pswarpMap *map = args->grid->maps[args->gridX][args->gridY]; // Map for this tile
     
    6767
    6868            // Only transform those pixels requested
    69             if (region && region->data.U8[y][x]) {
     69            if (region && region->data.PS_TYPE_IMAGE_MASK_DATA[y][x]) {
    7070                continue;
    7171            }
Note: See TracChangeset for help on using the changeset viewer.