IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2009, 2:19:04 PM (16 years ago)
Author:
watersc1
Message:

Crosstalk Masking implementation, based on the rules defined by John Tonry.

File:
1 edited

Legend:

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

    r24701 r26173  
    3434    psImageMaskType spikeMaskValue = pmConfigMaskGet("SPIKE", config); // Mask value for ghost pixels
    3535    psImageMaskType starMaskValue  = pmConfigMaskGet("STARCORE", config); // Mask value for ghost pixels
    36 
     36    psImageMaskType crosstalkMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for crosstalk ghosts
     37   
    3738    // psImageMaskType maskBlank  = pmConfigMaskGet("BLANK", config); // Mask value for blank pixels
    3839
     
    4849    if (!REFSTAR_MASK) return true;
    4950
     51    // convert star positions to crosstalk artifact positions and add to the readout->analysis data
     52    bool CROSSTALK_MASK                    = psMetadataLookupBool (&status, recipe, "CROSSTALK_MASK");
     53    if (CROSSTALK_MASK && !psastroLoadCrosstalk (config)) {
     54      psError(PSASTRO_ERR_CONFIG, false, "Error loading crosstalk data");
     55      return(false);
     56    }
     57   
    5058    // convert star positions to ghost positions and add to the readout->analysis data
    5159    if (!psastroLoadGhosts (config)) {
     
    7684    double REFSTAR_MASK_BLEED_MAG_SLOPE    = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_BLEED_MAG_SLOPE");
    7785
     86    double REFSTAR_MASK_CROSSTALK_MAG_MAX  = psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_MAX");
     87    double REFSTAR_MASK_CROSSTALK_MAG_SLOPE= psMetadataLookupF32 (&status, recipe, "REFSTAR_MASK_CROSSTALK_MAG_SLOPE");
     88   
    7889    // select the input data sources
    7990    pmFPAfile *input = psMetadataLookupPtr (NULL, config->files, "PSASTRO.INPUT");
     
    201212
    202213                    if (ref->Mag > REFSTAR_MASK_MAX_MAG) continue;
     214
    203215
    204216                    // the reference magnitudes have been converted from the instrumental
     
    282294                }
    283295
     296                // Select the crosstalk artifact regions for this readout, and mask a circular region
     297                // corresponding to the source star
     298
     299                psArray *crosstalks = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.CROSSTALKS");
     300                if (crosstalks) {
     301                  for (int i = 0; i < crosstalks->n; i++) {
     302                    pmAstromObj *ref = crosstalks->data[i];
     303                    float radius = REFSTAR_MASK_CROSSTALK_MAG_SLOPE * (REFSTAR_MASK_CROSSTALK_MAG_MAX - ref->Mag);
     304                    psTrace("psastro.crosstalk",2,"Masking star on Chip %s @ (%f,%f) Magnitude: %f Radius %f\n",
     305                            psMetadataLookupStr(&status,readout->parent->parent->concepts,"CHIP.NAME"),
     306                            ref->chip->x,ref->chip->y,ref->Mag,radius);
     307                    // XXX for now, assume cell binning is 1x1 relative to chip
     308                    psastroMaskCircle (readoutMask->mask, crosstalkMaskValue, ref->chip->x, ref->chip->y, radius, radius);
     309                  }
     310                }
     311               
    284312                // this probably should move into a function of its own:
    285313                {
Note: See TracChangeset for help on using the changeset viewer.