IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12810


Ignore:
Timestamp:
Apr 11, 2007, 4:51:44 PM (19 years ago)
Author:
magnier
Message:

adding pmChipDuplicate function (not working)

Location:
trunk/psModules/src/camera
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPACopy.c

    r12791 r12810  
    350350}
    351351
     352// create a new pmChip with the data derived from the supplied chip
     353pmChip *pmChipDuplicate(pmFPA *fpa, const pmChip *sourceChip)
     354{
     355    assert(sourceChip);
     356
     357    bool status;
     358    char *chipName = psMetadataLookupStr(&status, sourceChip->concepts, "CHIP.NAME");
     359    pmChip *targetChip = pmChipAlloc (NULL, chipName);
     360    targetChip->parent = fpa;
     361
     362    psArray *sourceCells = sourceChip->cells; // The source cells
     363
     364    for (int i = 0; i < sourceCells->n; i++) {
     365        pmCell *sourceCell = sourceCells->data[i]; // The sources cell
     366        const char *cellName = psMetadataLookupStr(NULL, sourceCell->concepts, "CELL.NAME"); // Name of cell
     367        // XXX are there other concepts I need to copy first?
     368        pmCell *targetCell = pmCellAlloc (targetChip, cellName);
     369        int xParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.XPARITY"); // Target x parity
     370        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.XPARITY", PS_META_REPLACE, "", xParityTarget);
     371        int yParityTarget = psMetadataLookupS32(&status, sourceCell->concepts, "CELL.YPARITY"); // Target y parity
     372        psMetadataAddS32 (targetCell->concepts, PS_LIST_TAIL, "CELL.YPARITY", PS_META_REPLACE, "", yParityTarget);
     373        if (!cellCopy(targetCell, sourceCell, true, 1, 1)) {
     374            psError(PS_ERR_BAD_PARAMETER_VALUE, false, "failed to duplicate chip\n");
     375            return NULL;
     376        }
     377        // update the attributes
     378        targetCell->file_exists = sourceCell->file_exists;
     379        targetCell->data_exists = sourceCell->data_exists;
     380        targetCell->process     = sourceCell->process;
     381    }
     382
     383    // Update the concepts
     384    psMetadataCopy(targetChip->concepts, sourceChip->concepts);
     385
     386    // update the attributes
     387    targetChip->file_exists = sourceChip->file_exists;
     388    targetChip->data_exists = sourceChip->data_exists;
     389    targetChip->process     = sourceChip->process;
     390
     391    return targetChip;
     392}
     393
    352394// Common engine for pmFPACopy and pmFPACopyStructure.
    353395// Iterate on the components
  • trunk/psModules/src/camera/pmFPACopy.h

    r11253 r12810  
    44 * @author Paul Price, IfA
    55 *
    6  * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-01-24 02:54:14 $
     6 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2007-04-12 02:51:44 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    7272                         int xBin, int yBin ///< Binning factors in x and y
    7373                        );
     74
     75pmChip *pmChipDuplicate(pmFPA *fpa, const pmChip *source);
     76
    7477/// @}
    7578#endif
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r12804 r12810  
    416416    pmFPALevel level = pmFPAviewLevel (view);
    417417    if (file->fileLevel != level) {
    418         psTrace("psModules.camera", 6, "skip closing of %s at this level %s: dataLevel is %s",
    419                 file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
     418        psTrace("psModules.camera", 6, "skip closing of %s at this level %s: fileLevel is %s",
     419                file->name, pmFPALevelToName(level), pmFPALevelToName(file->fileLevel));
    420420        return true;
    421421    }
Note: See TracChangeset for help on using the changeset viewer.