IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7618


Ignore:
Timestamp:
Jun 21, 2006, 12:44:16 PM (20 years ago)
Author:
magnier
Message:

various fixes

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

Legend:

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

    r7604 r7618  
    739739    PS_ASSERT_PTR_NON_NULL(format, false);
    740740
    741     return addSource(fpa, phuView, NULL, format) ? true : false;
    742 }
    743 
    744 
     741    pmFPAview *view = addSource(fpa, phuView, NULL, format);
     742    bool status = (view == NULL);
     743    psFree (view);
     744    return status;
     745}
    745746
    746747// Add an input file to the FPA
  • trunk/psModules/src/camera/pmFPACopy.c

    r7419 r7618  
    181181        psFree(biasIter);
    182182
     183        targetReadout->data_exists = true;
    183184        psFree(targetReadout);          // Drop reference
    184185    }
     
    251252    binItem->data.S32 *= yBin;
    252253
    253 
    254254    // Copy any headers
    255255    pmHDU *targetHDU = pmHDUFromCell(target); // The target HDU
     
    265265    }
    266266
     267    target->data_exists = true;
    267268    return true;
    268269}
     
    301302    psMetadataCopy(target->concepts, source->concepts);
    302303
     304    target->data_exists = true;
    303305    return status;
    304306}
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r7610 r7618  
    458458    psTrace(__func__, 3, "Spliced image will be %dx%d\n", (int)xSize, (int)ySize);
    459459    psImage *mosaic = psImageAlloc((int)xSize, (int)ySize, type); // The mosaic image
    460     psImageInit(mosaic, 0.0);
     460    psImageInit(mosaic, 0);
    461461
    462462    // Next pass through the images to do the mosaicking
  • trunk/psModules/src/camera/pmFPAWrite.c

    r7589 r7618  
    101101    if ((!pixels && hdu->phu && !hdu->images) || // Data-less PHU
    102102            (pixels && (hdu->images || (!hdu->images && pmHDUGenerateForCell(cell) && hdu->images)))) { // Data
    103         psMetadataPrint (stdout, cell->concepts, 0);
    104103        success &= pmConceptsWriteCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA |
    105104                                       PM_CONCEPT_SOURCE_DEFAULTS, false, NULL);
     
    152151        if (blankSegment || imageSegment) {
    153152            pmConceptSource source = PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS;
    154             for (int i = 0; i < chip->cells->n; i++) {
    155                 pmCell *cell = chip->cells->data[i];
    156                 psMetadataPrint (stdout, cell->concepts, 0);
    157             }
    158153            if (!pmConceptsWriteChip(chip, source, false, true, NULL)) {
    159154                psError(PS_ERR_IO, false, "Unable to write Concepts for Chip.\n");
  • trunk/psModules/src/camera/pmFPAfile.c

    r7589 r7618  
    8181    file->state = PM_FPA_STATE_CLOSED;
    8282
     83    file->xBin = 1;
     84    file->yBin = 1;
     85    file->src = NULL;
     86
     87    file->save = false;
     88
    8389    return file;
    8490}
     
    109115
    110116// XXX reconsider this function name / concept
     117# if 0
    111118bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode)
    112119{
     
    130137    return true;
    131138}
     139# endif
    132140
    133141// select the rule from the camera configuration, perform substitutions as needed
     
    241249    if (view->cell == -1) {
    242250        pmFPAAddSourceFromView (out, view, format);
    243         return pmChipCopyStructure (outChip, inChip, xBin, yBin);
     251        // XXX this is a hack: can i defer this to ppImageRebinChip?
     252        // bool status = pmChipCopyStructure (outChip, inChip, xBin, yBin);
     253        return true;
    244254    }
    245255    if (view->cell >= inChip->cells->n) {
  • trunk/psModules/src/camera/pmFPAfile.h

    r7589 r7618  
    77*  @author EAM, IfA
    88*
    9 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2006-06-17 01:50:43 $
     9*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2006-06-21 22:44:16 $
    1111*
    1212*  Copyright 2004-2005 Institute for Astronomy, University of Hawaii
     
    6060    pmFPALevel fileLevel;  // what level in the FPA hierarchy represents a unique file?
    6161    pmFPALevel dataLevel;  // at what level do we read/write the data segment?
     62    pmFPALevel freeLevel;  // at what level do we read/write the data segment?
    6263
    6364    pmFPA *fpa;    // for I/O files, we carry a pointer to the complete fpa
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r7589 r7618  
    109109        return NULL;
    110110    }
     111    // default is to free the data after use (after written out)
     112    // this can be overridden for pmFPAfiles used as carriers as well
     113    file->freeLevel = file->dataLevel;
    111114
    112115    if (fpa != NULL) {
     
    199202    char *save = psMetadataLookupStr (&status, data, "FILE.SAVE");
    200203    if (save != NULL) {
    201         if (!strcasecmp (type, "TRUE"))     {
     204        if (!strcasecmp (save, "TRUE"))     {
    202205            file->save = true;
    203206        }
    204         if (!strcasecmp (type, "FALSE"))     {
     207        if (!strcasecmp (save, "FALSE"))     {
    205208            file->save = false;
    206209        }
     
    218221        return NULL;
    219222    }
     223    // default is to free the data after use (after written out)
     224    // this can be overridden for pmFPAfiles used as carriers as well
     225    file->freeLevel = file->dataLevel;
    220226
    221227    if (fpa != NULL) {
     
    266272    }
    267273
     274    // add argument-supplied OUTPUT name to this file
     275    char *outname = psMetadataLookupStr(&status, config->arguments, "OUTPUT");
     276    psMetadataAddStr (file->names, PS_LIST_TAIL, "OUTPUT", PS_META_NO_REPLACE, "", outname);
     277
     278    // place the resulting file in the config system
    268279    psMetadataAddPtr (config->files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file);
    269280    psFree (file); // we free this copy of file, but 'files' still has a copy
     
    616627    PS_ASSERT_INT_POSITIVE(strlen(filename), false);
    617628
    618     pmFPA *fpa = pmFPAConstruct (config->camera);
     629    pmFPA *fpa = pmFPAConstruct (src->camera);
    619630    pmFPAfile *file = pmFPAfileDefineOutput (config, fpa, filename);
    620631    if (!file) {
     
    648659    }
    649660    file->fpa = pmFPAConstruct(file->camera);
     661
     662    for (int i = 0; i < file->fpa->chips->n; i++) {
     663        pmChip *chip = file->fpa->chips->data[i];
     664        for (int j = 0; j < chip->cells->n; j++) {
     665            pmCell *cell = chip->cells->data[j];
     666            char *name = psMetadataLookupStr (NULL, cell->concepts, "CELL.NAME");
     667            fprintf (stderr, "cell %d,%d : %s\n", i, j, name);
     668        }
     669    }
     670
    650671    return file;
    651672}
  • trunk/psModules/src/camera/pmFPAfileFitsIO.c

    r7589 r7618  
    101101        if (hdu != phu) {
    102102            // we assume that the PHU is just a header
    103             psMetadata *outhead = psMetadataCopy (NULL, phu->header);
     103            // header may not be defined for constructed images; make a dummy one
     104            psMetadata *outhead = NULL;
     105            if (phu->header) {
     106                outhead = psMetadataCopy (NULL, phu->header);
     107            } else {
     108                outhead = psMetadataAlloc ();
     109            }
    104110            psMetadataAdd (outhead, PS_LIST_TAIL, "EXTEND", PS_DATA_BOOL | PS_META_REPLACE, "this file has extensions", true);
    105111            psFitsWriteBlank (file->fits, outhead);
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r7589 r7618  
    261261
    262262    // do we need to read this file?
    263     if (level != file->dataLevel) {
    264         psTrace("pmFPAfile", 6, "skip free of %s at this level %s: dataLevel is %s",
     263    if (level != file->freeLevel) {
     264        psTrace("pmFPAfile", 6, "skip free of %s at this level %s: freeLevel is %s",
     265                file->name, pmFPALevelToName(level), pmFPALevelToName(file->freeLevel));
     266        return true;
     267    }
     268
     269    // XXX totally lame hack: how do I handle this?
     270    # if 0
     271    if (!strcasecmp(file->name, "PPIMAGE.BIN1") && (level != PM_FPA_LEVEL_FPA))
     272        {
     273            psTrace("pmFPAfile", 5, "skip free of %s at this level %s: dataLevel is %s",
     274                    file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
     275            return true;
     276        }
     277    if (!strcasecmp(file->name, "PPIMAGE.BIN2") && (level != PM_FPA_LEVEL_FPA)) {
     278        psTrace("pmFPAfile", 5, "skip free of %s at this level %s: dataLevel is %s",
    265279                file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
    266280        return true;
    267281    }
     282    # endif
    268283
    269284    switch (file->type) {
     
    271286        if (pmFPAviewFreeFitsImage (view, file)) {
    272287            psTrace ("pmFPAfile", 5, "freed %s (type: %d)\n", file->filename, file->type);
     288            if (file->filename == NULL) {
     289                psTrace ("pmFPAfile", 5, "filename is not defined for %s\n", file->name);
     290            }
    273291        } else {
    274292            psError(PS_ERR_UNKNOWN, false, "skipping %s (type: %d)\n", file->filename, file->type);
     
    310328    if (file->mode != PM_FPA_MODE_WRITE) {
    311329        psTrace("pmFPAfile", 6, "skip write for %s, mode is not WRITE", file->name);
     330        return true;
     331    }
     332
     333    if (!file->save) {
     334        psTrace("pmFPAfile", 6, "skip write for %s, save is FALSE", file->name);
    312335        return true;
    313336    }
     
    393416
    394417    // do we need to write this file?
    395     if (level != file->dataLevel) {
    396         psTrace("pmFPAfile", 6, "skip creation of %s at this level %s: dataLevel is %s",
    397                 file->name, pmFPALevelToName(level), pmFPALevelToName(file->dataLevel));
     418    if (level != file->fileLevel) {
     419        psTrace("pmFPAfile", 6, "skip creation of %s at this level %s: fileLevel is %s",
     420                file->name, pmFPALevelToName(level), pmFPALevelToName(file->fileLevel));
    398421        return true;
    399422    }
     
    404427        /* create a PHU for thie file, if it does not exist */
    405428        pmFPAfileCopyStructureView (file->fpa, file->src, file->format, file->xBin, file->yBin, view);
    406         psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
     429        // psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->name, file->fpa);
    407430        break;
    408431
Note: See TracChangeset for help on using the changeset viewer.