IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13904


Ignore:
Timestamp:
Jun 19, 2007, 4:53:35 PM (19 years ago)
Author:
Paul Price
Message:

Making sure the appropriate files are loaded when necessary. Also had to change psModules (pmFPAfileBindFromArgs) so that I could bind a file with a different format than the bindee (for SIMMOSAIC, camera format is MEF but image format is SPLIT).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r13705 r13904  
    5050    }
    5151
    52     // de-activate PSWARP.SKYCELL and PSWARP.OUTPUT
     52    // Read the input astrometry
     53    {
     54        pmFPAfileActivate(config->files, false, "PSWARP.INPUT");
     55        pmFPAfileActivate(config->files, false, "PSWARP.MASK");
     56        pmFPAfileActivate(config->files, false, "PSWARP.WEIGHT");
     57        pmFPAfileActivate(config->files, true, "PSWARP.ASTROM");
     58        pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT");
     59        pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT.MASK");
     60        pmFPAfileActivate(config->files, false, "PSWARP.OUTPUT.WEIGHT");
     61        pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     62        pmChip *chip;
     63        pmFPAview *view = pmFPAviewAlloc(0);
     64        while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     65            psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
     66            if (!chip->process || !chip->file_exists) { continue; }
     67            pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
     68            pmCell *cell;
     69            while ((cell = pmFPAviewNextCell (view, input->fpa, 1)) != NULL) {
     70                psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
     71                if (!cell->process || !cell->file_exists) { continue; }
     72                pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
     73            }
     74        }
     75        psFree(view);
     76
     77        pmFPAfileActivate(config->files, true, "PSWARP.INPUT");
     78        pmFPAfileActivate(config->files, true, "PSWARP.MASK");
     79        pmFPAfileActivate(config->files, true, "PSWARP.WEIGHT");
     80        pmFPAfileActivate(config->files, false, "PSWARP.ASTROM");
     81        pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT");
     82        pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.MASK");
     83        pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.WEIGHT");
     84    }
     85
    5386    pmFPAfileActivate(config->files, false, "PSWARP.SKYCELL");
    54 
    5587    view = pmFPAviewAlloc(0);
    5688
     
    72104        }
    73105    }
     106
     107    psList *cells = psListAlloc(NULL);  // List of cells, for concepts averaging
    74108
    75109    // files associated with the science image
     
    107141            pmFPAfileIOChecks (config, view, PM_FPA_BEFORE);
    108142
     143            psListAdd(cells, PS_LIST_TAIL, cell);
     144
    109145            // process each of the readouts
    110146            pmReadout *readout;
     
    128164    pmFPA *outFPA = outChip->parent;    // Output FPA
    129165
    130     if (!pmFPACopyConcepts(output->parent->parent->parent, input->fpa)) {
    131         psError(PS_ERR_UNKNOWN, false, "Unable to copy concepts from input to output.");
     166    if (!pmConceptsAverageCells(outCell, cells, NULL, NULL, false)) {
     167        psError(PS_ERR_UNKNOWN, false, "Unable to average cell concepts.");
     168        psFree(stats);
     169        psFree(view);
     170        return false;
     171    }
     172
     173    if (!psMetadataCopy(outFPA->concepts, input->fpa->concepts)) {
     174        psError(PS_ERR_UNKNOWN, false, "Unable to copy FPA concepts from input to output.");
    132175        psFree(stats);
    133176        psFree(view);
     
    139182    outChip->data_exists = true;
    140183
    141 
     184#if 0
     185    float gain = 0.0, readnoise = 0.0, saturation = INFINITY, exposure = 0.0, darktime = 0.0;
     186    double mjd = 0.0;
     187#endif
     188
     189#if 0
    142190    // XXX Hack so that INSTRUME header keyword and the like are not updated properly
    143191    // If INSTRUME (etc) is updated, then the FITS file with the warped image will be often
     
    158206        item->data.V = NULL;
    159207    }
    160 
     208#endif
    161209
    162210
    163211    // Perform statistics on the output image
    164212    if (stats) {
    165         ppStats(stats, output->parent->parent->parent, view, maskBad | maskPoor, config);
     213        if (!ppStats(stats, output->parent->parent->parent, view, maskBad | maskPoor, config)) {
     214            psWarning("Unable to perform statistics on warped image.");
     215        }
    166216    }
    167217
     
    190240    if (stats) {
    191241        const char *statsMDC = psMetadataConfigFormat(stats);
    192         if (!statsMDC || strlen(statsMDC) == 0) {
     242        if (!statsMDC) {
    193243            psError(PS_ERR_IO, false, "Unable to get statistics MDC file.\n");
    194244            psFree(stats);
Note: See TracChangeset for help on using the changeset viewer.