Changeset 7726
- Timestamp:
- Jun 28, 2006, 9:21:35 AM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 2 edited
-
pmFPAfileFitsIO.c (modified) (4 diffs)
-
pmFPAfileIO.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileFitsIO.c
r7712 r7726 73 73 74 74 // given an already-opened fits file, write the components corresponding 75 // to the specified view 75 // to the specified view. when the file was opened, pmFPA/Chip/CellWrite was 76 // called on it with blank=true to write the (possible) blank PHU 77 // do NOT call the functions below with blank=true or they will write 78 // out data in an inconsistent fashion 79 // the calls below should recurse down the element to write out all components. 76 80 bool pmFPAviewWriteFitsImage (const pmFPAview *view, pmFPAfile *file) 77 81 { … … 84 88 // pmFPAWrite takes care of all PHUs as needed 85 89 if (view->chip == -1) { 86 pmFPAWrite(fpa, fits, NULL, true, true);90 pmFPAWrite(fpa, fits, NULL, false, true); 87 91 return true; 88 92 } … … 94 98 pmChip *chip = fpa->chips->data[view->chip]; 95 99 96 100 if (view->cell == -1) { 101 pmChipWrite (chip, fits, NULL, false, true); 102 return true; 103 } 104 105 if (view->cell >= chip->cells->n) { 106 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n); 107 return false; 108 } 109 pmCell *cell = chip->cells->data[view->cell]; 110 111 if (view->readout == -1) { 112 return pmCellWrite (cell, fits, NULL, false); 113 } 114 psError(PS_ERR_UNKNOWN, true, "Returning false"); 115 return false; 116 117 // XXX disable readout write for now 97 118 #if 0 98 // XXX This no longer required since we write the PHU at open. 99 100 // do we need to write out a PHU for this entry? 101 if (file->phu == NULL) { 119 120 if (view->readout >= cell->readouts->n) { 121 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d", 122 view->readout, cell->readouts->n); 123 return false; 124 } 125 pmReadout *readout = cell->readouts->data[view->readout]; 126 127 if (view->nRows == 0) { 128 pmReadoutWrite (readout, fits, NULL, NULL); 129 } else { 130 pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); 131 } 132 return true; 133 #endif 134 } 135 136 // this old code was used to write the blank by hand. 137 // pmFPAWrite now takes care of this choice. 138 # if 0 139 // do we need to write out a PHU for this entry? 140 if (file->phu == NULL) 141 { 102 142 pmHDU *hdu = pmFPAviewThisHDU (view, file->fpa); 103 143 pmHDU *phu = pmFPAviewThisPHU (view, file->fpa); … … 119 159 } 120 160 } 121 #endif 122 123 if (view->cell == -1) { 124 pmChipWrite (chip, fits, NULL, true, true); 125 return true; 126 } 127 128 if (view->cell >= chip->cells->n) { 129 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %d", view->cell, chip->cells->n); 130 return false; 131 } 132 pmCell *cell = chip->cells->data[view->cell]; 133 134 if (view->readout == -1) { 135 return pmCellWrite (cell, fits, NULL, true); 136 } 137 psError(PS_ERR_UNKNOWN, true, "Returning false"); 138 return false; 139 140 // XXX disable readout write for now 141 #if 0 142 143 if (view->readout >= cell->readouts->n) { 144 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouts->n == %d", 145 view->readout, cell->readouts->n); 146 return false; 147 } 148 pmReadout *readout = cell->readouts->data[view->readout]; 149 150 if (view->nRows == 0) { 151 pmReadoutWrite (readout, fits, NULL, NULL); 152 } else { 153 pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); 154 } 155 return true; 156 #endif 157 } 161 # endif 158 162 159 163 // given an already-opened fits file, read the components corresponding -
trunk/psModules/src/camera/pmFPAfileIO.c
r7711 r7726 98 98 // open the FITS types: 99 99 case PM_FPA_FILE_IMAGE: 100 case PM_FPA_FILE_CMF:101 100 psTrace ("pmFPAfile", 5, "opening %s (type: %d)\n", file->filename, file->type); 102 101 file->fits = psFitsOpen (file->filename, mode); … … 107 106 file->state = PM_FPA_STATE_OPEN; 108 107 109 // In some cases, I need to call pmFPAAddSourceFromHeader after I've opened the file 108 // In some cases, I need to call pmFPAAddSourceFromHeader after I've opened the file, 110 109 // specifically if I have not called this function on startup. This happens for the 111 110 // images supplied by the detrend database, which are only identified here (above). … … 160 159 } 161 160 if (file->mode == PM_FPA_MODE_WRITE) { 162 pmChip *chip;163 pmCell *cell;164 161 switch (file->fileLevel) { 165 162 case PM_FPA_LEVEL_FPA: 166 pmFPAWrite (file->fpa, file->fits, NULL, false, false);163 pmFPAWrite (file->fpa, file->fits, NULL, true, false); 167 164 break; 168 case PM_FPA_LEVEL_CHIP: 169 chip = pmFPAviewThisChip(view, file->fpa); 170 pmChipWrite (chip, file->fits, NULL, false, false); 171 break; 172 case PM_FPA_LEVEL_CELL: 173 cell = pmFPAviewThisCell(view, file->fpa); 174 pmCellWrite(cell, file->fits, NULL, false); 175 break; 165 case PM_FPA_LEVEL_CHIP: { 166 pmChip *chip = pmFPAviewThisChip(view, file->fpa); 167 pmChipWrite (chip, file->fits, NULL, true, false); 168 break; 169 } 170 case PM_FPA_LEVEL_CELL: { 171 pmCell *cell = pmFPAviewThisCell(view, file->fpa); 172 pmCellWrite(cell, file->fits, NULL, true); 173 break; 174 } 176 175 default: 177 176 psAbort ("pmFPAfileIO", "fileLevel not correctly set"); … … 179 178 } 180 179 } 180 break; 181 182 // open the FITS object files 183 case PM_FPA_FILE_CMF: 184 psTrace ("pmFPAfile", 5, "opening %s (type: %d)\n", file->filename, file->type); 185 file->fits = psFitsOpen (file->filename, mode); 186 if (file->fits == NULL) { 187 psError(PS_ERR_IO, false, "error opening file %s\n", file->filename); 188 return false; 189 } 190 file->state = PM_FPA_STATE_OPEN; 181 191 break; 182 192
Note:
See TracChangeset
for help on using the changeset viewer.
