IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 2, 2009, 3:42:20 PM (17 years ago)
Author:
eugene
Message:

add glint masking; filter-based ghost max mag

File:
1 edited

Legend:

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

    r23844 r24652  
    2828    pmCell *cell = NULL;
    2929    pmReadout *readout = NULL;
    30     float zeropt, exptime;
     30    float zeropt, exptime, GHOST_MAX_MAG;
    3131
    3232    psImageMaskType ghostMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for ghost pixels
     33    psImageMaskType glintMaskValue = pmConfigMaskGet("GHOST", config); // Mask value for glint pixels (overload ghost)
    3334    psImageMaskType spikeMaskValue = pmConfigMaskGet("SPIKE", config); // Mask value for ghost pixels
    3435    psImageMaskType starMaskValue  = pmConfigMaskGet("STARCORE", config); // Mask value for ghost pixels
     
    5354    }
    5455    bool COUNT_GHOSTS = psMetadataLookupF32 (&status, recipe, "REFSTAR_COUNT_GHOSTS");
    55     double GHOST_MAX_MAG = psMetadataLookupF32 (&status, recipe, "GHOST_MAX_MAG");
    5656    int nGhosts = 0;
     57
     58    // convert star positions to glint positions and add to the fpa->analysis data
     59    if (!psastroLoadGlints (config)) {
     60        psError(PSASTRO_ERR_CONFIG, false, "Error loading glints");
     61        return false;
     62    }
    5763
    5864    psLogMsg ("psastro", PS_LOG_INFO, "generating a bright-star mask");
     
    7985
    8086    // really error-out here?  or just skip?
    81     if (!psastroZeroPointFromRecipe (&zeropt, &exptime, fpa, recipe)) {
     87    if (!psastroZeroPointFromRecipe (&zeropt, &exptime, &GHOST_MAX_MAG, fpa, recipe)) {
    8288        psLogMsg ("psastro", PS_LOG_INFO, "failed to load zeropt data from recipe");
    8389        return false;
     
    221227                    }
    222228
     229                    // This masking option was needed for persistent charge trails in GPC1; it
     230                    // has since been replaced with 'burntool', which is applied upon readout
     231                    // by the camera software, and therefore is aware of the image sequence.
    223232                    if (REFSTAR_MASK_BLEED) {
    224 
    225233                        // convert x,y chip coordinates to cells in maskChip
    226234                        pmCell *refCell = pmCellInChip (refChip, ref->chip->x, ref->chip->y);
     
    245253                }
    246254
    247                 // select the raw objects for this readout (loaded in psastroExtract.c)
     255                // select the ghost object for this readout (loaded in psastroExtractGhosts.c).
     256                // These differ from the reference stars since the star position is not
     257                // contained by the readout; instead, the ghost position is predicted based on
     258                // the ghost model, and the ghost positions associated with a given readout are
     259                // supplied here.
    248260                psArray *ghosts = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GHOSTS");
    249                 if (ghosts == NULL) { continue; }
    250 
    251                 // identify the bright stars of interest
    252                 for (int i = 0; i < ghosts->n; i++) {
    253                     psastroGhost *ghost = ghosts->data[i];
    254                     // XXX bright vs faint ghost bits? (OR with SUSPECT)
    255                     psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer);
    256                 }
     261                if (ghosts) {
     262                    // mask the ghosts on this readout
     263                    for (int i = 0; i < ghosts->n; i++) {
     264                        psastroGhost *ghost = ghosts->data[i];
     265                        // XXX bright vs faint ghost bits? (OR with SUSPECT)
     266                        psastroMaskEllipticalAnnulus (readoutMask->mask, ghostMaskValue, ghost->chip->x, ghost->chip->y, ghost->inner, ghost->outer);
     267                    }
     268                }
     269
     270                // Select the glint mask regions for this readout (loaded in
     271                // psastroExtractGlints.c).  These glint regions are defined as rectangular
     272                // boxes and are generated for each chip based on the position of the bright
     273                // stars beyond the edge of the focal plane.  This masking is currently very
     274                // GPC1-specific
     275                psArray *glints = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.GLINTS");
     276                if (glints) {
     277                    // mask the glints on this readout
     278                    for (int i = 0; i < glints->n; i++) {
     279                        psRegion *glint = glints->data[i];
     280                        psastroMaskRectangle (readoutMask->mask, glintMaskValue, glint->x0, glint->y0, glint->x1, glint->y1);
     281                    }
     282                }
    257283
    258284                // select the raw objects for this readout, flag is they fall in a mask
     
    260286                if (rawstars == NULL) return false;
    261287               
    262                 // XXX finish this:
    263                 for (int i = 0; i < rawstars->n; i++) {
     288                // XXX finish this: raise a bit for stars that land on certain types of masks;
     289                // others (eg, bright star core) should be ignored.
     290                for (int i = 0; false && (i < rawstars->n); i++) {
    264291                    pmAstromObj *raw = rawstars->data[i];
    265292                    psImageMaskType value = readoutMask->mask->data.PS_TYPE_IMAGE_MASK_DATA[(int)(raw->chip->x)][(int)(raw->chip->y)];
Note: See TracChangeset for help on using the changeset viewer.