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_pmFPAMaskW.c

    r14882 r15987  
    66#include "pstap.h"
    77// 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
    128// XXX: For the genSimpleFPA() code, add IDs to each function so that
    139// the values set in each chip-?cell-?hdu-?image are unique
     
    9894    cell->hdu = pmHDUAlloc("cellExtName");
    9995    for (int i = 0 ; i < NUM_READOUTS ; i++) {
    100         cell->readouts->data[i] = generateSimpleReadout(cell);
    101     }
    102 
    103     bool rc = pmConfigFileRead(&cell->hdu->format, "data/camera0/format0.config", "Camera format 0");
     96        cell->readouts->data[i] = psMemDecrRefCounter((psPtr) generateSimpleReadout(cell));
     97    }
     98
     99    // First try to read data from ../dataFiles, then try dataFiles.
     100    bool rc = pmConfigFileRead(&cell->hdu->format, "../dataFiles/camera0/format0.config", "Camera format 0");
    104101    if (!rc) {
    105         diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())");
     102        rc = pmConfigFileRead(&cell->hdu->format, "dataFiles/camera0/format0.config", "Camera format 0");
     103        if (!rc) {
     104            diag("pmConfigFileRead() was unsuccessful (from generateSimpleCell())");
     105        }
    106106    }
    107107
     
    119119
    120120    //XXX: Should the region be set some other way?  Like through the various config files?
    121 //    psRegion *region = psRegionAlloc(0.0, TEST_NUM_COLS-1, 0.0, TEST_NUM_ROWS-1);
    122121    psRegion *region = psRegionAlloc(0.0, 0.0, 0.0, 0.0);
    123     // You shouldn't have to remove the key from the metadata.  Find out how to simply change the key value.
     122    // You shouldn't have to remove the key from the metadata.
    124123    psMetadataRemoveKey(cell->concepts, "CELL.TRIMSEC");
    125124    psMetadataAddPtr(cell->concepts, PS_LIST_TAIL|PS_META_REPLACE, "CELL.TRIMSEC", PS_DATA_REGION, "I am a region", region);
     
    139138    psMetadataAddS32(chip->analysis, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    140139    psMetadataAddS32(chip->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    141 //    chip->hdu = pmHDUAlloc("chipExtName");
    142 //
    143 //    bool rc = pmConfigFileRead(&chip->hdu->format, "data/camera0/format0.config", "Camera format 0");
    144 //    if (!rc) {
    145 //        diag("pmConfigFileRead() was unsuccessful (from generateSimpleChip())");
    146 //    }
    147 //
     140
    148141    psArrayRealloc(chip->cells, NUM_CELLS);
    149142    for (int i = 0 ; i < NUM_CELLS ; i++) {
    150         chip->cells->data[i] = generateSimpleCell(chip);
    151     }
    152 
    153     // XXX: Add code to initialize chip pmConcepts
    154 
    155 
     143        chip->cells->data[i] = psMemDecrRefCounter((psPtr) generateSimpleCell(chip));
     144    }
    156145    return(chip);
    157146}
     
    170159    psMetadataAddS32((psMetadata *) fpa->camera, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    171160    psMetadataAddS32(fpa->concepts, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM);
    172 //    fpa->hdu = pmHDUAlloc("fpaExtName");
    173 //
    174 //    bool rc = pmConfigFileRead(&fpa->hdu->format, "data/camera0/format0.config", "Camera format 0");
    175 //    if (!rc) {
    176 //        diag("pmConfigFileRead() was unsuccessful (from generateSimpleFPA())");
    177 //    }
    178161
    179162    psArrayRealloc(fpa->chips, NUM_CHIPS);
    180163    for (int i = 0 ; i < NUM_CHIPS ; i++) {
    181         fpa->chips->data[i] = generateSimpleChip(fpa);
    182     }
    183 
    184     // XXX: Eventually, when you finish the pmConcepts tests, add full concept
    185     // reading code from wherever.
     164        fpa->chips->data[i] = psMemDecrRefCounter((psPtr) generateSimpleChip(fpa));
     165    }
    186166    pmConceptsBlankFPA(fpa);
    187 //    bool mdok;
    188 //    psMetadata *fileData = psMetadataLookupMetadata(&mdok, fpa->hdu->format, "FILE");
    189 //    char *fpaNameHdr = psMetadataLookupStr(&mdok, fileData, "FPA.NAME");
    190 //    psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.NAME", PS_META_REPLACE, NULL, fpaNameHdr);
    191 
    192167    return(fpa);
    193 }
    194 
    195 // XXX: This should only be necessary until the psFree() functions for
    196 // FPA/chip/cell/readout correctly free all child chips/cells/readouts
    197 void myFreeCell(pmCell *cell)
    198 {
    199     for (int k = 0 ; k < cell->readouts->n ; k++) {
    200         psFree(cell->readouts->data[k]);
    201     }
    202     psFree(cell);
    203 }
    204 
    205 void myFreeChip(pmChip *chip) {
    206     for (int j = 0 ; j < chip->cells->n ; j++) {
    207         myFreeCell(chip->cells->data[j]);
    208     }
    209     psFree(chip);
    210 }
    211 
    212 void myFreeFPA(pmFPA *fpa)
    213 {
    214     for (int i = 0 ; i < fpa->chips->n ; i++) {
    215         myFreeChip(fpa->chips->data[i]);
    216     }
    217     psFree(fpa);
    218168}
    219169
     
    309259        }
    310260        ok(!errorFlag, "pmReadoutSetMask() set the mask values correctly");
    311         myFreeFPA(fpa);   
     261        psFree(fpa);   
    312262        psFree(camera);
    313263        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    395345        ok(!errorFlag, "pmReadoutGenerateMask() set the mask values correctly");
    396346
    397         myFreeFPA(fpa);   
     347        psFree(fpa);   
    398348        psFree(camera);
    399349        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
     
    467417
    468418        ok(!errorFlag, "pmReadoutSetWeight() set the weight values correctly (Poisson)");
    469         myFreeFPA(fpa);   
     419        psFree(fpa);   
    470420        psFree(camera);
    471421        ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks");
    472422    }
    473 
    474 
    475 
    476 }
    477 
     423}
     424
Note: See TracChangeset for help on using the changeset viewer.