Changeset 6743
- Timestamp:
- Mar 30, 2006, 3:33:07 PM (20 years ago)
- Location:
- branches/rel10_ifa/psModules/src/astrom
- Files:
-
- 6 edited
-
pmChipMosaic.c (modified) (1 diff)
-
pmConceptsStandard.c (modified) (3 diffs)
-
pmConceptsWrite.c (modified) (5 diffs)
-
pmFPA.c (modified) (3 diffs)
-
pmFPAConstruct.c (modified) (2 diffs)
-
pmFPACopy.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmChipMosaic.c
r6448 r6743 358 358 } 359 359 360 numChips++;361 pmChipMosaic(chip, xBinChip, yBinChip); // Mosaic of cells within the chip362 360 if (pmChipMosaic(chip, xBinChip, yBinChip) > 0) { 361 numChips++; 362 } 363 363 } 364 364 -
branches/rel10_ifa/psModules/src/astrom/pmConceptsStandard.c
r6734 r6743 489 489 490 490 // Otherwise, there's no formatting required 491 return concept;491 return psMemIncrRefCounter(concept); 492 492 } 493 493 … … 508 508 509 509 // No formatting required 510 return concept;510 return psMemIncrRefCounter(concept); 511 511 } 512 512 … … 561 561 if (strstr(format, "PRE2000")) { 562 562 psError(PS_ERR_IO, true, "Don't you realise it's the twenty-first century?\n"); 563 return false;563 return NULL; 564 564 } 565 565 if (strstr(format, "BACKWARDS")) { 566 566 psError(PS_ERR_IO, true, "You want it BACKWARDS? Not right now, thanks.\n"); 567 return false;567 return NULL; 568 568 } 569 569 -
branches/rel10_ifa/psModules/src/astrom/pmConceptsWrite.c
r6734 r6743 204 204 psTrace(__func__, 8, "Writing %s to header %s\n", name, cameraItem->data.V); 205 205 writeHeader(hdu, cameraItem->data.V, formatted); 206 continue; 207 } 208 if (strcasecmp(source, "VALUE") == 0) { 206 } else if (strcasecmp(source, "VALUE") == 0) { 209 207 psTrace(__func__, 8, "Checking %s against camera format.\n", name); 210 208 if (! compareConcepts(cameraItem, formatted)) { … … 212 210 "format, but the values don't match.\n", name); 213 211 } 214 continue; 212 } else { 213 psLogMsg(__func__, PS_LOG_WARN, "Concept source %s isn't HEADER or VALUE --- can't " 214 "write\n", nameSource); 215 215 } 216 psLogMsg(__func__, PS_LOG_WARN, "Concept source %s isn't HEADER or VALUE --- can't " 217 "write\n", nameSource); 218 continue; 219 } 220 // Assume it's specified by value 221 if (! compareConcepts(cameraItem, formatted)) { 216 } else if (! compareConcepts(cameraItem, formatted)) { 217 // Assume it's specified by value 222 218 psLogMsg(__func__, PS_LOG_WARN, "Concept %s is specified by value in the camera " 223 219 "format, but the values don't match.\n", name); 224 220 } 221 psFree(formatted); 222 psFree(nameSource); 225 223 } 226 224 … … 232 230 } 233 231 234 232 // XXX: Needs the .DEPEND stuff 235 233 bool pmConceptsWriteToDefaults(psMetadata *specs, // The concept specifications 236 234 pmFPA *fpa, // The FPA … … 266 264 "format, but the values don't match.\n"); 267 265 } 266 psFree(formatted); 268 267 } 269 268 } … … 331 330 writeHeader(hdu, keyword, formatted); 332 331 } 332 psFree(formatted); 333 psFree(keywords); 333 334 } 334 335 } -
branches/rel10_ifa/psModules/src/astrom/pmFPA.c
r6713 r6743 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1.1.4. 5$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-03- 28 02:16:26$14 * @version $Revision: 1.1.4.6 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-03-31 01:33:07 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 38 38 static void readoutFree(pmReadout *readout) 39 39 { 40 if (readout != NULL) { 41 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t) readout, (size_t) readout->parent); 42 if (readout->parent) { 43 psArray *readouts = readout->parent->readouts; 44 for (int i = 0; i < readouts->n; i++) { 45 if (readouts->data[i] == readout) { 46 // pmReadout *tmpReadout = readouts->data[i]; 47 readouts->data[i] = NULL; 48 #if PARENT_LINKS 49 50 psFree(tmpReadout); 51 #endif 52 53 break; 54 } 40 psTrace(__func__, 9, "Removing readout %lx from cell %lx...\n", (size_t) readout, (size_t) readout->parent); 41 if (readout->parent) { 42 psArray *readouts = readout->parent->readouts; 43 for (int i = 0; i < readouts->n; i++) { 44 if (readouts->data[i] == readout) { 45 // pmReadout *tmpReadout = readouts->data[i]; 46 readouts->data[i] = NULL; 47 #if PARENT_LINKS 48 49 psFree(tmpReadout); 50 #endif 51 52 break; 55 53 } 56 54 } 57 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout);58 59 #if PARENT_LINKS 60 61 psFree(readout->parent); 62 #endif63 64 psFree(readout->image); 65 psFree(readout->mask);66 psFree(readout->weight);67 psFree(readout->analysis);68 psFree(readout->bias);69 }55 } 56 psTrace(__func__, 9, "Freeing readout %lx\n", (size_t) readout); 57 58 #if PARENT_LINKS 59 60 psFree(readout->parent); 61 #endif 62 63 psFree(readout->image); 64 psFree(readout->mask); 65 psFree(readout->weight); 66 psFree(readout->analysis); 67 psFree(readout->bias); 70 68 } 71 69 72 70 static void cellFree(pmCell *cell) 73 71 { 74 if (cell != NULL) { 75 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 76 if (cell->parent) { 77 psArray *cells = cell->parent->cells; 78 for (int i = 0; i < cells->n; i++) { 79 if (cells->data[i] == cell) { 80 // pmCell *tmpCell = cells->data[i]; 81 cells->data[i] = NULL; 82 #if PARENT_LINKS 83 84 psFree(tmpCell); 85 #endif 86 87 break; 88 } 72 psTrace(__func__, 9, "Removing cell %lx from chip %lx...\n", (size_t)cell, (size_t)cell->parent); 73 if (cell->parent) { 74 psArray *cells = cell->parent->cells; 75 for (int i = 0; i < cells->n; i++) { 76 if (cells->data[i] == cell) { 77 // pmCell *tmpCell = cells->data[i]; 78 cells->data[i] = NULL; 79 #if PARENT_LINKS 80 81 psFree(tmpCell); 82 #endif 83 84 break; 89 85 } 90 86 } 91 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell);92 93 pmCellFreeReadouts(cell); 94 psFree(cell->readouts);95 #if PARENT_LINKS96 97 psFree(cell->parent); 98 #endif99 100 psFree(cell->concepts); 101 psFree(cell->analysis);102 psFree(cell->config);103 psFree(cell->hdu);104 }87 } 88 psTrace(__func__, 9, "Freeing cell %lx\n", (size_t)cell); 89 90 pmCellFreeReadouts(cell); 91 psFree(cell->readouts); 92 #if PARENT_LINKS 93 94 psFree(cell->parent); 95 #endif 96 97 psFree(cell->concepts); 98 psFree(cell->analysis); 99 psFree(cell->config); 100 psFree(cell->hdu); 105 101 } 106 102 107 103 static void chipFree(pmChip* chip) 108 104 { 109 if (chip != NULL) { 110 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent); 111 if (chip->parent) { 112 psArray *chips = chip->parent->chips; 113 for (int i = 0; i < chips->n; i++) { 114 if (chips->data[i] == chip) { 115 // pmChip *tmpChip = chips->data[i]; 116 chips->data[i] = NULL; 117 #if PARENT_LINKS 118 119 psFree(tmpChip); 120 #endif 121 122 break; 123 } 105 psTrace(__func__, 9, "Removing chip %lx from fpa %lx...\n", (size_t)chip, (size_t)chip->parent); 106 if (chip->parent) { 107 psArray *chips = chip->parent->chips; 108 for (int i = 0; i < chips->n; i++) { 109 if (chips->data[i] == chip) { 110 // pmChip *tmpChip = chips->data[i]; 111 chips->data[i] = NULL; 112 #if PARENT_LINKS 113 114 psFree(tmpChip); 115 #endif 116 117 break; 124 118 } 125 119 } 126 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip);127 128 pmChipFreeCells(chip); 129 psFree(chip->cells);130 #if PARENT_LINKS131 132 psFree(chip->parent); 133 #endif134 135 #if 0 136 137 psFree(chip->toFPA); 138 psFree(chip->fromFPA);139 #endif140 141 psFree(chip->concepts); 142 psFree(chip->analysis);143 psFree(chip->hdu);144 }120 } 121 psTrace(__func__, 9, "Freeing chip %lx\n", (size_t)chip); 122 123 pmChipFreeCells(chip); 124 psFree(chip->cells); 125 #if PARENT_LINKS 126 127 psFree(chip->parent); 128 #endif 129 130 #if 0 131 132 psFree(chip->toFPA); 133 psFree(chip->fromFPA); 134 #endif 135 136 psFree(chip->concepts); 137 psFree(chip->analysis); 138 psFree(chip->hdu); 145 139 } 146 140 … … 148 142 static void FPAFree(pmFPA *fpa) 149 143 { 150 if (fpa != NULL) { 151 psTrace(__func__, 9, "Freeing fpa %lx\n", (size_t)fpa); 152 #if 0 153 154 psFree(fpa->fromTangentPlane); 155 psFree(fpa->toTangentPlane); 156 psFree(fpa->projection); 157 #endif 158 159 psFree(fpa->concepts); 160 psFree(fpa->analysis); 161 psFree(fpa->camera); 162 // 163 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) 164 // in order to avoid memory reference counter problems. 165 // 166 psArray *chips = fpa->chips; 167 for (psS32 i = 0 ; i < chips->n ; i++) { 168 pmChip *tmpChip = chips->data[i]; 169 if (! tmpChip) { 170 continue; 171 } 172 chips->data[i] = NULL; 173 tmpChip->parent = NULL; 174 if (PS_FREE_HIERARCHY == 1) { 175 psFree(tmpChip); 176 } 177 } 178 psFree(fpa->chips); 179 psFree(fpa->hdu); 180 } 144 psTrace(__func__, 9, "Freeing fpa %lx\n", (size_t)fpa); 145 #if 0 146 147 psFree(fpa->fromTangentPlane); 148 psFree(fpa->toTangentPlane); 149 psFree(fpa->projection); 150 #endif 151 152 psFree(fpa->concepts); 153 psFree(fpa->analysis); 154 psFree(fpa->camera); 155 // 156 // Set the parent to NULL in all fpa->chips before psFree(fpa->chips) 157 // in order to avoid memory reference counter problems. 158 // 159 psArray *chips = fpa->chips; 160 for (psS32 i = 0 ; i < chips->n ; i++) { 161 pmChip *tmpChip = chips->data[i]; 162 if (! tmpChip) { 163 continue; 164 } 165 chips->data[i] = NULL; 166 tmpChip->parent = NULL; 167 if (PS_FREE_HIERARCHY == 1) { 168 psFree(tmpChip); 169 } 170 } 171 psFree(fpa->chips); 172 psFree(fpa->hdu); 181 173 } 182 174 -
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
r6740 r6743 373 373 374 374 // Put in the extension 375 if (chip->hdu ) {376 if (chip->hdu != hdu) {377 psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s\n", chipName);378 psFree(chip->hdu); // Make way!379 }380 } else{375 if (chip->hdu && chip->hdu != hdu) { 376 psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s\n", chipName); 377 psFree(chip->hdu); // Make way! 378 chip->hdu = NULL; 379 } 380 if (!chip->hdu) { 381 381 chip->hdu = psMemIncrRefCounter(hdu); 382 382 } … … 437 437 438 438 // Put in the extension 439 if (cell->hdu ) {440 if (cell->hdu != hdu) {441 psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s, cell %s\n", chipName,442 cellName);443 psFree(cell->hdu);444 }445 } else{439 if (cell->hdu && cell->hdu != hdu) { 440 psLogMsg(__func__, PS_LOG_WARN, "Overwriting HDU in chip %s, cell %s\n", chipName, 441 cellName); 442 psFree(cell->hdu); 443 cell->hdu = NULL; 444 } 445 if (! cell->hdu) { 446 446 cell->hdu = psMemIncrRefCounter(hdu); 447 447 } -
branches/rel10_ifa/psModules/src/astrom/pmFPACopy.c
r6734 r6743 307 307 // Get the size of the HDU, either from existing trimsec and biassec, or generate these and try again 308 308 int xSize = 0, ySize = 0; // Size of HDU 309 #if 1310 311 309 if (!sizeHDU(&xSize, &ySize, targetCells) && !(generateTrimBias(targetCells, sourceCells) && 312 310 sizeHDU(&xSize, &ySize, targetCells))) { … … 314 312 return false; 315 313 } 316 #else 317 if (!sizeHDU(&xSize, &ySize, targetCells)) { 318 if (generateTrimBias(targetCells, sourceCells)) { 319 if (!sizeHDU(&xSize, &ySize, targetCells)) { 320 psError(PS_ERR_IO, true, "Unable to determine size of HDU!\n"); 321 return false; 322 } 323 } else { 324 psError(PS_ERR_IO, true, "Unable to determine size of HDU!\n"); 325 return false; 326 } 327 } 328 #endif 314 psFree(targetCells); 315 psFree(sourceCells); 329 316 330 317 hdu->images = psArrayAlloc(numReadouts); … … 509 496 } else { 510 497 copyPixels(hdu->images->data[i], sourceImage, *trimsec, xFlip, yFlip); 511 targetReadout->image = ps MemIncrRefCounter(psImageSubset(hdu->images->data[i], *trimsec));498 targetReadout->image = psImageSubset(hdu->images->data[i], *trimsec); 512 499 } 513 500 … … 532 519 } else { 533 520 copyPixels(hdu->images->data[i], bias, *biassec, xFlip, yFlip); 534 psImage *newBias = ps MemIncrRefCounter(psImageSubset(hdu->images->data[i], *biassec));521 psImage *newBias = psImageSubset(hdu->images->data[i], *biassec); 535 522 psListAdd(targetReadout->bias, PS_LIST_TAIL, newBias); 536 523 psFree(newBias); // Drop reference 537 524 } 538 525 } 526 psFree(targetReadout); // Drop reference 539 527 psFree(biassecsIter); 540 528 psFree(biasIter); … … 551 539 } 552 540 } 541 psFree(conceptsIter); 553 542 554 543 // Need to update CELL.X0 and CELL.Y0 if we flipped
Note:
See TracChangeset
for help on using the changeset viewer.
