Changeset 7274
- Timestamp:
- Jun 1, 2006, 12:43:26 PM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 3 edited
-
pmFPA.c (modified) (25 diffs)
-
pmFPAHeader.c (modified) (3 diffs)
-
pmFPARead.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPA.c
r7173 r7274 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-0 5-23 01:09:48$14 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-06-01 22:43:26 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 136 136 void pmCellFreeReadouts(pmCell *cell) 137 137 { 138 PS_ASSERT_PTR_NON_NULL(cell,); 139 138 140 // 139 141 // Set the parent to NULL in all cell->readouts before psFree(cell->readouts) … … 156 158 void pmChipFreeCells(pmChip *chip) 157 159 { 160 PS_ASSERT_PTR_NON_NULL(chip,); 161 158 162 // 159 163 // Set the parent to NULL in all chip->cells before psFree(chip->cells) … … 175 179 void pmCellFreeData(pmCell *cell) 176 180 { 181 PS_ASSERT_PTR_NON_NULL(cell,); 182 177 183 pmCellFreeReadouts(cell); 178 184 if (cell->hdu) { … … 184 190 void pmChipFreeData(pmChip *chip) 185 191 { 192 PS_ASSERT_PTR_NON_NULL(chip,); 193 186 194 for (int i = 0; i < chip->cells->n; i++) { 187 195 pmCellFreeData(chip->cells->data[i]); … … 195 203 void pmFPAFreeData(pmFPA *fpa) 196 204 { 205 PS_ASSERT_PTR_NON_NULL(fpa,); 206 197 207 for (int i = 0; i < fpa->chips->n; i++) { 198 208 pmChipFreeData(fpa->chips->data[i]); … … 206 216 pmReadout *pmReadoutAlloc(pmCell *cell) 207 217 { 208 pmReadout *tmpReadout = (pmReadout *) psAlloc(sizeof(pmReadout));218 pmReadout *tmpReadout = (pmReadout *)psAlloc(sizeof(pmReadout)); 209 219 psMemSetDeallocator(tmpReadout, (psFreeFunc) readoutFree); 210 220 … … 215 225 tmpReadout->analysis = psMetadataAlloc(); 216 226 tmpReadout->parent = cell; 217 if (cell != NULL) {227 if (cell) { 218 228 cell->readouts = psArrayAdd(cell->readouts, 1, (psPtr) tmpReadout); 219 229 } … … 241 251 tmpCell->readouts = psArrayAlloc(0); 242 252 tmpCell->parent = chip; 243 if (chip != NULL) {253 if (chip) { 244 254 chip->cells = psArrayAdd(chip->cells, 1, (psPtr) tmpCell); 245 255 } … … 256 266 pmConceptsBlankCell(tmpCell); 257 267 258 return (tmpCell);268 return tmpCell; 259 269 } 260 270 … … 263 273 const char *name) 264 274 { 265 pmChip *tmpChip = (pmChip *)psAlloc(sizeof(pmChip));275 pmChip *tmpChip = (pmChip*)psAlloc(sizeof(pmChip)); 266 276 psMemSetDeallocator(tmpChip, (psFreeFunc) chipFree); 267 277 268 # if FPA_ASTROM278 #if FPA_ASTROM 269 279 270 280 tmpChip->col0 = 0; 271 tmpChip->row0 = 0;272 tmpChip->toFPA = NULL;273 tmpChip->fromFPA = NULL;274 # endif275 276 tmpChip->analysis = psMetadataAlloc();281 tmpChip->row0 = 0; 282 tmpChip->toFPA = NULL; 283 tmpChip->fromFPA = NULL; 284 # endif 285 286 tmpChip->analysis = psMetadataAlloc(); 277 287 tmpChip->cells = psArrayAlloc(0); 278 288 tmpChip->parent = fpa; 279 if (fpa != NULL) {280 psArrayAdd(fpa->chips, 1, (psPtr) tmpChip);289 if (fpa) { 290 psArrayAdd(fpa->chips, 1, (psPtr)tmpChip); 281 291 } 282 292 tmpChip->hdu = NULL; … … 292 302 } 293 303 pmConceptsBlankChip(tmpChip); 294 return (tmpChip);304 return tmpChip; 295 305 } 296 306 … … 300 310 psMemSetDeallocator(tmpFPA, (psFreeFunc) FPAFree); 301 311 302 # if FPA_ASTROM312 #if FPA_ASTROM 303 313 304 314 tmpFPA->fromTangentPlane = NULL; 305 tmpFPA->toTangentPlane = NULL;306 tmpFPA->projection = NULL;307 # endif308 309 tmpFPA->analysis = NULL;310 tmpFPA->camera = psMemIncrRefCounter((psPtr)camera);315 tmpFPA->toTangentPlane = NULL; 316 tmpFPA->projection = NULL; 317 # endif 318 319 tmpFPA->analysis = NULL; 320 tmpFPA->camera = psMemIncrRefCounter((psPtr)camera); 311 321 tmpFPA->chips = psArrayAlloc(0); 312 322 tmpFPA->hdu = NULL; … … 316 326 pmConceptsBlankFPA(tmpFPA); 317 327 318 return(tmpFPA); 319 } 320 321 static psBool cellCheckParents(pmCell *cell) 322 { 323 if (!cell) { 324 return(true); 325 } 326 psBool flag = true; 327 328 for (psS32 i = 0 ; i < cell->readouts->n ; i++) { 328 return tmpFPA; 329 } 330 331 static bool cellCheckParents(pmCell *cell) 332 { 333 PS_ASSERT_PTR_NON_NULL(cell, true); 334 335 bool flag = true; 336 for (long i = 0; i < cell->readouts->n ; i++) { 329 337 pmReadout *tmpReadout = (pmReadout *) cell->readouts->data[i]; 330 PS_ASSERT_PTR_NON_NULL(tmpReadout, false); 338 if (!tmpReadout) { 339 continue; 340 } 331 341 if (tmpReadout->parent != cell) { 332 342 tmpReadout->parent = cell; … … 334 344 } 335 345 } 336 return(flag); 337 } 338 339 static psBool chipCheckParents(pmChip *chip) 340 { 341 if (!chip) { 342 return(true); 343 } 344 psBool flag = true; 345 346 for (psS32 i = 0 ; i < chip->cells->n ; i++) { 346 return flag; 347 } 348 349 static bool chipCheckParents(pmChip *chip) 350 { 351 PS_ASSERT_PTR_NON_NULL(chip, true); 352 353 bool flag = true; 354 for (long i = 0; i < chip->cells->n ; i++) { 347 355 pmCell *tmpCell = (pmCell *) chip->cells->data[i]; 348 PS_ASSERT_PTR_NON_NULL(tmpCell, false); 356 if (!tmpCell) { 357 continue; 358 } 349 359 if (tmpCell->parent != chip) { 350 360 tmpCell->parent = chip; … … 354 364 flag &= cellCheckParents(tmpCell); 355 365 } 356 return (flag);366 return flag; 357 367 } 358 368 359 369 psBool pmFPACheckParents(pmFPA *fpa) 360 370 { 361 if (!fpa) { 362 return(true); 363 } 364 psBool flag = true; 365 366 for (psS32 i = 0 ; i < fpa->chips->n ; i++) { 371 PS_ASSERT_PTR_NON_NULL(fpa, true); 372 373 bool flag = true; 374 for (long i = 0; i < fpa->chips->n ; i++) { 367 375 pmChip *tmpChip = (pmChip *) fpa->chips->data[i]; 368 PS_ASSERT_PTR_NON_NULL(tmpChip, false); 376 if (!tmpChip) { 377 continue; 378 } 369 379 if (tmpChip->parent != fpa) { 370 380 tmpChip->parent = fpa; … … 374 384 flag &= chipCheckParents(tmpChip); 375 385 } 376 return (flag);386 return flag; 377 387 } 378 388 379 389 /** functions to turn on/off the file_exists flag **/ 380 bool pmFPASetFileStatus (pmFPA *fpa, bool status) 381 { 390 bool pmFPASetFileStatus(pmFPA *fpa, bool status) 391 { 392 PS_ASSERT_PTR_NON_NULL(fpa, false); 382 393 383 394 for (int i = 0; i < fpa->chips->n; i++) { … … 388 399 } 389 400 390 bool pmChipSetFileStatus (pmChip *chip, bool status) 391 { 401 bool pmChipSetFileStatus pmChip *chip, bool status) 402 { 403 PS_ASSERT_PTR_NON_NULL(chip, false); 392 404 393 405 chip->file_exists = status; … … 399 411 } 400 412 401 bool pmCellSetFileStatus (pmCell *cell, bool status) 402 { 413 bool pmCellSetFileStatus(pmCell *cell, bool status) 414 { 415 PS_ASSERT_PTR_NON_NULL(cell, false); 403 416 404 417 cell->file_exists = status; … … 411 424 412 425 /** functions to turn on/off the data_exists flag **/ 413 bool pmFPASetDataStatus (pmFPA *fpa, bool status) 414 { 426 bool pmFPASetDataStatus(pmFPA *fpa, bool status) 427 { 428 PS_ASSERT_PTR_NON_NULL(fpa, false); 415 429 416 430 for (int i = 0; i < fpa->chips->n; i++) { … … 421 435 } 422 436 423 bool pmChipSetDataStatus (pmChip *chip, bool status) 424 { 437 bool pmChipSetDataStatus(pmChip *chip, bool status) 438 { 439 PS_ASSERT_PTR_NON_NULL(chip, false); 425 440 426 441 chip->data_exists = status; … … 434 449 bool pmCellSetDataStatus (pmCell *cell, bool status) 435 450 { 451 PS_ASSERT_PTR_NON_NULL(cell, false); 436 452 437 453 cell->data_exists = status; … … 507 523 bool pmChipSelectCell(pmChip *chip, int cellNum, bool exclusive) 508 524 { 509 assert(chip);525 PS_ASSERT_PTR_NON_NULL(chip, false); 510 526 511 527 psArray *cells = chip->cells; // Component cells … … 548 564 int chipNum) 549 565 { 550 PS_ASSERT_PTR_NON_NULL(fpa, false);566 PS_ASSERT_PTR_NON_NULL(fpa, -1); 551 567 552 568 psArray *chips = fpa->chips; // Component chips … … 580 596 ) 581 597 { 582 assert(chip);598 PS_ASSERT_PTR_NON_NULL(chip, -1); 583 599 584 600 psArray *cells = chip->cells; // The component cells -
trunk/psModules/src/camera/pmFPAHeader.c
r7017 r7274 56 56 ) 57 57 { 58 PS_ASSERT_PTR_NON_NULL(cell, false); 59 PS_ASSERT_PTR_NON_NULL(fits, false); 60 58 61 if (!cell->hdu) { 59 62 return pmChipReadHeader(cell->parent, fits); … … 72 75 ) 73 76 { 77 PS_ASSERT_PTR_NON_NULL(chip, false); 78 PS_ASSERT_PTR_NON_NULL(fits, false); 79 74 80 if (!chip->hdu) { 75 81 return pmFPAReadHeader(chip->parent, fits); … … 88 94 ) 89 95 { 96 PS_ASSERT_PTR_NON_NULL(fpa, false); 97 PS_ASSERT_PTR_NON_NULL(fits, false); 98 90 99 if (!fpa->hdu) { 91 100 return false; -
trunk/psModules/src/camera/pmFPARead.c
r7204 r7274 33 33 psFree(regionString); 34 34 psFree(readout); 35 return NULL;35 return false; 36 36 } 37 37 psRegion region = psRegionSet(MAX(trimsec->x0 - readout->col0, 0), // x0 … … 59 59 psFree(regionString); 60 60 psFree(readout); 61 return NULL;61 return false; 62 62 } 63 63 psRegion region = psRegionSet(MAX(biassec->x0 - readout->col0, 0), // x0 … … 72 72 psFree(iter); 73 73 74 return readout;74 return true; 75 75 } 76 76 … … 326 326 327 327 pmReadout *readout = pmReadoutAlloc(cell); 328 readoutCarve(readout, image, trimsec, biassecs); 328 if (!readoutCarve(readout, image, trimsec, biassecs)) { 329 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to carve readout into image and bias sections.\n"); 330 return NULL; 331 } 329 332 readout->mask = NULL; 330 333 readout->weight = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
