Changeset 24792 for trunk/psModules/src/camera/pmFPARead.c
- Timestamp:
- Jul 14, 2009, 6:38:05 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPARead.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPARead.c
r24058 r24792 141 141 // Determine number of readouts in the FITS file 142 142 // In the process, reads the header and concepts 143 static boolcellNumReadouts(pmCell *cell, // Cell of interest143 static int cellNumReadouts(pmCell *cell, // Cell of interest 144 144 psFits *fits, // FITS file 145 145 pmConfig *config // Configuration … … 153 153 if (!hdu || hdu->blankPHU) { 154 154 psError(PS_ERR_IO, true, "Unable to find HDU"); 155 return false;155 return 0; 156 156 } 157 157 if (!pmCellReadHeader(cell, fits, config)) { 158 158 psError(PS_ERR_IO, false, "Unable to read header for cell!\n"); 159 return false;159 return 0; 160 160 } 161 161 if (!pmConceptsReadCell(cell, PM_CONCEPT_SOURCE_HEADER | PM_CONCEPT_SOURCE_CELLS, true, NULL)) { 162 162 psError(PS_ERR_IO, false, "Failed to read concepts for cell.\n"); 163 return false;163 return 0; 164 164 } 165 165 … … 169 169 if (!mdok) { 170 170 psError(PS_ERR_IO, true, "Unable to find NAXIS in header for extension %s\n", hdu->extname); 171 return false; 172 } 171 return 0; 172 } 173 173 174 if (naxis == 0) { 174 175 // No pixels to read 175 176 psError(PS_ERR_IO, true, "No pixels in extension %s.", hdu->extname); 176 return false;177 return 0; 177 178 } 178 179 if (naxis < 2 || naxis > 3) { 179 180 psError(PS_ERR_IO, true, "NAXIS in header of extension %s (= %d) is not valid.\n", 180 181 hdu->extname, naxis); 181 return false;182 return 0; 182 183 } 183 184 int naxis3; // Number of image planes … … 186 187 if (!mdok) { 187 188 psError(PS_ERR_IO, true, "Unable to find NAXIS3 in header for extension %s\n", hdu->extname); 188 return false;189 return 0; 189 190 } 190 191 } else { … … 294 295 static bool readoutMore(pmReadout *readout, // Readout of interest 295 296 psFits *fits, // FITS file 296 int z, // Plane number 297 int z, // Plane number to read 298 int *zMax, // Max plane number in this cell 297 299 int numScans, // Number of scans to read at a time 298 300 fpaReadType type, // Type of image … … 308 310 // N readouts, but numScans set to 0. only the first should report that it requires data, 309 311 // even if all readouts lack the image pointer. 310 if (!image) { 312 if (numScans == 0) { 313 if (!image) { 311 314 return true; 312 } 313 314 // If we have already read an image, this result implies we are done (no more to read) 315 if (numScans == 0) { 316 return false; 315 } else { 316 return false; 317 } 317 318 } 318 319 … … 322 323 return false; 323 324 } 324 int naxis3= cellNumReadouts(cell, fits, config); // Number of planes325 if (z >= naxis3) {325 *zMax = cellNumReadouts(cell, fits, config); // Number of planes 326 if (z >= *zMax) { 326 327 // No more to read 327 328 return false; … … 484 485 psFits *fits, // FITS file 485 486 int z, // Desired image plane 487 int *zMax, // Max plane number in this cell 486 488 int numScans, // Number of scans (row or col depends on CELL.READDIR); 0 for all 487 489 int overlap, // Number of scans (row/col) to overlap between scans … … 509 511 510 512 int naxis3 = cellNumReadouts(cell, fits, config); // Number of image planes 513 if (zMax) *zMax = naxis3; 514 511 515 if (z >= naxis3) { 512 516 psError(PS_ERR_IO, false, "Desired image plane (%d) exceeds available number (%d).", … … 1021 1025 1022 1026 1023 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)1027 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, pmConfig *config) 1024 1028 { 1025 1029 PS_ASSERT_PTR_NON_NULL(readout, false); 1026 1030 PS_ASSERT_FITS_NON_NULL(fits, false); 1027 1031 1028 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE, config);1029 } 1030 1031 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap, pmConfig *config)1032 return readoutMore(readout, fits, z, zMax, numScans, FPA_READ_TYPE_IMAGE, config); 1033 } 1034 1035 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, int overlap, pmConfig *config) 1032 1036 { 1033 1037 PS_ASSERT_PTR_NON_NULL(readout, false); … … 1036 1040 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 1037 1041 1038 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE, config);1042 return readoutReadChunk(readout, fits, z, zMax, numScans, overlap, FPA_READ_TYPE_IMAGE, config); 1039 1043 } 1040 1044 … … 1044 1048 PS_ASSERT_FITS_NON_NULL(fits, false); 1045 1049 1046 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE, config);1050 return readoutReadChunk(readout, fits, z, NULL, 0, 0, FPA_READ_TYPE_IMAGE, config); 1047 1051 } 1048 1052 … … 1084 1088 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1085 1089 1086 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)1090 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, pmConfig *config) 1087 1091 { 1088 1092 PS_ASSERT_PTR_NON_NULL(readout, false); 1089 1093 PS_ASSERT_FITS_NON_NULL(fits, false); 1090 1094 1091 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_MASK, config);1092 } 1093 1094 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap,1095 return readoutMore(readout, fits, z, zMax, numScans, FPA_READ_TYPE_MASK, config); 1096 } 1097 1098 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, int overlap, 1095 1099 pmConfig *config) 1096 1100 { … … 1100 1104 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 1101 1105 1102 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK, config);1106 return readoutReadChunk(readout, fits, z, zMax, numScans, overlap, FPA_READ_TYPE_MASK, config); 1103 1107 } 1104 1108 … … 1108 1112 PS_ASSERT_FITS_NON_NULL(fits, false); 1109 1113 1110 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK, config);1114 return readoutReadChunk(readout, fits, z, NULL, 0, 0, FPA_READ_TYPE_MASK, config); 1111 1115 } 1112 1116 … … 1139 1143 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1140 1144 1141 bool pmReadoutMoreVariance(pmReadout *readout, psFits *fits, int z, int numScans, pmConfig *config)1145 bool pmReadoutMoreVariance(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, pmConfig *config) 1142 1146 { 1143 1147 PS_ASSERT_PTR_NON_NULL(readout, false); 1144 1148 PS_ASSERT_FITS_NON_NULL(fits, false); 1145 1149 1146 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_VARIANCE, config);1147 } 1148 1149 bool pmReadoutReadChunkVariance(pmReadout *readout, psFits *fits, int z, int numScans, int overlap,1150 return readoutMore(readout, fits, z, zMax, numScans, FPA_READ_TYPE_VARIANCE, config); 1151 } 1152 1153 bool pmReadoutReadChunkVariance(pmReadout *readout, psFits *fits, int z, int *zMax, int numScans, int overlap, 1150 1154 pmConfig *config) 1151 1155 { … … 1155 1159 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 1156 1160 1157 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_VARIANCE, config);1161 return readoutReadChunk(readout, fits, z, zMax, numScans, overlap, FPA_READ_TYPE_VARIANCE, config); 1158 1162 } 1159 1163 … … 1163 1167 PS_ASSERT_FITS_NON_NULL(fits, false); 1164 1168 1165 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_VARIANCE, config);1169 return readoutReadChunk(readout, fits, z, NULL, 0, 0, FPA_READ_TYPE_VARIANCE, config); 1166 1170 } 1167 1171
Note:
See TracChangeset
for help on using the changeset viewer.
