Changeset 7278 for trunk/psModules/src/camera
- Timestamp:
- Jun 1, 2006, 2:55:23 PM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 15 edited
-
pmChipMosaic.c (modified) (6 diffs)
-
pmFPA.c (modified) (2 diffs)
-
pmFPAConstruct.c (modified) (10 diffs)
-
pmFPACopy.c (modified) (6 diffs)
-
pmFPACopy.h (modified) (1 diff)
-
pmFPAHeader.c (modified) (2 diffs)
-
pmFPARead.c (modified) (6 diffs)
-
pmFPAUtils.c (modified) (2 diffs)
-
pmFPAWrite.c (modified) (4 diffs)
-
pmFPA_JPEG.c (modified) (6 diffs)
-
pmFPAfile.c (modified) (28 diffs)
-
pmFPAview.c (modified) (13 diffs)
-
pmHDU.c (modified) (4 diffs)
-
pmHDUGenerate.c (modified) (3 diffs)
-
pmHDUUtils.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmChipMosaic.c
r7017 r7278 41 41 ) 42 42 { 43 assert(bounds); 44 assert(chip); 45 43 46 if (primary) { 44 47 *bounds = psRegionSet(INFINITY, 0, INFINITY, 0); … … 104 107 ) 105 108 { 109 assert(xBinChip); 110 assert(yBinChip); 111 assert(chip); 112 106 113 // Check that we've got the HDU in the chip or the FPA 107 114 if ((!chip->hdu || !chip->hdu->images) && (!chip->parent->hdu || !chip->parent->hdu->images)) { … … 358 365 ) 359 366 { 367 assert(target); 368 assert(sources); 369 assert(xBin > 0 && yBin > 0); 370 assert(trimsec); 371 360 372 bool success = true; // Result of setting everything 361 373 float gain = 0.0; // Gain … … 433 445 } 434 446 435 436 447 return success; 437 448 } … … 446 457 ) 447 458 { 459 assert(mosaicImage); 460 assert(mosaicMask); 461 assert(mosaicWeights); 462 assert(chip); 463 448 464 psArray *cells = chip->cells; // The array of cells 449 465 int numCells = cells->n; // Number of cells … … 587 603 ) 588 604 { 605 PS_ASSERT_PTR_NON_NULL(chip, false); 606 589 607 psImage *mosaicImage = NULL; // The mosaic image 590 608 psImage *mosaicMask = NULL; // The mosaic mask -
trunk/psModules/src/camera/pmFPA.c
r7274 r7278 12 12 * XXX: Should we implement non-linear cell->chip transforms? 13 13 * 14 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $15 * @date $Date: 2006-06-0 1 22:43:26$14 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 15 * @date $Date: 2006-06-02 00:55:22 $ 16 16 * 17 17 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 399 399 } 400 400 401 bool pmChipSetFileStatus pmChip *chip, bool status)401 bool pmChipSetFileStatus(pmChip *chip, bool status) 402 402 { 403 403 PS_ASSERT_PTR_NON_NULL(chip, false); -
trunk/psModules/src/camera/pmFPAConstruct.c
r7168 r7278 21 21 ) 22 22 { 23 assert(format); 24 assert(cellName && strlen(cellName) > 0); 25 23 26 bool status = true; // Result of MD lookup 24 27 psMetadata *cells = psMetadataLookupMD(&status, format, "CELLS"); // The CELLS … … 43 46 ) 44 47 { 48 assert(first); 49 assert(second); 50 assert(third); 51 assert(string && strlen(string) > 0); 52 45 53 bool allOK = true; // Everything was OK? 46 54 psList *values = psStringSplit(string, " ,;", true); // List of the parts … … 96 104 ) 97 105 { 106 assert(name && strlen(name) > 0); 107 assert(fileInfo); 108 assert(header); 109 98 110 bool mdok = true; // Result of MD lookup 99 111 psString keyword = psMetadataLookupStr(&mdok, fileInfo, name); … … 188 200 ) 189 201 { 202 assert(fileInfo); 203 assert(contents); 204 assert(header); 205 190 206 bool mdok = true; // Status of MD lookup 191 207 const char *contentHeaders = psMetadataLookupStr(&mdok, fileInfo, "CONTENT"); // Headers for content … … 237 253 assert(contents && strlen(contents) > 0); 238 254 assert(!cell || (cell && chip)); // Need both chip and cell if given a cell 255 assert(format); 239 256 240 257 if (hdu && level == PM_FPA_LEVEL_FPA) { … … 329 346 ) 330 347 { 348 assert(format); 349 331 350 bool mdok = true; // Status of MD lookup 332 351 psMetadata *file = psMetadataLookupMD(&mdok, format, "FILE"); // File information … … 363 382 ) 364 383 { 384 PS_ASSERT_PTR_NON_NULL(camera, NULL); 385 365 386 pmFPA *fpa = pmFPAAlloc(camera); // The FPA to fill out 366 387 … … 400 421 ) 401 422 { 402 assert(fpa);403 assert(phuView);404 assert(format);423 PS_ASSERT_PTR_NON_NULL(fpa, false); 424 PS_ASSERT_PTR_NON_NULL(phuView, false); 425 PS_ASSERT_PTR_NON_NULL(format, false); 405 426 406 427 // Where does the PHU go? … … 495 516 ) 496 517 { 497 assert(fpa);498 assert(phu);499 assert(format);518 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 519 PS_ASSERT_PTR_NON_NULL(phu, NULL); 520 PS_ASSERT_PTR_NON_NULL(format, NULL); 500 521 501 522 bool mdok = true; // Status from metadata lookups … … 689 710 ) 690 711 { 712 PS_ASSERT_PTR_NON_NULL(fpa,); 713 691 714 psTrace(__func__, 1, "FPA:\n"); 692 715 if (fpa->hdu) { -
trunk/psModules/src/camera/pmFPACopy.c
r7168 r7278 24 24 ) 25 25 { 26 assert(source); 27 26 28 psImage *copy = psMemIncrRefCounter(source); 27 29 bool copied = false; // Have the pixels been copied? … … 51 53 ) 52 54 { 55 assert(region); 56 assert(xBin > 0); 57 assert(yBin > 0); 58 53 59 // Want to include the lower bound: 1 binned by 4 --> 0; 3 binned by 4 --> 0; 4 binned by 4 --> 1 54 60 region->x0 = (int)(region->x0 / xBin); … … 62 68 ) 63 69 { 70 assert(cell); 71 64 72 if (cell->hdu && cell->hdu->phu) { 65 73 return cell->hdu; … … 274 282 assert(target); 275 283 assert(source); 284 assert(xBin > 0); 285 assert(yBin > 0); 276 286 277 287 psArray *targetCells = target->cells; // The target cells … … 300 310 } 301 311 302 static intfpaCopy(pmFPA *target, // The target FPA303 pmFPA *source, // The source FPA, to be copied304 bool pixels, // Copy the pixels?305 int xBin, int yBin // (Relative) binning factors in x and y306 )312 static bool fpaCopy(pmFPA *target, // The target FPA 313 pmFPA *source, // The source FPA, to be copied 314 bool pixels, // Copy the pixels? 315 int xBin, int yBin // (Relative) binning factors in x and y 316 ) 307 317 { 308 318 assert(target); 309 319 assert(source); 320 assert(xBin > 0); 321 assert(yBin > 0); 310 322 311 323 psArray *targetChips = target->chips; // The target chips … … 338 350 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 339 351 340 int pmFPACopy(pmFPA *target, // The target FPA 341 pmFPA *source // The source FPA, to be copied 342 ) 343 { 352 bool pmFPACopy(pmFPA *target, // The target FPA 353 pmFPA *source // The source FPA, to be copied 354 ) 355 { 356 PS_ASSERT_PTR_NON_NULL(target, false); 357 PS_ASSERT_PTR_NON_NULL(source, false); 344 358 return fpaCopy(target, source, true, 1, 1); 345 359 } 346 360 347 int pmChipCopy(pmChip *target, // The target chip 348 pmChip *source // The source chip, to be copied 349 ) 350 { 361 bool pmChipCopy(pmChip *target, // The target chip 362 pmChip *source // The source chip, to be copied 363 ) 364 { 365 PS_ASSERT_PTR_NON_NULL(target, false); 366 PS_ASSERT_PTR_NON_NULL(source, false); 351 367 return chipCopy(target, source, true, 1, 1); 352 368 } 353 369 354 int pmCellCopy(pmCell *target, // The target cell 355 pmCell *source // The source cell, to be copied 356 ) 357 { 370 bool pmCellCopy(pmCell *target, // The target cell 371 pmCell *source // The source cell, to be copied 372 ) 373 { 374 PS_ASSERT_PTR_NON_NULL(target, false); 375 PS_ASSERT_PTR_NON_NULL(source, false); 358 376 return cellCopy(target, source, true, 1, 1); 359 377 } 360 378 361 379 362 int pmFPACopyStructure(pmFPA *target, // The target FPA 363 pmFPA *source, // The source FPA, to be copied 364 int xBin, int yBin // Binning factors in x and y 365 ) 366 { 367 return fpaCopy(target, source, false, xBin, yBin); 368 } 369 370 int pmChipCopyStructure(pmChip *target, // The target chip 371 pmChip *source, // The source chip, to be copied 380 bool pmFPACopyStructure(pmFPA *target, // The target FPA 381 pmFPA *source, // The source FPA, to be copied 372 382 int xBin, int yBin // Binning factors in x and y 373 383 ) 374 384 { 385 PS_ASSERT_PTR_NON_NULL(target, false); 386 PS_ASSERT_PTR_NON_NULL(source, false); 387 PS_ASSERT_INT_POSITIVE(xBin, false); 388 PS_ASSERT_INT_POSITIVE(yBin, false); 389 return fpaCopy(target, source, false, xBin, yBin); 390 } 391 392 bool pmChipCopyStructure(pmChip *target, // The target chip 393 pmChip *source, // The source chip, to be copied 394 int xBin, int yBin // Binning factors in x and y 395 ) 396 { 397 PS_ASSERT_PTR_NON_NULL(target, false); 398 PS_ASSERT_PTR_NON_NULL(source, false); 399 PS_ASSERT_INT_POSITIVE(xBin, false); 400 PS_ASSERT_INT_POSITIVE(yBin, false); 375 401 return chipCopy(target, source, false, xBin, yBin); 376 402 } 377 403 378 int pmCellCopyStructure(pmCell *target, // The target cell 379 pmCell *source, // The source cell, to be copied 380 int xBin, int yBin // Binning factors in x and y 381 ) 382 { 404 bool pmCellCopyStructure(pmCell *target, // The target cell 405 pmCell *source, // The source cell, to be copied 406 int xBin, int yBin // Binning factors in x and y 407 ) 408 { 409 PS_ASSERT_PTR_NON_NULL(target, false); 410 PS_ASSERT_PTR_NON_NULL(source, false); 411 PS_ASSERT_INT_POSITIVE(xBin, false); 412 PS_ASSERT_INT_POSITIVE(yBin, false); 383 413 return cellCopy(target, source, false, xBin, yBin); 384 414 } -
trunk/psModules/src/camera/pmFPACopy.h
r7017 r7278 3 3 4 4 // Copy the FPA components, including the pixels 5 int pmFPACopy(pmFPA *target, // The target FPA 6 pmFPA *source // The source FPA, to be copied 7 ); 8 int pmChipCopy(pmChip *target, // The target chip 9 pmChip *source // The source chip, to be copied 5 bool pmFPACopy(pmFPA *target, // The target FPA 6 pmFPA *source // The source FPA, to be copied 10 7 ); 11 int pmCellCopy(pmCell *target, // The target cell 12 pmCell *source // The source cell, to be copied 13 ); 8 bool pmChipCopy(pmChip *target, // The target chip 9 pmChip *source // The source chip, to be copied 10 ); 11 bool pmCellCopy(pmCell *target, // The target cell 12 pmCell *source // The source cell, to be copied 13 ); 14 14 15 15 // Versions that copy the structure and not the pixels; they also allow binning 16 int pmFPACopyStructure(pmFPA *target, // The target FPA 17 pmFPA *source, // The source FPA, to be copied 18 int xBin, int yBin // Binning factors in x and y 19 ); 20 int pmChipCopyStructure(pmChip *target, // The target chip 21 pmChip *source, // The source chip, to be copied 22 int xBin, int yBin // Binning factors in x and y 16 bool pmFPACopyStructure(pmFPA *target, // The target FPA 17 pmFPA *source, // The source FPA, to be copied 18 int xBin, int yBin // Binning factors in x and y 23 19 ); 24 int pmCellCopyStructure(pmCell *target, // The target cell 25 pmCell *source, // The source cell, to be copied 26 int xBin, int yBin // Binning factors in x and y 27 ); 20 bool pmChipCopyStructure(pmChip *target, // The target chip 21 pmChip *source, // The source chip, to be copied 22 int xBin, int yBin // Binning factors in x and y 23 ); 24 bool pmCellCopyStructure(pmCell *target, // The target cell 25 pmCell *source, // The source cell, to be copied 26 int xBin, int yBin // Binning factors in x and y 27 ); 28 28 29 29 -
trunk/psModules/src/camera/pmFPAHeader.c
r7274 r7278 15 15 ) 16 16 { 17 assert(chip); 18 17 19 bool status = true; // Status of concept reading 18 20 status |= pmConceptsReadChip(chip, PM_CONCEPT_SOURCE_HEADER, false, NULL); … … 33 35 ) 34 36 { 37 assert(fpa); 38 35 39 bool status = true; // Status of concept reading 36 40 status |= pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL); -
trunk/psModules/src/camera/pmFPARead.c
r7274 r7278 27 27 ) 28 28 { 29 assert(readout); 30 assert(image); 31 assert(trimsec); 32 assert(biassecs); 33 29 34 // The image corresponding to the trim region 30 35 if (psRegionIsBad(*trimsec)) { … … 85 90 ) 86 91 { 92 assert(fits); 93 assert(region); 94 87 95 bool resize = false; // Do we need to resize the image once read? 88 96 psRegion toRead = psRegionSet(region->x0, region->x1, region->y0, region->y1); // Region to read … … 158 166 ) 159 167 { 168 PS_ASSERT_PTR_NON_NULL(readout, false); 169 PS_ASSERT_PTR_NON_NULL(fits, false); 170 PS_ASSERT_INT_NONNEGATIVE(z, false); 171 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 172 160 173 // Get the HDU and read the header 161 174 pmCell *cell = readout->parent; // The parent cell … … 298 311 ) 299 312 { 313 PS_ASSERT_PTR_NON_NULL(cell, false); 314 PS_ASSERT_PTR_NON_NULL(fits, false); 315 300 316 pmHDU *hdu = pmHDUFromCell(cell); // The HDU 301 317 if (!hdu) { … … 345 361 ) 346 362 { 363 PS_ASSERT_PTR_NON_NULL(chip, false); 364 PS_ASSERT_PTR_NON_NULL(fits, false); 365 347 366 bool success = false; // Were we able to read at least one HDU? 348 367 psArray *cells = chip->cells; // Array of cells … … 366 385 ) 367 386 { 387 PS_ASSERT_PTR_NON_NULL(fpa, false); 388 PS_ASSERT_PTR_NON_NULL(fits, false); 389 368 390 bool success = false; // Were we able to read at least one HDU? 369 391 psArray *chips = fpa->chips; // Array of chips -
trunk/psModules/src/camera/pmFPAUtils.c
r7017 r7278 9 9 ) 10 10 { 11 psArray *chips = fpa->chips; // Array of chips 11 PS_ASSERT_PTR_NON_NULL(fpa, -1); 12 PS_ASSERT_PTR_NON_NULL(name, -1); 13 if (strlen(name) == 0) { 14 return -1; 15 } 16 17 psArray *chips = fpa->chips; // Array of chips 12 18 for (int i = 0; i < chips->n; i++) { 13 19 pmChip *chip = chips->data[i]; // The chip of interest … … 27 33 ) 28 34 { 35 PS_ASSERT_PTR_NON_NULL(chip, -1); 36 PS_ASSERT_PTR_NON_NULL(name, -1); 37 if (strlen(name) == 0) { 38 return -1; 39 } 40 29 41 psArray *cells = chip->cells; // Array of cells 30 42 for (int i = 0; i < cells->n; i++) { -
trunk/psModules/src/camera/pmFPAWrite.c
r7249 r7278 16 16 ) 17 17 { 18 PS_ASSERT_PTR_NON_NULL(readout, false); 19 PS_ASSERT_PTR_NON_NULL(fits, false); 20 18 21 pmHDU *hdu = pmHDUFromReadout(readout); // The HDU to which to write 19 22 if (!hdu) { … … 87 90 ) 88 91 { 92 PS_ASSERT_PTR_NON_NULL(cell, false); 93 PS_ASSERT_PTR_NON_NULL(fits, false); 94 89 95 pmHDU *hdu = cell->hdu; // The HDU 90 96 if (!hdu) { … … 118 124 ) 119 125 { 126 PS_ASSERT_PTR_NON_NULL(chip, false); 127 PS_ASSERT_PTR_NON_NULL(fits, false); 128 120 129 pmHDU *hdu = chip->hdu; // The HDU 121 130 if (!hdu) { … … 156 165 ) 157 166 { 167 PS_ASSERT_PTR_NON_NULL(fpa, false); 168 PS_ASSERT_PTR_NON_NULL(fits, false); 169 158 170 pmHDU *hdu = fpa->hdu; // The HDU 159 171 if (!hdu) { -
trunk/psModules/src/camera/pmFPA_JPEG.c
r7017 r7278 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-0 5-01 01:55:43$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-06-02 00:55:22 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 29 29 30 bool pmFPAviewWriteJPEG (const pmFPAview *view, pmFPAfile *file)30 bool pmFPAviewWriteJPEG(const pmFPAview *view, pmFPAfile *file) 31 31 { 32 PS_ASSERT_PTR_NON_NULL(view, false); 33 PS_ASSERT_PTR_NON_NULL(file, false); 32 34 33 35 pmFPA *fpa = file->fpa; … … 70 72 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file) 71 73 { 74 PS_ASSERT_PTR_NON_NULL(fpa, false); 75 PS_ASSERT_PTR_NON_NULL(view, false); 76 PS_ASSERT_PTR_NON_NULL(file, false); 72 77 73 78 for (int i = 0; i < fpa->chips->n; i++) { … … 82 87 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file) 83 88 { 89 PS_ASSERT_PTR_NON_NULL(chip, false); 90 PS_ASSERT_PTR_NON_NULL(view, false); 91 PS_ASSERT_PTR_NON_NULL(file, false); 84 92 85 93 for (int i = 0; i < chip->cells->n; i++) { … … 94 102 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file) 95 103 { 104 PS_ASSERT_PTR_NON_NULL(cell, false); 105 PS_ASSERT_PTR_NON_NULL(view, false); 106 PS_ASSERT_PTR_NON_NULL(file, false); 96 107 97 108 for (int i = 0; i < cell->readouts->n; i++) { … … 106 117 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file) 107 118 { 119 PS_ASSERT_PTR_NON_NULL(readout, false); 120 PS_ASSERT_PTR_NON_NULL(view, false); 121 PS_ASSERT_PTR_NON_NULL(file, false); 122 108 123 char *name, *mode, *word, *mapname; 109 124 psArray *range; -
trunk/psModules/src/camera/pmFPAfile.c
r7249 r7278 22 22 #include "pmFPA_JPEG.h" 23 23 24 static void pmFPAfileFree (pmFPAfile *file) 25 { 26 27 if (file == NULL) 24 static void pmFPAfileFree(pmFPAfile *file) 25 { 26 if (!file) { 28 27 return; 28 } 29 29 30 30 psFree (file->fpa); … … 54 54 } 55 55 56 pmFPAfile *pmFPAfileAlloc () 57 { 58 59 pmFPAfile *file = psAlloc (sizeof(pmFPAfile)); 60 psMemSetDeallocator (file, (psFreeFunc) pmFPAfileFree); 56 pmFPAfile *pmFPAfileAlloc() 57 { 58 pmFPAfile *file = psAlloc(sizeof(pmFPAfile)); 59 psMemSetDeallocator(file, (psFreeFunc) pmFPAfileFree); 61 60 62 61 file->phu = NULL; … … 83 82 file->state = PM_FPA_STATE_CLOSED; 84 83 85 return (file); 86 } 87 88 pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name) 89 { 84 return file; 85 } 86 87 pmFPAfile *pmFPAfileDefine(psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name) 88 { 89 PS_ASSERT_PTR_NON_NULL(files, NULL); 90 PS_ASSERT_PTR_NON_NULL(camera, NULL); 91 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 92 PS_ASSERT_PTR_NON_NULL(name, NULL); 93 PS_ASSERT_INT_POSITIVE(strlen(name), NULL); 90 94 91 95 bool status; … … 243 247 bool pmFPAfileOpen (pmFPAfile *file, const pmFPAview *view) 244 248 { 249 PS_ASSERT_PTR_NON_NULL(file, false); 250 PS_ASSERT_PTR_NON_NULL(view, false); 245 251 246 252 bool status; … … 325 331 } 326 332 327 bool pmFPAfileRead (pmFPAfile *file, const pmFPAview *view) 328 { 333 bool pmFPAfileRead(pmFPAfile *file, const pmFPAview *view) 334 { 335 PS_ASSERT_PTR_NON_NULL(file, false); 336 PS_ASSERT_PTR_NON_NULL(view, false); 337 329 338 if (file->state & PM_FPA_STATE_INACTIVE) 330 339 return false; … … 378 387 } 379 388 380 bool pmFPAfileWrite (pmFPAfile *file, const pmFPAview *view) 381 { 389 bool pmFPAfileWrite(pmFPAfile *file, const pmFPAview *view) 390 { 391 PS_ASSERT_PTR_NON_NULL(file, false); 392 PS_ASSERT_PTR_NON_NULL(view, false); 382 393 383 394 if (file->state & PM_FPA_STATE_INACTIVE) { … … 436 447 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view) 437 448 { 449 PS_ASSERT_PTR_NON_NULL(file, false); 450 PS_ASSERT_PTR_NON_NULL(view, false); 451 438 452 if (file->state & PM_FPA_STATE_INACTIVE) { 439 453 return false; … … 478 492 bool pmFPAfileClose (pmFPAfile *file, const pmFPAview *view) 479 493 { 494 PS_ASSERT_PTR_NON_NULL(file, false); 495 PS_ASSERT_PTR_NON_NULL(view, false); 496 480 497 if (file->state & PM_FPA_STATE_INACTIVE) { 481 498 return false; … … 524 541 bool pmFPAfileActivate (psMetadata *files, bool state, char *name) 525 542 { 526 if (name == NULL) { 543 PS_ASSERT_PTR_NON_NULL(files, false); 544 545 if (!name) { 527 546 psMetadataItem *item = NULL; 528 547 psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL); … … 555 574 bool pmFPAfileIOChecks (psMetadata *files, const pmFPAview *view, pmFPAfilePlace place) 556 575 { 576 PS_ASSERT_PTR_NON_NULL(files, false); 577 PS_ASSERT_PTR_NON_NULL(view, false); 578 557 579 // recipe override values (command-line options): 558 580 psMetadataItem *item = NULL; … … 577 599 pmReadout *pmFPAfileCreateInternal (psMetadata *files, char *name, int Nx, int Ny, int type) 578 600 { 579 pmReadout *readout = pmReadoutAlloc (NULL); 580 readout->image = psImageAlloc (Nx, Ny, type); 601 PS_ASSERT_PTR_NON_NULL(files, false); 602 PS_ASSERT_PTR_NON_NULL(name, false); 603 PS_ASSERT_INT_POSITIVE(strlen(name), false); 604 605 pmReadout *readout = pmReadoutAlloc(NULL); 606 readout->image = psImageAlloc(Nx, Ny, type); 581 607 582 608 // I want an image from the … … 585 611 586 612 file->readout = readout; 587 psMetadataAddPtr (files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file);588 psFree (file);613 psMetadataAddPtr(files, PS_LIST_TAIL, name, PS_DATA_UNKNOWN, "", file); 614 psFree(file); 589 615 // we free this copy of file, but 'files' still has a copy 590 616 591 return (readout); 592 } 593 594 bool pmFPAfileDropInternal (psMetadata *files, char *name) 595 { 617 return readout; 618 } 619 620 bool pmFPAfileDropInternal(psMetadata *files, char *name) 621 { 622 PS_ASSERT_PTR_NON_NULL(files, false); 623 PS_ASSERT_PTR_NON_NULL(name, false); 624 PS_ASSERT_INT_POSITIVE(strlen(name), false); 625 596 626 bool status; 597 627 … … 610 640 pmReadout *pmFPAfileThisReadout (psMetadata *files, const pmFPAview *view, const char *name) 611 641 { 642 PS_ASSERT_PTR_NON_NULL(files, false); 643 PS_ASSERT_PTR_NON_NULL(view, false); 644 PS_ASSERT_PTR_NON_NULL(name, false); 645 PS_ASSERT_INT_POSITIVE(strlen(name), false); 646 612 647 bool status; 613 648 … … 629 664 bool pmFPAviewReadFitsImage (const pmFPAview *view, pmFPAfile *file) 630 665 { 666 PS_ASSERT_PTR_NON_NULL(view, false); 667 PS_ASSERT_PTR_NON_NULL(file, false); 668 631 669 bool status; 632 670 pmFPA *fpa = file->fpa; … … 680 718 bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file) 681 719 { 720 PS_ASSERT_PTR_NON_NULL(view, false); 721 PS_ASSERT_PTR_NON_NULL(file, false); 682 722 683 723 pmFPA *fpa = file->fpa; … … 748 788 pmFPAfile *pmFPAfileFromArgs (bool *found, pmConfig *config, char *filename, char *argname) 749 789 { 790 PS_ASSERT_PTR_NON_NULL(config, false); 791 PS_ASSERT_PTR_NON_NULL(filename, false); 792 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 793 PS_ASSERT_PTR_NON_NULL(argname, false); 794 PS_ASSERT_INT_POSITIVE(strlen(argname), false); 795 750 796 bool status; 751 797 pmFPA *fpa = NULL; … … 755 801 psMetadata *format = NULL; 756 802 757 if (*found) 758 return NULL; 803 if (*found) { 804 return NULL; 805 } 759 806 760 807 // we search the argument data for the named fileset (argname) 761 808 psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname); 762 if (!status) 763 return NULL; 764 if (infiles->n < 1) 765 return NULL; 809 if (!status) { 810 return NULL; 811 } 812 if (infiles->n < 1) { 813 return NULL; 814 } 766 815 767 816 // determine the current format from the header … … 836 885 pmFPAfile *pmFPAfileSetFromArgs (bool *found, pmConfig *config, char *filename, char *argname) 837 886 { 887 PS_ASSERT_PTR_NON_NULL(config, false); 888 PS_ASSERT_PTR_NON_NULL(filename, false); 889 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 890 PS_ASSERT_PTR_NON_NULL(argname, false); 891 PS_ASSERT_INT_POSITIVE(strlen(argname), false); 892 838 893 bool status; 839 894 pmFPA *fpa = NULL; … … 848 903 // we search the argument data for the named fileset (argname) 849 904 psArray *infiles = psMetadataLookupPtr(&status, config->arguments, argname); 850 if (!status) 851 return NULL; 852 if (infiles->n < 1) 853 return NULL; 905 if (!status) { 906 return NULL; 907 } 908 if (infiles->n < 1) { 909 return NULL; 910 } 854 911 855 912 // determine the current format from the header … … 914 971 pmFPAfile *pmFPAfileFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename) 915 972 { 973 PS_ASSERT_PTR_NON_NULL(config, false); 974 PS_ASSERT_PTR_NON_NULL(src, false); 975 PS_ASSERT_PTR_NON_NULL(filename, false); 976 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 977 916 978 // XXX pmFPAConstruct has many leaks (6919) 917 979 pmFPA *fpa = pmFPAConstruct (config->camera); … … 928 990 pmFPAfile *pmFPAfileFromConf (bool *found, pmConfig *config, char *filename, pmFPA *input) 929 991 { 992 PS_ASSERT_PTR_NON_NULL(config, false); 993 PS_ASSERT_PTR_NON_NULL(filename, false); 994 PS_ASSERT_INT_POSITIVE(strlen(filename), false); 995 PS_ASSERT_PTR_NON_NULL(input, false); 996 930 997 psFits *fits = NULL; 931 998 pmFPAfile *file = NULL; … … 934 1001 psArray *infiles = NULL; 935 1002 936 if (*found) 937 return NULL; 1003 if (*found) { 1004 return NULL; 1005 } 938 1006 939 1007 // a camera config is needed (as source of file rule) … … 951 1019 952 1020 // image names come from the file->name list? 953 if (!strcasecmp (file->filerule, "@FILES")) 1021 if (!strcasecmp (file->filerule, "@FILES")) { 954 1022 psAbort ("pmFPAfileFromConfig", "programming error"); 1023 } 955 1024 956 1025 // image needs to come from the detrend database … … 964 1033 infiles->data[0] = psStringCopy (file->filerule); 965 1034 } 966 if (infiles == NULL) 967 return NULL; 1035 if (infiles == NULL) { 1036 return NULL; 1037 } 968 1038 if (infiles->n < 1) { 969 1039 psFree (infiles); … … 1018 1088 bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode) 1019 1089 { 1090 PS_ASSERT_PTR_NON_NULL(files, false); 1091 PS_ASSERT_PTR_NON_NULL(name, false); 1092 PS_ASSERT_INT_POSITIVE(strlen(name), false); 1093 PS_ASSERT_PTR_NON_NULL(value, false); 1094 PS_ASSERT_INT_POSITIVE(strlen(value), false); 1020 1095 1021 1096 // add the output names to the output-type files … … 1036 1111 char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view) 1037 1112 { 1113 PS_ASSERT_PTR_NON_NULL(rule, NULL); 1114 PS_ASSERT_INT_POSITIVE(strlen(rule), NULL); 1115 PS_ASSERT_PTR_NON_NULL(file, NULL); 1116 PS_ASSERT_PTR_NON_NULL(view, NULL); 1038 1117 1039 1118 char *newName = NULL; // destination for resulting name … … 1078 1157 bool pmFPAfileCopyView (pmFPA *out, pmFPA *in, const pmFPAview *view) 1079 1158 { 1159 PS_ASSERT_PTR_NON_NULL(out, false); 1160 PS_ASSERT_PTR_NON_NULL(in, false); 1161 PS_ASSERT_PTR_NON_NULL(view, false); 1162 1080 1163 // pmFPAWrite takes care of all PHUs as needed 1081 1164 if (view->chip == -1) { … … 1112 1195 bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, psMetadata *format, int xBin, int yBin, const pmFPAview *view) 1113 1196 { 1197 PS_ASSERT_PTR_NON_NULL(out, false); 1198 PS_ASSERT_PTR_NON_NULL(in, false); 1199 PS_ASSERT_PTR_NON_NULL(format, false); 1200 PS_ASSERT_PTR_NON_NULL(view, false); 1201 1114 1202 // pmFPAWrite takes care of all PHUs as needed 1115 1203 if (view->chip == -1) { -
trunk/psModules/src/camera/pmFPAview.c
r7017 r7278 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-0 5-01 01:55:43$5 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-06-02 00:55:22 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 19 19 #include "pmFPAview.h" 20 20 21 static void pmFPAviewFree (pmFPAview *view) 22 { 23 if (view == NULL) 24 return; 21 static void pmFPAviewFree(pmFPAview *view) 22 { 23 // No reason to keep this function, apart from the fact that it allows us to type the memBlock 25 24 return; 26 25 } 27 26 28 pmFPAview *pmFPAviewAlloc (int nRows)29 { 30 pmFPAview *view = psAlloc (sizeof(pmFPAview));31 psMemSetDeallocator (view, (psFreeFunc) pmFPAviewFree);27 pmFPAview *pmFPAviewAlloc(int nRows) 28 { 29 pmFPAview *view = psAlloc(sizeof(pmFPAview)); 30 psMemSetDeallocator(view, (psFreeFunc) pmFPAviewFree); 32 31 33 32 view->chip = -1; … … 36 35 view->iRows = 0; 37 36 view->nRows = nRows; 38 return (view); 39 } 40 41 pmFPAdepth pmFPAviewDepth (const pmFPAview *view) 42 { 37 return view; 38 } 39 40 pmFPAdepth pmFPAviewDepth(const pmFPAview *view) 41 { 42 PS_ASSERT_PTR_NON_NULL(view, PM_FPA_DEPTH_NONE); 43 43 44 44 if (view->chip < 0) { … … 54 54 } 55 55 56 pmChip *pmFPAviewThisChip (const pmFPAview *view, pmFPA *fpa) 57 { 56 pmChip *pmFPAviewThisChip(const pmFPAview *view, pmFPA *fpa) 57 { 58 PS_ASSERT_PTR_NON_NULL(view, NULL); 59 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 58 60 59 61 if (view->chip < 0) { … … 69 71 } 70 72 71 pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep) 72 { 73 pmChip *pmFPAviewNextChip(pmFPAview *view, pmFPA *fpa, int nStep) 74 { 75 PS_ASSERT_PTR_NON_NULL(view, NULL); 76 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 77 73 78 view->cell = -1; 74 79 view->readout = -1; … … 100 105 } 101 106 102 pmCell *pmFPAviewThisCell (const pmFPAview *view, pmFPA *fpa) 103 { 107 pmCell *pmFPAviewThisCell(const pmFPAview *view, pmFPA *fpa) 108 { 109 PS_ASSERT_PTR_NON_NULL(view, NULL); 110 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 104 111 105 112 if (view->cell < 0) { … … 108 115 109 116 pmChip *chip = pmFPAviewThisChip (view, fpa); 110 if (chip == NULL) { 111 return NULL; 112 } 117 PS_ASSERT_PTR_NON_NULL(chip, NULL); 113 118 114 119 if (view->cell >= chip->cells->n) { … … 122 127 pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep) 123 128 { 129 PS_ASSERT_PTR_NON_NULL(view, NULL); 130 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 124 131 125 132 pmChip *chip = pmFPAviewThisChip (view, fpa); 126 if (chip == NULL) { 127 return NULL; 128 } 133 PS_ASSERT_PTR_NON_NULL(chip, NULL); 129 134 130 135 view->readout = -1; … … 158 163 pmReadout *pmFPAviewThisReadout (const pmFPAview *view, pmFPA *fpa) 159 164 { 165 PS_ASSERT_PTR_NON_NULL(view, NULL); 166 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 160 167 161 168 if (view->readout < 0) { … … 164 171 165 172 pmCell *cell = pmFPAviewThisCell (view, fpa); 166 if (cell == NULL) { 167 return NULL; 168 } 173 PS_ASSERT_PTR_NON_NULL(cell, NULL); 169 174 170 175 if (view->readout >= cell->readouts->n) { … … 178 183 pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep) 179 184 { 185 PS_ASSERT_PTR_NON_NULL(view, NULL); 186 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 180 187 181 188 pmCell *cell = pmFPAviewThisCell (view, fpa); 182 if (cell == NULL) { 183 return NULL; 184 } 189 PS_ASSERT_PTR_NON_NULL(cell, NULL); 185 190 186 191 view->iRows = 0; … … 211 216 } 212 217 213 pmHDU *pmFPAviewThisHDU (const pmFPAview *view, pmFPA *fpa) 214 { 218 pmHDU *pmFPAviewThisHDU(const pmFPAview *view, pmFPA *fpa) 219 { 220 PS_ASSERT_PTR_NON_NULL(view, NULL); 221 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 222 215 223 // the HDU is attached to a cell, chip or fpa 216 224 // if this view has a -1 for the level which contains the hdu, … … 229 237 } 230 238 231 pmHDU *pmFPAviewThisPHU (const pmFPAview *view, pmFPA *fpa) 232 { 239 pmHDU *pmFPAviewThisPHU(const pmFPAview *view, pmFPA *fpa) 240 { 241 PS_ASSERT_PTR_NON_NULL(view, NULL); 242 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 243 233 244 // select the HDU which corresponds to the PHU containing this view 234 245 -
trunk/psModules/src/camera/pmHDU.c
r7241 r7278 61 61 psMemSetDeallocator(hdu, (psFreeFunc)hduFree); 62 62 63 if (! extname || strlen(extname) == 0) {63 if (!extname || strlen(extname) == 0) { 64 64 hdu->phu = true; 65 65 hdu->extname = psStringCopy("PHU"); … … 86 86 ) 87 87 { 88 assert(hdu);89 assert(fits);88 PS_ASSERT_PTR_NON_NULL(hdu, false); 89 PS_ASSERT_PTR_NON_NULL(fits, false); 90 90 91 91 // Move to the appropriate extension … … 113 113 ) 114 114 { 115 assert(hdu);116 assert(fits);115 PS_ASSERT_PTR_NON_NULL(hdu, false); 116 PS_ASSERT_PTR_NON_NULL(fits, false); 117 117 118 118 // Read the header; includes the move … … 159 159 ) 160 160 { 161 assert(hdu);162 assert(fits);161 PS_ASSERT_PTR_NON_NULL(hdu, false); 162 PS_ASSERT_PTR_NON_NULL(fits, false); 163 163 164 164 psTrace(__func__, 7, "Writing HDU %s\n", hdu->extname); -
trunk/psModules/src/camera/pmHDUGenerate.c
r7257 r7278 437 437 ) 438 438 { 439 PS_ASSERT_PTR_NON_NULL(cell, false); 440 439 441 // Get the HDU and a list of cells below it 440 442 pmHDU *hdu = pmHDUFromCell(cell); // The HDU in the cell … … 487 489 ) 488 490 { 491 PS_ASSERT_PTR_NON_NULL(chip, false); 492 489 493 // Get the HDU and a list of cells below it 490 494 pmHDU *hdu = pmHDUFromChip(chip); // The HDU in the chip … … 536 540 ) 537 541 { 542 PS_ASSERT_PTR_NON_NULL(fpa, false); 543 538 544 // Get the HDU and a list of cells below it 539 545 pmHDU *hdu = pmHDUFromFPA(fpa); // The HDU in the FPA -
trunk/psModules/src/camera/pmHDUUtils.c
r7168 r7278 8 8 ) 9 9 { 10 PS_ASSERT_PTR_NON_NULL(fpa, NULL); 10 11 return fpa->hdu; 11 12 } … … 14 15 ) 15 16 { 17 PS_ASSERT_PTR_NON_NULL(chip, NULL); 18 16 19 pmHDU *hdu = chip->hdu; // The HDU information 17 20 if (!hdu) { … … 25 28 ) 26 29 { 30 PS_ASSERT_PTR_NON_NULL(cell, NULL); 31 27 32 pmHDU *hdu = cell->hdu; // The HDU information 28 33 if (!hdu) { … … 33 38 } 34 39 35 pmHDU *pmHDUFromReadout (pmReadout *readout)40 pmHDU *pmHDUFromReadout(pmReadout *readout) 36 41 { 42 PS_ASSERT_PTR_NON_NULL(readout, NULL); 37 43 38 44 pmCell *cell = readout->parent; // cell containing this readout; 39 pmHDU *hdu = pmHDUFromCell (cell);45 pmHDU *hdu = pmHDUFromCell(cell); 40 46 return hdu; 41 47 } … … 64 70 ) 65 71 { 72 PS_ASSERT_PTR_NON_NULL(hdu,); 73 66 74 if (hdu->phu) { 67 75 psTrace(__func__, level, "HDU: %s (PHU)\n", hdu->extname);
Note:
See TracChangeset
for help on using the changeset viewer.
