IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17424


Ignore:
Timestamp:
Apr 9, 2008, 8:31:42 PM (18 years ago)
Author:
bills
Message:

added pmConceptsAverageChips. This is needed to get valid files from
ppMerge for gpc1

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeLoop.c

    r17319 r17424  
    306306            }
    307307        }
     308        psList *inChips = psListAlloc(NULL);
     309        for (int i=0; i < numFiles; i++) {
     310            pmChip *chip = pmFPAviewThisChip(view, ((pmFPAfile *)inputs->data[i])->fpa);
     311            psListAdd(inChips, PS_LIST_TAIL, chip);
     312        }
     313        if (!pmConceptsAverageChips(outChip, inChips, true)) {
     314            psError(PS_ERR_UNKNOWN, false, "Unable to average Chip concepts.");
     315            psFree(inChips);
     316            goto ERROR;
     317        }
     318        psFree(inChips);
    308319        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    309320            goto ERROR;
  • trunk/psModules/src/concepts/pmConceptsAverage.c

    r16947 r17424  
    226226}
    227227
     228bool pmConceptsAverageChips(pmChip *target, psList *sources, bool same)
     229{
     230    PS_ASSERT_PTR_NON_NULL(target, false);
     231    PS_ASSERT_PTR_NON_NULL(sources, false);
     232    PS_ASSERT_INT_POSITIVE(sources->n, false);
     233
     234    float temp       = 0.0;             // Temperature
     235    int x0 = 0, y0 = 0;                 // Offset
     236    int xParity = 0, yParity = 0;       // Parity
     237    int xSize = 0, ySize = 0;
     238    psString    id = NULL;
     239
     240    int nChips = 0;                     // Number of cells;
     241    psListIterator *sourcesIter = psListIteratorAlloc(sources, PS_LIST_HEAD, false); // Iterator for sources
     242    pmChip *chip = NULL;                // Source cell from iteration
     243    while ((chip = psListGetAndIncrement(sourcesIter))) {
     244        if (!chip) {
     245            continue;
     246        }
     247        temp += psMetadataLookupF32(NULL, chip->concepts, "CHIP.TEMP");
     248        if (nChips == 1) {
     249            xSize = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XSIZE");
     250            ySize = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YSIZE");
     251            xParity = psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY");
     252            yParity = psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY");
     253            x0 = psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0");
     254            y0 = psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0");
     255            id = psMetadataLookupStr(NULL, chip->concepts, "CHIP.ID");
     256        } else {
     257            if (xSize != psMetadataLookupS32(NULL, chip->concepts, "CHIP.XSIZE")) {
     258                psWarning("Differing CHIP.XSIZE in use: %d vs %d\n",
     259                    xSize, psMetadataLookupS32(NULL, chip->concepts, "CHIP.XSIZE"));
     260            }
     261            if (ySize != psMetadataLookupS32(NULL, chip->concepts, "CHIP.YSIZE")) {
     262                psWarning("Differing CHIP.YSIZE in use: %d vs %d\n",
     263                    ySize, psMetadataLookupS32(NULL, chip->concepts, "CHIP.YSIZE"));
     264            }
     265            if (xParity != psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY")) {
     266                psWarning("Differing CHIP.XPARITY in use: %d vs %d\n",
     267                    xParity, psMetadataLookupS32(NULL, chip->concepts, "CHIP.XPARITY"));
     268            }
     269            if (yParity != psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY")) {
     270                psWarning("Differing CHIP.YPARITY in use: %d vs %d\n",
     271                    yParity, psMetadataLookupS32(NULL, chip->concepts, "CHIP.YPARITY"));
     272            }
     273            if (x0 != psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0")) {
     274                psWarning("Differing CHIP.X0 in use: %d vs %d\n",
     275                    x0, psMetadataLookupS32(NULL, chip->concepts, "CHIP.X0"));
     276            }
     277            if (y0 != psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0")) {
     278                psWarning("Differing CHIP.Y0 in use: %d vs %d\n",
     279                    y0, psMetadataLookupS32(NULL, chip->concepts, "CHIP.Y0"));
     280            }
     281            psString newID = psMetadataLookupStr(NULL, chip->concepts, "CHIP.ID");
     282            if (id && newID && strcmp(id, newID)) {
     283                psWarning("Differing CHIP.ID in use: %s vs %s\n", id, newID);
     284            }
     285        }
     286   
     287        nChips++;
     288    }
     289    psFree(sourcesIter);
     290
     291    temp      /= (float)nChips;
     292
     293    MD_UPDATE(target->concepts, "CHIP.TEMP", F32, temp);
     294    if (same) {
     295        MD_UPDATE(target->concepts, "CHIP.X0", S32, x0);
     296        MD_UPDATE(target->concepts, "CHIP.Y0", S32, y0);
     297        MD_UPDATE(target->concepts, "CHIP.XSIZE", S32, xSize);
     298        MD_UPDATE(target->concepts, "CHIP.YSIZE", S32, ySize);
     299        MD_UPDATE(target->concepts, "CHIP.XPARITY", S32, xParity);
     300        MD_UPDATE(target->concepts, "CHIP.YPARITY", S32, yParity);
     301        MD_UPDATE_STR(target->concepts, "CHIP.ID", id);
     302    }
     303
     304    return true;
     305}
     306
  • trunk/psModules/src/concepts/pmConceptsAverage.h

    r15379 r17424  
    44 * @author Paul Price, IfA
    55 *
    6  * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-10-25 23:05:14 $
     6 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-04-10 06:31:42 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    5656                           );
    5757
     58/// Set a variety of concepts in a chip by averaging over several
     59bool pmConceptsAverageChips(pmChip *target,///< Target chip
     60                            psList *sources, ///< List of source chips
     61                            bool same   ///< Are the chips the same chip from different exposures?
     62                           );
     63
    5864/// @}
    5965#endif
Note: See TracChangeset for help on using the changeset viewer.