Changeset 15987 for trunk/psModules/test/camera/tap_pmFPAMaskW.c
- Timestamp:
- Jan 2, 2008, 10:53:30 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/camera/tap_pmFPAMaskW.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/camera/tap_pmFPAMaskW.c
r14882 r15987 6 6 #include "pstap.h" 7 7 // XXX: Use better name for the temporary FITS file 8 // XXX: The code to generate and free the FPA hierarchy was copied from9 // tap-pmFPA.c. EIther include it directly, or library, or something.10 // Also, get rid of the manual free functions and use psFree() once11 // it correctly frees child members12 8 // XXX: For the genSimpleFPA() code, add IDs to each function so that 13 9 // the values set in each chip-?cell-?hdu-?image are unique … … 98 94 cell->hdu = pmHDUAlloc("cellExtName"); 99 95 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"); 104 101 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 } 106 106 } 107 107 … … 119 119 120 120 //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);122 121 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. 124 123 psMetadataRemoveKey(cell->concepts, "CELL.TRIMSEC"); 125 124 psMetadataAddPtr(cell->concepts, PS_LIST_TAIL|PS_META_REPLACE, "CELL.TRIMSEC", PS_DATA_REGION, "I am a region", region); … … 139 138 psMetadataAddS32(chip->analysis, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 140 139 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 148 141 psArrayRealloc(chip->cells, NUM_CELLS); 149 142 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 } 156 145 return(chip); 157 146 } … … 170 159 psMetadataAddS32((psMetadata *) fpa->camera, PS_LIST_HEAD, MISC_NAME, 0, NULL, MISC_NUM); 171 160 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 // }178 161 179 162 psArrayRealloc(fpa->chips, NUM_CHIPS); 180 163 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 } 186 166 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 192 167 return(fpa); 193 }194 195 // XXX: This should only be necessary until the psFree() functions for196 // FPA/chip/cell/readout correctly free all child chips/cells/readouts197 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);218 168 } 219 169 … … 309 259 } 310 260 ok(!errorFlag, "pmReadoutSetMask() set the mask values correctly"); 311 myFreeFPA(fpa);261 psFree(fpa); 312 262 psFree(camera); 313 263 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 395 345 ok(!errorFlag, "pmReadoutGenerateMask() set the mask values correctly"); 396 346 397 myFreeFPA(fpa);347 psFree(fpa); 398 348 psFree(camera); 399 349 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); … … 467 417 468 418 ok(!errorFlag, "pmReadoutSetWeight() set the weight values correctly (Poisson)"); 469 myFreeFPA(fpa);419 psFree(fpa); 470 420 psFree(camera); 471 421 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 472 422 } 473 474 475 476 } 477 423 } 424
Note:
See TracChangeset
for help on using the changeset viewer.
