IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24695


Ignore:
Timestamp:
Jul 7, 2009, 10:32:49 AM (17 years ago)
Author:
eugene
Message:

working version of censorReadout

Location:
trunk/magic/censorObjects/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/censorObjects/src/Makefile.am

    r24692 r24695  
    3131        censorLoop.c                \
    3232        censorReadout.c             \
     33        censorErrorCodes.c          \
     34        censorVersion.c             \
    3335        censorCleanup.c
    3436
  • trunk/magic/censorObjects/src/censor.c

    r24692 r24695  
    2929
    3030    // load configuration information
    31     pmConfig *config = config = censorArguments(argc, argv);
     31    pmConfig *config = censorArguments(argc, argv);
    3232    if (!config) {
    3333        usage();
  • trunk/magic/censorObjects/src/censor.h

    r24692 r24695  
    1414# define CENSOR_H
    1515
     16# include <stdio.h>
     17# include <string.h>
     18# include <strings.h>  // for strcasecmp
     19# include <unistd.h>   // for unlink
     20# include <pslib.h>
     21# include <psmodules.h>
     22# include <ppStats.h>
    1623# include "censorErrorCodes.h"
    1724
     
    2128# define CENSOR_RECIPE "CENSOR" ///< Name of the recipe to use
    2229
     30pmConfig *censorArguments (int argc, char **argv);
    2331bool censorParseCamera (pmConfig *config);
    2432bool censorLoop (pmConfig *config);
    2533bool censorReadout (pmReadout *readout, pmConfig *config, const pmFPAview *view);
     34void censorCleanup (pmConfig *config);
    2635
    2736// Return version strings.
  • trunk/magic/censorObjects/src/censorArguments.c

    r24692 r24695  
    1111 */
    1212
    13 # include "censorStandAlone.h"
     13# include "censor.h"
    1414
    1515pmConfig *censorArguments (int argc, char **argv) {
     
    3131        return NULL;
    3232    }
    33 
    34     // save the following additional recipe values based on command-line options
    35     // these options override the CENSOR recipe values loaded from recipe files
    36     psMetadata *options = pmConfigRecipeOptions (config, CENSOR_RECIPE);
    3733
    3834    // define the input mask
  • trunk/magic/censorObjects/src/censorLoop.c

    r24692 r24695  
    6363                if (!readout->data_exists) { continue; }
    6464
    65                 if (!censorReadout (readout, recipe)) ESCAPE;
     65                if (!censorReadout (readout, config, view)) ESCAPE;
    6666
    6767                if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
  • trunk/magic/censorObjects/src/censorReadout.c

    r24692 r24695  
    11/** @file censorReadout.c
    22 *
    3  *  @brief reject detections that land within the magic mask regions
     3 *  @brief reject detections that land within the streak mask regions
    44 *
    55 *  @ingroup censor
     
    2424    }
    2525
    26     psImageMaskType magicMaskValue = pmConfigMaskGet("MAGIC", config); // Mask value for magic pixels
     26    psImageMaskType streakMaskValue = pmConfigMaskGet("STREAK", config); // Mask value for streak pixels
    2727
    2828    psLogMsg ("censor", PS_LOG_INFO, "generating a bright-star mask");
     
    3737    // XXX why not do this?
    3838    pmReadout *readoutMask = pmFPAviewThisReadout (view, inMask->fpa);
    39     if (!readoutMask) continue;
     39    if (!readoutMask) {
     40        psError(CENSOR_ERR_CONFIG, true, "Can't find mask for this readout");
     41        return false;
     42    }
    4043
    4144    // select the raw objects for this readout, flag is they fall in a mask
    4245    psArray *inSources = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.SOURCES");
    43     if (inSources == NULL) continue;
     46    if (inSources == NULL) {
     47        psError(CENSOR_ERR_CONFIG, true, "Can't find sources for this readout");
     48        return false;
     49    }
    4450               
    4551    // create a replacement output array:
    46     psArray *outSources = psAllocArrayEmpty(100);
     52    psArray *outSources = psArrayAllocEmpty(100);
    4753
    4854    // only keep sources that do not match the specified mask bit
     
    6167        if (onChip) {
    6268            psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip];
    63             if (value & magicMaskValue) {
    64                 // skip sources on magic masks
     69            if (value & streakMaskValue) {
     70                // skip sources on streak masks
    6571                continue;
    6672            }
     
    6975    }
    7076
     77    psLogMsg ("censor", PS_LOG_INFO, "keeping %ld of %ld sources", outSources->n, inSources->n);
     78
    7179    // remove the inSources and replace with the outSources
    72     psMetadataRemove (readout->analysis, "PSPHOT.SOURCES");
     80    psMetadataRemoveKey (readout->analysis, "PSPHOT.SOURCES");
    7381    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "sources", outSources);
     82    psFree (outSources);
    7483
    7584    return true;
Note: See TracChangeset for help on using the changeset viewer.