Changeset 7249
- Timestamp:
- May 30, 2006, 7:18:05 PM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 3 edited
-
pmFPAWrite.c (modified) (3 diffs)
-
pmFPAWrite.h (modified) (1 diff)
-
pmFPAfile.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAWrite.c
r7168 r7249 84 84 psFits *fits, // FITS file to which to write 85 85 psDB *db, // Database handle for "concepts" update 86 bool pixels // Write the pixels ?86 bool pixels // Write the pixels, or only the PHU header? 87 87 ) 88 88 { 89 89 pmHDU *hdu = cell->hdu; // The HDU 90 if (hdu && ((!pixels && hdu->phu) || pixels)) { 91 if (pixels && !hdu->images && !pmHDUGenerateForCell(cell)) { 92 psError(PS_ERR_IO, false, "Unable to generate HDU for cell.\n"); 93 return false; 94 } 95 bool status = pmConceptsWriteCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 96 PM_CONCEPT_SOURCE_DEFAULTS, false, NULL); 97 status &= pmHDUWrite(hdu, fits); 98 if (!status) { 99 psError(PS_ERR_IO, false, "Unable to write HDU for Chip.\n"); 100 return false; 101 } 90 if (!hdu) { 91 return true; // We wrote every HDU that exists 102 92 } 103 93 104 return true; 94 bool success = true; // Success of writing 95 if ((!pixels && hdu->phu && !hdu->images) || // Data-less PHU 96 (pixels && (hdu->images || (!hdu->images && pmHDUGenerateForCell(cell) && hdu->images)))) { // Data 97 success &= pmConceptsWriteCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 98 PM_CONCEPT_SOURCE_DEFAULTS, false, NULL); 99 success &= pmHDUWrite(hdu, fits); 100 } 101 102 if (!success) { 103 psError(PS_ERR_IO, false, "Unable to write HDU for Chip.\n"); 104 return false; 105 } 106 107 // No lower levels to which to recurse 108 109 return success; 105 110 } 106 111 … … 109 114 psFits *fits, // FITS file to which to write 110 115 psDB *db, // Database handle for "concepts" update 111 bool pixels // Write the pixels? 116 bool pixels, // Write the pixels, or only the PHU header? 117 bool recurse // Recurse to lower levels? 112 118 ) 113 119 { 114 120 pmHDU *hdu = chip->hdu; // The HDU 115 if (hdu && ((!pixels && hdu->phu) || pixels)) { 116 if (pixels && !hdu->images && !pmHDUGenerateForChip(chip)) { 117 psError(PS_ERR_IO, false, "Unable to generate HDU for chip.\n"); 118 return false; 119 } 120 bool status = pmConceptsWriteChip(chip, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 121 PM_CONCEPT_SOURCE_DEFAULTS, false, NULL); 122 status &= pmHDUWrite(hdu, fits); 123 if (!status) { 124 psError(PS_ERR_IO, false, "Unable to write HDU for Chip.\n"); 125 return false; 126 } 121 if (!hdu) { 122 return true; // We wrote every HDU that exists 127 123 } 128 124 129 125 bool success = true; // Success of writing 130 if (pixels) { 126 if ((!pixels && hdu->phu && !hdu->images) || // Data-less PHU 127 (pixels && (hdu->images || (!hdu->images && pmHDUGenerateForChip(chip) && hdu->images)))) { // Data 128 success &= pmConceptsWriteChip(chip, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 129 PM_CONCEPT_SOURCE_DEFAULTS, false, NULL); 130 success &= pmHDUWrite(hdu, fits); 131 } 132 133 if (!success) { 134 psError(PS_ERR_IO, false, "Unable to write HDU for Chip.\n"); 135 return false; 136 } 137 138 if (recurse) { 131 139 psArray *cells = chip->cells; // Array of cells 132 140 for (int i = 0; i < cells->n; i++) { 133 141 pmCell *cell = cells->data[i]; // The cell of interest 134 success |= pmCellWrite(cell, fits, db, true);142 success &= pmCellWrite(cell, fits, db, pixels); 135 143 } 136 144 } … … 144 152 psFits *fits, // FITS file to which to write 145 153 psDB *db, // Database handle for "concepts" update 146 bool pixels // Write the pixels? 154 bool pixels, // Write the pixels, or only the PHU header? 155 bool recurse // Recurse to lower levels? 147 156 ) 148 157 { 149 158 pmHDU *hdu = fpa->hdu; // The HDU 150 if (hdu && ((!pixels && hdu->phu) || pixels)) { 151 if (pixels && !hdu->images && !pmHDUGenerateForFPA(fpa)) { 152 psError(PS_ERR_IO, false, "Unable to generate HDU for FPA.\n"); 153 return false; 154 } 155 bool status = pmConceptsWriteFPA(fpa, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 156 PM_CONCEPT_SOURCE_DEFAULTS, NULL); 157 status &= pmHDUWrite(hdu, fits); 158 if (!status) { 159 psError(PS_ERR_IO, false, "Unable to write HDU for FPA.\n"); 160 return false; 161 } 159 if (!hdu) { 160 return true; // We wrote every HDU that exists 162 161 } 163 162 164 163 bool success = true; // Success of writing 165 if (pixels) { 164 if ((!pixels && hdu->phu && !hdu->images) || // Data-less PHU 165 (pixels && (hdu->images || (!hdu->images && pmHDUGenerateForFPA(fpa) && hdu->images)))) { // Data 166 success &= pmConceptsWriteFPA(fpa, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CAMERA | 167 PM_CONCEPT_SOURCE_DEFAULTS, NULL); 168 success &= pmHDUWrite(hdu, fits); 169 } 170 171 if (!success) { 172 psError(PS_ERR_IO, false, "Unable to write HDU for FPA.\n"); 173 return false; 174 } 175 176 if (recurse) { 166 177 psArray *chips = fpa->chips; // Array of chips 167 178 for (int i = 0; i < chips->n; i++) { 168 179 pmChip *chip = chips->data[i]; // The chip of interest 169 success |= pmChipWrite(chip, fits, db, true);180 success &= pmChipWrite(chip, fits, db, pixels, true); 170 181 } 171 182 } -
trunk/psModules/src/camera/pmFPAWrite.h
r7017 r7249 13 13 psFits *fits, // FITS file to which to write 14 14 psDB *db, // Database handle for "concepts" update 15 bool pixels // Write the pixels ?15 bool pixels // Write the pixels, or only the PHU header? 16 16 ); 17 17 bool pmChipWrite(pmChip *chip, // Chip to write 18 18 psFits *fits, // FITS file to which to write 19 19 psDB *db, // Database handle for "concepts" update 20 bool pixels // Write the pixels? 20 bool pixels, // Write the pixels, or only the PHU header? 21 bool recurse // Recurse to lower levels? 21 22 ); 22 23 bool pmFPAWrite(pmFPA *fpa, // FPA to write 23 24 psFits *fits, // FITS file to which to write 24 25 psDB *db, // Database handle for "concepts" update 25 bool pixels // Write the pixels? 26 bool pixels, // Write the pixels, or only the PHU header? 27 bool recurse // Recurse to lower levels? 26 28 ); 27 29 -
trunk/psModules/src/camera/pmFPAfile.c
r7150 r7249 686 686 // pmFPAWrite takes care of all PHUs as needed 687 687 if (view->chip == -1) { 688 pmFPAWrite (fpa, fits, NULL, true);688 pmFPAWrite(fpa, fits, NULL, true, true); 689 689 return true; 690 690 } … … 712 712 713 713 if (view->cell == -1) { 714 pmChipWrite (chip, fits, NULL, true );714 pmChipWrite (chip, fits, NULL, true, true); 715 715 return true; 716 716 }
Note:
See TracChangeset
for help on using the changeset viewer.
