IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 30, 2009, 5:20:29 PM (17 years ago)
Author:
watersc1
Message:

Finished up my edits to the detrend cleanup, and some changes to my
copy of burntool and the pslib astrometry. Detrend cleanup has not
been tested yet. That's up next.

Location:
branches/czw_branch/cleanup
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup

  • branches/czw_branch/cleanup/magic/censorObjects/src/censorLoop.c

    r24695 r24951  
    4343    }
    4444
     45    // select the input data sources
     46    pmFPAfile *inMask = psMetadataLookupPtr (NULL, config->files, "CENSOR.INPUT.MASK");
     47    if (!inMask) {
     48        psError(CENSOR_ERR_CONFIG, true, "Can't find input masks!\n");
     49        return false;
     50    }
     51
    4552    pmFPAview *view = pmFPAviewAlloc (0);
     53    bool badMaskFile = false;
     54
     55    // check on the mask file at this level if possible
     56    badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
    4657
    4758    // files associated with the science image
     
    4960
    5061    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
    51         psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    52         if (!chip->process || !chip->file_exists) { continue; }
     62        psTrace ("censor", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     63        if (!chip->process || !chip->file_exists) { continue; }
     64
     65        // check on the mask file at this level if possible
     66        badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
     67
    5368        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    5469
    5570        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    56             psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    57             if (!cell->process || !cell->file_exists) { continue; }
     71            psTrace ("censor", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     72            if (!cell->process || !cell->file_exists) { continue; }
     73
     74            // check on the mask file at this level if possible
     75            badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
     76
    5877            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    5978
    6079            // process each of the readouts
    6180            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     81
     82                // check on the mask file at this level if possible
     83                badMaskFile = censorBadFileByView(badMaskFile, inMask, config, view);
     84
    6285                if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE;
    6386                if (!readout->data_exists) { continue; }
    6487
    65                 if (!censorReadout (readout, config, view)) ESCAPE;
     88                if (!censorReadout (readout, config, view, badMaskFile)) ESCAPE;
    6689
    6790                if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE;
     
    78101    return true;
    79102}
     103
     104bool censorBadFileByView (bool badFile, pmFPAfile *file, pmConfig *config, pmFPAview *view) {
     105
     106    // get the current level
     107    pmFPALevel level = pmFPAviewLevel (view);
     108
     109    // can we try to open this file? (if not, leave the existing badView intact)
     110    if (level != file->fileLevel) return badFile;
     111
     112    // free, and if needed, realloc badView below
     113    badFile = false;
     114
     115    char *filename = pmFPAfileName(file, view, config);
     116    if (filename) {
     117        // activate the file
     118        pmFPAfileActivate (config->files, true, file->name);
     119        psFree (filename);
     120        return false;
     121    }
     122
     123    // de-activate the file
     124    pmFPAfileActivate (config->files, false, file->name);
     125    return true;
     126}
Note: See TracChangeset for help on using the changeset viewer.