IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 2, 2008, 10:53:30 AM (19 years ago)
Author:
gusciora
Message:

Modified file reads to look for dataFiles and then ../dataFiles.
Other additions as well.
First version: tap_pmReadoutFake.c
First version: tap_pmReadoutStack.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/test/camera/tap_pmFPAExtent.c

    r14882 r15987  
    55#include "tap.h"
    66#include "pstap.h"
    7 // XXX: Use better name for the temporary FITS file
    8 // XXX: The code to generate and free the FPA hierarchy was copied from
    9 // tap-pmFPA.c.  EIther include it directly, or library, or something.
    10 // Also, get rid of the manual free functions and use psFree() once
    11 // it correctly frees child members
     7/* STATUS:
     8    All functions are tested.
     9*/
     10
    1211// XXX: For the genSimpleFPA() code, add IDs to each function so that
    1312// the values set in each chip-?cell-?hdu-?image are unique
     
    8180    cell->hdu = pmHDUAlloc("cellExtName");
    8281    for (int i = 0 ; i < NUM_READOUTS ; i++) {
    83         cell->readouts->data[i] = generateSimpleReadout(cell);
    84     }
    85 
    86     bool rc = pmConfigFileRead(&cell->hdu->format, "data/camera0/format0.config", "Camera format 0");
     82        cell->readouts->data[i] = psMemDecrRefCounter((psPtr) generateSimpleReadout(cell));
     83    }
     84
     85    bool rc = pmConfigFileRead(&cell->hdu->format, "dataFiles/camera0/format0.config", "Camera format 0");
    8786    if (!rc) {
    88         diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())");
     87        rc = pmConfigFileRead(&cell->hdu->format, "../camera0/format0.config", "Camera format 0");
     88        if (!rc) {
     89            diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())");
     90        }
    8991    }
    9092
     
    102104
    103105    //XXX: Should the region be set some other way?  Like through the various config files?
    104 //    psRegion *region = psRegionAlloc(0.0, TEST_NUM_COLS-1, 0.0, TEST_NUM_ROWS-1);
    105106    psRegion *region = psRegionAlloc(0.0, 0.0, 0.0, 0.0);
    106107    // You shouldn't have to remove the key from the metadata.  Find out how to simply change the key value.
     
    122123    psMetadataAddS32(chip->analysis, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    123124    psMetadataAddS32(chip->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    124 //    chip->hdu = pmHDUAlloc("chipExtName");
    125 //
    126 //    bool rc = pmConfigFileRead(&chip->hdu->format, "data/camera0/format0.config", "Camera format 0");
    127 //    if (!rc) {
    128 //        diag("pmConfigFileRead() was unsuccessful (from generateSimpleChip())");
    129 //    }
    130 //
    131125    psArrayRealloc(chip->cells, NUM_CELLS);
    132126    for (int i = 0 ; i < NUM_CELLS ; i++) {
    133         chip->cells->data[i] = generateSimpleCell(chip);
     127        chip->cells->data[i] = psMemDecrRefCounter((psPtr) generateSimpleCell(chip));
    134128    }
    135129
     
    153147    psMetadataAddS32((psMetadata *) fpa->camera, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    154148    psMetadataAddS32(fpa->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    155 //    fpa->hdu = pmHDUAlloc("fpaExtName");
    156 //
    157 //    bool rc = pmConfigFileRead(&fpa->hdu->format, "data/camera0/format0.config", "Camera format 0");
    158 //    if (!rc) {
    159 //        diag("pmConfigFileRead() was unsuccessful (from generateSimpleFPA())");
    160 //    }
    161149
    162150    psArrayRealloc(fpa->chips, NUM_CHIPS);
    163151    for (int i = 0 ; i < NUM_CHIPS ; i++) {
    164         fpa->chips->data[i] = generateSimpleChip(fpa);
    165     }
    166 
    167     // XXX: Eventually, when you finish the pmConcepts tests, add full concept
    168     // reading code from wherever.
     152        fpa->chips->data[i] = psMemDecrRefCounter((psPtr) generateSimpleChip(fpa));
     153    }
     154
    169155    pmConceptsBlankFPA(fpa);
    170 //    bool mdok;
    171 //    psMetadata *fileData = psMetadataLookupMetadata(&mdok, fpa->hdu->format, "FILE");
    172 //    char *fpaNameHdr = psMetadataLookupStr(&mdok, fileData, "FPA.NAME");
    173 //    psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.NAME", PS_META_REPLACE, NULL, fpaNameHdr);
    174 
    175156    return(fpa);
    176157}
    177158
    178 // XXX: This should only be necessary until the psFree() functions for
    179 // FPA/chip/cell/readout correctly free all child chips/cells/readouts
    180 void myFreeCell(pmCell *cell)
    181 {
    182     for (int k = 0 ; k < cell->readouts->n ; k++) {
    183         psFree(cell->readouts->data[k]);
    184     }
    185     psFree(cell);
    186 }
    187 
    188 void myFreeChip(pmChip *chip) {
    189     for (int j = 0 ; j < chip->cells->n ; j++) {
    190         myFreeCell(chip->cells->data[j]);
    191     }
    192     psFree(chip);
    193 }
    194 
    195 void myFreeFPA(pmFPA *fpa)
    196 {
    197     for (int i = 0 ; i < fpa->chips->n ; i++) {
    198         myFreeChip(fpa->chips->data[i]);
    199     }
    200     psFree(fpa);
    201 }
    202159
    203160
     
    250207        ok(!errorFlag, "pmReadoutExtent() passed all tests");
    251208
    252         myFreeFPA(fpa);
     209        psFree(fpa);
    253210        psFree(camera);
    254211        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    258215    // ----------------------------------------------------------------------
    259216    // pmCellExtent() tests: NULL input
    260     // psRegion *pmCellExtent(const pmCell *cell)
    261217    {
    262218        psMemId id = psMemGetId();
     
    312268        ok(!errorFlag, "pmCellExtent() passed all tests");
    313269
    314         myFreeFPA(fpa);
     270        psFree(fpa);
    315271        psFree(camera);
    316272        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    321277    // ----------------------------------------------------------------------
    322278    // pmChipExtent() tests: NULL input
    323     // psRegion *pmChipExtent(const pmChip *chip)
    324279    {
    325280        psMemId id = psMemGetId();
     
    361316        ok(!errorFlag, "pmChipExtent() passed all tests");
    362317
    363         myFreeFPA(fpa);
     318        psFree(fpa);
    364319        psFree(camera);
    365320        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    369324    // ----------------------------------------------------------------------
    370325    // pmChipPixels() tests: NULL input
    371     // psRegion *pmChipPixels(const pmChip *chip)
    372326    {
    373327        psMemId id = psMemGetId();
     
    416370        ok(!errorFlag, "pmChipPixels() passed all tests");
    417371
    418         myFreeFPA(fpa);
     372        psFree(fpa);
    419373        psFree(camera);
    420374        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    424378    // ----------------------------------------------------------------------
    425379    // pmFPAPixels() tests: NULL input
    426     // psRegion *pmFPAPixels(const pmFPA *fpa)
    427380    {
    428381        psMemId id = psMemGetId();
     
    464417        psFree(tstExtent);
    465418        psFree(actualExtent);
    466         myFreeFPA(fpa);
     419        psFree(fpa);
    467420        psFree(camera);
    468421        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    469422    }
    470 
    471 
    472 
    473 
    474 }
     423}
Note: See TracChangeset for help on using the changeset viewer.