IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 12, 2009, 10:05:21 AM (17 years ago)
Author:
Paul Price
Message:

Hadn't changed weight --> variance for the standalone psphot.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotImageLoop.c

    r20769 r21458  
    1616    pmFPAfile *load = psMetadataLookupPtr (&status, config->files, "PSPHOT.LOAD");
    1717    if (!status) {
    18         psError(PSPHOT_ERR_PROG, false, "Can't find input data!");
    19         return false;
     18        psError(PSPHOT_ERR_PROG, false, "Can't find input data!");
     19        return false;
    2020    }
    2121    pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT");
    2222    if (!status) {
    23         psError(PSPHOT_ERR_PROG, false, "Can't find input data!");
    24         return false;
     23        psError(PSPHOT_ERR_PROG, false, "Can't find input data!");
     24        return false;
    2525    }
    2626
    2727    pmFPAview *view = pmFPAviewAlloc (0);
    28    
     28
    2929    // files associated with the science image
    3030    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot.");
    3131
    32     // for psphot, we force data to be read at the chip level 
     32    // for psphot, we force data to be read at the chip level
    3333    while ((chip = pmFPAviewNextChip (view, load->fpa, 1)) != NULL) {
    3434        psLogMsg ("psphot", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    3535        if (! chip->process || ! chip->file_exists) { continue; }
    3636
    37         // load just the input image data (image, mask, weight)
    38         pmFPAfileActivate (config->files, false, NULL);
    39         pmFPAfileActivate (config->files, true, "PSPHOT.LOAD");
    40         pmFPAfileActivate (config->files, true, "PSPHOT.MASK");
    41         pmFPAfileActivate (config->files, true, "PSPHOT.WEIGHT");
    42         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
     37        // load just the input image data (image, mask, weight)
     38        pmFPAfileActivate (config->files, false, NULL);
     39        pmFPAfileActivate (config->files, true, "PSPHOT.LOAD");
     40        pmFPAfileActivate (config->files, true, "PSPHOT.MASK");
     41        pmFPAfileActivate (config->files, true, "PSPHOT.VARIANCE");
     42        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
    4343
    44         // mosaic the cells of a chip into a single contiguous (trimmed) chip
     44        // mosaic the cells of a chip into a single contiguous (trimmed) chip
    4545        if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip.");
    4646
    47         // try to load other supporting data (PSF, SRC, etc).
    48         // do not re-load the following three files
    49         pmFPAfileActivate (config->files, true, NULL);
    50         pmFPAfileActivate (config->files, false, "PSPHOT.LOAD");
    51         pmFPAfileActivate (config->files, false, "PSPHOT.MASK");
    52         pmFPAfileActivate (config->files, false, "PSPHOT.WEIGHT");
    53         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
     47        // try to load other supporting data (PSF, SRC, etc).
     48        // do not re-load the following three files
     49        pmFPAfileActivate (config->files, true, NULL);
     50        pmFPAfileActivate (config->files, false, "PSPHOT.LOAD");
     51        pmFPAfileActivate (config->files, false, "PSPHOT.MASK");
     52        pmFPAfileActivate (config->files, false, "PSPHOT.VARIANCE");
     53        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
    5454
    55         // re-activate files so they will be closed and freed below
    56         pmFPAfileActivate (config->files, true, NULL);
     55        // re-activate files so they will be closed and freed below
     56        pmFPAfileActivate (config->files, true, NULL);
    5757
    58         // there is now only a single chip (multiple readouts?). loop over it and process
    59         while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
     58        // there is now only a single chip (multiple readouts?). loop over it and process
     59        while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
    6060            psLogMsg ("psphot", 5, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    6161
    62             // process each of the readouts
    63             while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
    64                 psLogMsg ("psphot", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    65                 if (! readout->data_exists) { continue; }
     62            // process each of the readouts
     63            while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {
     64                psLogMsg ("psphot", 6, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     65                if (! readout->data_exists) { continue; }
    6666
    67                 // run the actual photometry analysis on this chip/cell/readout
    68                 if (!psphotReadout (config, view)) {
    69                     psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
    70                     psFree (view);
    71                     return false;
    72                 }
    73             }
     67                // run the actual photometry analysis on this chip/cell/readout
     68                if (!psphotReadout (config, view)) {
     69                    psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
     70                    psFree (view);
     71                    return false;
     72                }
     73            }
    7474
    75             status = true;
    76             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
    77             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");
    78             status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
    79             if (!status) {
    80                 psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");
    81                 psFree (view);
    82                 return false;
    83             }
    84         }
     75            status = true;
     76            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");
     77            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV");
     78            status &= pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");
     79            if (!status) {
     80                psError(PSPHOT_ERR_PROG, false, "trouble dropping internal files");
     81                psFree (view);
     82                return false;
     83            }
     84        }
    8585
    86         // save output which is saved at the chip level
    87         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");
     86        // save output which is saved at the chip level
     87        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");
    8888    }
    8989    // save output which is saved at the fpa level
     
    108108
    109109// PSPHOT.MASK
    110 // PSPHOT.WEIGHT
    111 // 
     110// PSPHOT.VARIANCE
     111//
Note: See TracChangeset for help on using the changeset viewer.