Changeset 6573
- Timestamp:
- Mar 13, 2006, 4:21:07 PM (20 years ago)
- Location:
- branches/rel10_ifa/psModules/src
- Files:
-
- 7 edited
-
astrom/Makefile.am (modified) (2 diffs)
-
astrom/pmFPAfile.c (modified) (8 diffs)
-
astrom/pmFPAfile.h (modified) (4 diffs)
-
astrom/pmFPAview.c (modified) (19 diffs)
-
astrom/pmFPAview.h (modified) (4 diffs)
-
objects/pmFPAviewReadObjects.c (modified) (4 diffs)
-
objects/pmFPAviewWriteObjects.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/Makefile.am
r6568 r6573 13 13 pmConceptsWrite.c \ 14 14 pmConceptsStandard.c \ 15 pmFPA file.c \16 pmFPA view.c15 pmFPAview.c \ 16 pmFPAfile.c 17 17 18 18 # pmFPAAstrometry.c … … 33 33 pmConceptsWrite.h \ 34 34 pmConceptsStandard.h \ 35 pmFPA file.h \36 pmFPA view.h35 pmFPAview.h \ 36 pmFPAfile.h 37 37 38 38 # pmFPAAstrometry.h -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.c
r6568 r6573 3 3 #include "pmHDU.h" 4 4 #include "pmFPA.h" 5 #include "pmFPAConstruct.h" 5 6 #include "pmFPAview.h" 6 7 #include "pmFPAfile.h" 8 #include "pmFPARead.h" 9 #include "pmFPAWrite.h" 7 10 #include "pmFPAviewObjectsIO.h" 8 11 … … 40 43 41 44 // XXX is a file allowed to be both READ and WRITE? 42 pmFPAfile *pmFPAfileDefine (p mFPAview *view, psMetadata *camera, char *name)45 pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name) 43 46 { 44 47 … … 49 52 psMetadata *data = psMetadataLookupPtr (&status, camera, name); 50 53 if (data == NULL) { 51 return false;54 return NULL; 52 55 } 53 56 … … 114 117 } 115 118 119 if (fpa == NULL) { 120 fpa = pmFPAConstruct (camera); 121 } 122 file->fpa = fpa; 123 124 psMetadataAddPtr (files, PS_LIST_TAIL, name, PS_META_REPLACE, "", file); 116 125 return (file); 117 126 } 118 127 119 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view , psMetadata *camera)128 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view) 120 129 { 121 130 … … 130 139 131 140 // determine the file name 132 file->filename = pmFPAviewNameFromRule (file->filerule, view );141 file->filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa); 133 142 134 143 // indirect filenames 135 144 if (!strcasecmp (file->filename, "@FPAIO")) { 136 extra = pmFPAviewNameFromRule (file->filextra, view );137 file->filename = psMetadataLookupStr (&status, view->IO, extra);145 extra = pmFPAviewNameFromRule (file->filextra, view, file->fpa); 146 file->filename = psMetadataLookupStr (&status, file->names, extra); 138 147 } 139 148 if (!strcasecmp (file->filename, "@DETDB")) { 140 extra = pmFPAviewNameFromRule (file->filextra, view );149 extra = pmFPAviewNameFromRule (file->filextra, view, file->fpa); 141 150 // file->filename = pmDetrendSelect (extra); 142 151 } … … 165 174 switch (file->type) { 166 175 case PM_FPA_FILE_IMAGE: 167 pmFPAviewReadFitsImage (view, file ->fits);176 pmFPAviewReadFitsImage (view, file); 168 177 break; 169 178 … … 216 225 } 217 226 227 bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view) 228 { 229 // is current depth == open depth? 230 pmFPAdepth depth = pmFPAviewDepth (view); 231 if (file->openDepth != depth) { 232 return false; 233 } 234 235 // check if we are actually open 236 psFitsClose (file->fits); 237 return true; 238 } 239 218 240 // attempt open and read for all pmFPAfiles in view->IO 219 bool pmFPAfileIOCheck (pmFPAview *view, psMetadata *camera) 220 { 221 241 bool pmFPAfileReadChecks (psMetadata *files, pmFPAview *view) 242 { 222 243 // recipe override values (command-line options): 223 244 psMetadataItem *item = NULL; 224 psMetadataIterator *iter = psMetadataIteratorAlloc ( view->IO, PS_LIST_HEAD, NULL);245 psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL); 225 246 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 226 247 pmFPAfile *file = item->data.V; 227 248 228 pmFPAfileOpen (file, view , camera);249 pmFPAfileOpen (file, view); 229 250 pmFPAfileRead (file, view); 230 251 } … … 232 253 return true; 233 254 } 255 256 // attempt open and read for all pmFPAfiles in view->IO 257 bool pmFPAfileWriteChecks (psMetadata *files, pmFPAview *view) 258 { 259 // recipe override values (command-line options): 260 psMetadataItem *item = NULL; 261 psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL); 262 while ((item = psMetadataGetAndIncrement (iter)) != NULL) { 263 pmFPAfile *file = item->data.V; 264 265 pmFPAfileWrite (file, view); 266 pmFPAfileClose (file, view); 267 } 268 psFree (iter); 269 return true; 270 } 271 272 psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type) 273 { 274 bool status; 275 psImage *image = NULL; 276 277 // I want an image from the 278 pmFPA *fpa = psMetadataLookupPtr (&status, files, name); 279 if (fpa == NULL) { 280 // use Nx or Ny == 0 to avoid creating an image 281 if (Nx*Ny <= 0) { 282 return NULL; 283 } 284 image = psImageAlloc (Nx, Ny, type); 285 return (image); 286 } 287 288 // inconsistent result: return NULL 289 pmReadout *readout = pmFPAviewThisReadout (view, fpa); 290 if (readout == NULL) { 291 return NULL; 292 } 293 294 // resize the existing readout??? this is wrong... 295 // need to allocate it if it does not exist... 296 image = psImageRecycle (readout->image, Nx, Ny, type); 297 psMemIncrRefCounter (image); 298 return (image); 299 } 300 301 # if (0) 302 // return the named pmFPAfile 303 pmFPAfile *pmFPAfileSelect (pmFPAview *view, char *name) 304 { 305 306 // select the name from the camera config data 307 pmFPAfile *file = psMetadataLookupPtr (&status, view->IO, name); 308 if (file == NULL) { 309 return NULL; 310 } 311 return file; 312 } 313 314 bool pmFPAfileWriteChecks (pmFPAview *view, char *name) 315 { 316 317 pmFPAfile *file = pmFPAfileSelect (view, name); 318 pmFPAfileWrite (file, view); 319 return true; 320 } 321 #endif 322 323 // given an already-opened fits file, read the components corresponding 324 // to the specified view 325 bool pmFPAviewReadFitsImage (pmFPAview *view, pmFPAfile *file) 326 { 327 pmFPA *fpa = file->fpa; 328 psFits *fits = file->fits; 329 330 if (view->chip == -1) { 331 pmFPARead (fpa, fits, NULL); 332 return true; 333 } 334 335 if (view->chip >= fpa->chips->n) { 336 return false; 337 } 338 pmChip *chip = fpa->chips->data[view->chip]; 339 340 if (view->cell == -1) { 341 pmChipRead (chip, fits, NULL); 342 return true; 343 } 344 345 if (view->cell >= chip->cells->n) { 346 return false; 347 } 348 pmCell *cell = chip->cells->data[view->cell]; 349 350 if (view->readout == -1) { 351 pmCellRead (cell, fits, NULL); 352 return true; 353 } 354 355 // XXX pmReadoutRead, pmReadoutReadSegement disabled for now 356 return false; 357 358 # if (0) 359 360 if (view->readout >= cell->readouts->n) { 361 return false; 362 } 363 pmReadout *readout = cell->readouts->data[view->readout]; 364 365 if (view->nRows == 0) { 366 pmReadoutRead (readout, fits, NULL); 367 } else { 368 pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); 369 } 370 return true; 371 # endif 372 } 373 374 // XXX image writes disabled for now 375 # if (0) 376 // given an already-opened fits file, write the components corresponding 377 // to the specified view 378 bool pmFPAviewWriteFitsImage (pmFPAview *view, pmFPAfile *file) 379 { 380 381 pmFPA *fpa = file->fpa; 382 psFits *fits = file->fits; 383 384 if (view->chip == -1) { 385 pmFPAWrite (fpa, fits, NULL, NULL); 386 return true; 387 } 388 389 if (view->chip >= fpa->chips->n) { 390 return false; 391 } 392 pmChip *chip = fpa->chips->data[view->chip]; 393 394 if (view->cell == -1) { 395 pmChipWrite (chip, fits, NULL, NULL); 396 return true; 397 } 398 399 if (view->cell >= chip->cells->n) { 400 return false; 401 } 402 pmCell *cell = chip->cells->data[view->cell]; 403 404 if (view->readout == -1) { 405 pmCellWrite (cell, fits, NULL, NULL); 406 return true; 407 } 408 409 if (view->readout >= cell->readouts->n) { 410 return false; 411 } 412 pmReadout *readout = cell->readouts->data[view->readout]; 413 414 if (view->nRows == 0) { 415 pmReadoutWrite (readout, fits, NULL, NULL); 416 } else { 417 pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); 418 } 419 return true; 420 } 421 # endif -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h
r6568 r6573 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03- 09 20:56:39$9 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-14 02:21:07 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 17 17 18 18 typedef enum { 19 PM_FPA_FILE_IMAGE,20 19 PM_FPA_FILE_SX, 21 20 PM_FPA_FILE_OBJ, … … 23 22 PM_FPA_FILE_CMF, 24 23 PM_FPA_FILE_RAW, 24 PM_FPA_FILE_IMAGE, 25 25 } pmFPAfileType; 26 26 … … 41 41 42 42 pmFPAfileType type; 43 44 psMetadata *names; 45 pmFPA *fpa; 43 46 } 44 47 pmFPAfile; 45 48 46 49 pmFPAfile *pmFPAfileAlloc (); 47 pmFPAfile *pmFPAfileDefine (p mFPAview *view, psMetadata *camera, char *name);48 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view , psMetadata *camera);50 pmFPAfile *pmFPAfileDefine (psMetadata *files, psMetadata *camera, pmFPA *fpa, char *name); 51 bool pmFPAfileOpen (pmFPAfile *file, pmFPAview *view); 49 52 bool pmFPAfileRead (pmFPAfile *file, pmFPAview *view); 50 53 bool pmFPAfileWrite (pmFPAfile *file, pmFPAview *view); 51 bool pmFPAfileIOCheck (pmFPAview *view, psMetadata *camera); 54 bool pmFPAfileClose (pmFPAfile *file, pmFPAview *view); 55 56 bool pmFPAfileReadChecks (psMetadata *files, pmFPAview *view); 57 bool pmFPAfileWriteChecks (psMetadata *files, pmFPAview *view); 58 59 psImage *pmFPAfileReadoutImage (psMetadata *files, pmFPAview *view, char *name, int Nx, int Ny, int type); 60 61 // read an image into the current view 62 bool pmFPAviewReadFitsImage (pmFPAview *view, pmFPAfile *file); 63 64 // write the components for the specified view 65 bool pmFPAviewWriteFitsImage (pmFPAview *view, pmFPAfile *file); 52 66 53 67 # endif -
branches/rel10_ifa/psModules/src/astrom/pmFPAview.c
r6568 r6573 3 3 * @author EAM, IfA 4 4 * 5 * @version $Revision: 1.1.2. 3$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 20:56:39$5 * @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-14 02:21:07 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #include "pmFPA.h" 18 18 #include "pmFPAview.h" 19 #include "pmFPARead.h"20 #include "pmFPAWrite.h"21 19 22 20 static void pmFPAviewFree (pmFPAview *view) 23 21 { 24 25 22 if (view == NULL) 26 23 return; 27 28 psFree (view->IO);29 24 return; 30 25 } 31 26 32 pmFPAview *pmFPAviewAlloc (pmFPA *fpa, psMetadata *camera, int nRows) 33 { 34 27 pmFPAview *pmFPAviewAlloc (int nRows) 28 { 35 29 pmFPAview *view = psAlloc (sizeof(pmFPAview)); 36 30 psMemSetDeallocator (view, (psFreeFunc) pmFPAviewFree); 37 38 view->fpa = fpa;39 view->nRows = nRows;40 view->camera = camera;41 31 42 32 view->chip = -1; 43 33 view->cell = -1; 44 34 view->readout = -1; 45 view->iRows = 0; 46 47 view->IO = psMetadataAlloc (); 35 view->iRows = 0; 36 view->nRows = nRows; 48 37 return (view); 49 38 } … … 64 53 } 65 54 66 pmChip *pmFPAviewThisChip (pmFPAview *view )55 pmChip *pmFPAviewThisChip (pmFPAview *view, pmFPA *fpa) 67 56 { 68 57 … … 71 60 } 72 61 73 if (view->chip >= view->fpa->chips->n) {74 return NULL; 75 } 76 77 pmChip *chip = view->fpa->chips->data[view->chip];62 if (view->chip >= fpa->chips->n) { 63 return NULL; 64 } 65 66 pmChip *chip = fpa->chips->data[view->chip]; 78 67 return chip; 79 68 } 80 69 81 pmChip *pmFPAviewNextChip (pmFPAview *view, int nStep) 82 { 83 70 pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep) 71 { 84 72 view->cell = -1; 85 73 view->readout = -1; … … 87 75 88 76 // if there are no available chips, return NULL 89 if ( view->fpa->chips->n <= 0) {77 if (fpa->chips->n <= 0) { 90 78 view->chip = -1; 91 79 return NULL; … … 101 89 102 90 // if we are at the end of the stack, return NULL 103 if (view->chip >= view->fpa->chips->n) {91 if (view->chip >= fpa->chips->n) { 104 92 view->chip = -1; 105 93 return NULL; … … 107 95 108 96 // get the correct chip pointer 109 pmChip *chip = view->fpa->chips->data[view->chip];97 pmChip *chip = fpa->chips->data[view->chip]; 110 98 return (chip); 111 99 } 112 100 113 pmCell *pmFPAviewThisCell (pmFPAview *view )101 pmCell *pmFPAviewThisCell (pmFPAview *view, pmFPA *fpa) 114 102 { 115 103 … … 118 106 } 119 107 120 pmChip *chip = pmFPAviewThisChip (view );108 pmChip *chip = pmFPAviewThisChip (view, fpa); 121 109 if (chip == NULL) { 122 110 return NULL; … … 131 119 } 132 120 133 pmCell *pmFPAviewNextCell (pmFPAview *view, int nStep)134 { 135 136 pmChip *chip = pmFPAviewThisChip (view );121 pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep) 122 { 123 124 pmChip *chip = pmFPAviewThisChip (view, fpa); 137 125 if (chip == NULL) { 138 126 return NULL; … … 167 155 } 168 156 169 pmReadout *pmFPAviewThisReadout (pmFPAview *view )157 pmReadout *pmFPAviewThisReadout (pmFPAview *view, pmFPA *fpa) 170 158 { 171 159 … … 174 162 } 175 163 176 pmCell *cell = pmFPAviewThisCell (view );164 pmCell *cell = pmFPAviewThisCell (view, fpa); 177 165 if (cell == NULL) { 178 166 return NULL; … … 187 175 } 188 176 189 pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep)190 { 191 192 pmCell *cell = pmFPAviewThisCell (view );177 pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep) 178 { 179 180 pmCell *cell = pmFPAviewThisCell (view, fpa); 193 181 if (cell == NULL) { 194 182 return NULL; … … 222 210 } 223 211 224 pmHDU *pmFPAviewThisHDU (pmFPAview *view )212 pmHDU *pmFPAviewThisHDU (pmFPAview *view, pmFPA *fpa) 225 213 { 226 214 … … 230 218 231 219 if (view->chip < 0) { 232 return pmHDUFromFPA ( view->fpa);220 return pmHDUFromFPA (fpa); 233 221 } 234 222 if (view->cell < 0) { 235 return pmHDUFromChip (pmFPAviewThisChip (view ));223 return pmHDUFromChip (pmFPAviewThisChip (view, fpa)); 236 224 } 237 225 if (view->readout < 0) { 238 return pmHDUFromCell (pmFPAviewThisCell (view ));226 return pmHDUFromCell (pmFPAviewThisCell (view, fpa)); 239 227 } 240 228 return NULL; … … 242 230 243 231 // select the rule from the camera configuration, perform substitutions as needed 244 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view )232 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view, pmFPA *fpa) 245 233 { 246 234 … … 250 238 251 239 if (strstr (newName, "{CHIP.NAME}") != NULL) { 252 pmChip *chip = pmFPAviewThisChip (view );240 pmChip *chip = pmFPAviewThisChip (view, fpa); 253 241 if (chip != NULL) { 254 242 char *name = psMetadataLookupStr (NULL, chip->concepts, "CHIP.NAME"); … … 259 247 } 260 248 if (strstr (newName, "{CELL.NAME}") != NULL) { 261 pmCell *cell = pmFPAviewThisCell (view );249 pmCell *cell = pmFPAviewThisCell (view, fpa); 262 250 if (cell != NULL) { 263 251 char *name = psMetadataLookupStr (NULL, cell->concepts, "CELL.NAME"); … … 268 256 } 269 257 if (strstr (newName, "{EXTNAME}") != NULL) { 270 pmHDU *hdu = pmFPAviewThisHDU (view );258 pmHDU *hdu = pmFPAviewThisHDU (view, fpa); 271 259 if (hdu->extname != NULL) { 272 260 newName = psStringSubstitute (newName, hdu->extname, "{EXTNAME}"); … … 275 263 return newName; 276 264 } 277 278 // given an already-opened fits file, read the components corresponding279 // to the specified view280 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits)281 {282 283 pmFPA *fpa = view->fpa;284 285 if (view->chip == -1) {286 pmFPARead (fpa, fits, NULL);287 return true;288 }289 290 if (view->chip >= fpa->chips->n) {291 return false;292 }293 pmChip *chip = fpa->chips->data[view->chip];294 295 if (view->cell == -1) {296 pmChipRead (chip, fits, NULL);297 return true;298 }299 300 if (view->cell >= chip->cells->n) {301 return false;302 }303 pmCell *cell = chip->cells->data[view->cell];304 305 if (view->readout == -1) {306 pmCellRead (cell, fits, NULL);307 return true;308 }309 310 // XXX pmReadoutRead, pmReadoutReadSegement disabled for now311 return false;312 313 # if (0)314 315 if (view->readout >= cell->readouts->n) {316 return false;317 }318 pmReadout *readout = cell->readouts->data[view->readout];319 320 if (view->nRows == 0) {321 pmReadoutRead (readout, fits, NULL);322 } else {323 pmReadoutReadSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);324 }325 return true;326 # endif327 }328 329 // XXX image writes disabled for now330 # if (0)331 // given an already-opened fits file, write the components corresponding332 // to the specified view333 bool pmFPAviewWriteFitsImage (pmFPAview *view, psFits *fits)334 {335 336 pmFPA *fpa = view->fpa;337 338 if (view->chip == -1) {339 pmFPAWrite (fpa, fits, NULL, NULL);340 return true;341 }342 343 if (view->chip >= fpa->chips->n) {344 return false;345 }346 pmChip *chip = fpa->chips->data[view->chip];347 348 if (view->cell == -1) {349 pmChipWrite (chip, fits, NULL, NULL);350 return true;351 }352 353 if (view->cell >= chip->cells->n) {354 return false;355 }356 pmCell *cell = chip->cells->data[view->cell];357 358 if (view->readout == -1) {359 pmCellWrite (cell, fits, NULL, NULL);360 return true;361 }362 363 if (view->readout >= cell->readouts->n) {364 return false;365 }366 pmReadout *readout = cell->readouts->data[view->readout];367 368 if (view->nRows == 0) {369 pmReadoutWrite (readout, fits, NULL, NULL);370 } else {371 pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL);372 }373 return true;374 }375 # endif -
branches/rel10_ifa/psModules/src/astrom/pmFPAview.h
r6568 r6573 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2. 3$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-03- 09 20:56:39$9 * @version $Revision: 1.1.2.4 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-03-14 02:21:07 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 30 30 typedef struct 31 31 { 32 pmFPA *fpa;33 psMetadata *IO;34 psMetadata *camera;35 32 int chip; 36 33 int cell; … … 38 35 int nRows; 39 36 int iRows; 37 pmFPA *fpa; 40 38 } 41 39 pmFPAview; 42 40 43 41 // allocate a pmFPAview structure for this fpa and camera 44 pmFPAview *pmFPAviewAlloc ( pmFPA *fpa, psMetadata *camera,int nRows);42 pmFPAview *pmFPAviewAlloc (int nRows); 45 43 46 44 // determine the current view depth … … 48 46 49 47 // return the currently selected chip for this view 50 pmChip *pmFPAviewThisChip (pmFPAview *view );48 pmChip *pmFPAviewThisChip (pmFPAview *view, pmFPA *fpa); 51 49 52 50 // advance view to the next chip 53 pmChip *pmFPAviewNextChip (pmFPAview *view, int nStep);51 pmChip *pmFPAviewNextChip (pmFPAview *view, pmFPA *fpa, int nStep); 54 52 55 53 // return the currently selected cell for this view 56 pmCell *pmFPAviewThisCell (pmFPAview *view );54 pmCell *pmFPAviewThisCell (pmFPAview *view, pmFPA *fpa); 57 55 58 56 // advance view to the next cell 59 pmCell *pmFPAviewNextCell (pmFPAview *view, int nStep);57 pmCell *pmFPAviewNextCell (pmFPAview *view, pmFPA *fpa, int nStep); 60 58 61 59 // return the currently selected readout for this view 62 pmReadout *pmFPAviewThisReadout (pmFPAview *view );60 pmReadout *pmFPAviewThisReadout (pmFPAview *view, pmFPA *fpa); 63 61 64 62 // advance view to the next readout 65 pmReadout *pmFPAviewNextReadout (pmFPAview *view, int nStep);63 pmReadout *pmFPAviewNextReadout (pmFPAview *view, pmFPA *fpa, int nStep); 66 64 67 65 // return the HDU corresponding to the current view 68 pmHDU *pmFPAviewThisHDU (pmFPAview *view );66 pmHDU *pmFPAviewThisHDU (pmFPAview *view, pmFPA *fpa); 69 67 70 68 // convert the rule to a name based on the current view 71 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view); 72 73 // read an image into the current view 74 bool pmFPAviewReadFitsImage (pmFPAview *view, psFits *fits); 75 76 // write the components for the specified view 77 bool pmFPAviewWriteFitsImage (pmFPAview *view, psFits *fits); 69 char *pmFPAviewNameFromRule (char *rule, pmFPAview *view, pmFPA *fpa); 78 70 79 71 # endif -
branches/rel10_ifa/psModules/src/objects/pmFPAviewReadObjects.c
r6556 r6573 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 03:14:23$5 * @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-14 02:21:07 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 30 30 bool pmFPAviewReadObjects (pmFPAview *view, pmFPAfile *file) 31 31 { 32 33 pmFPA *fpa = view->fpa; 32 pmFPA *fpa = file->fpa; 34 33 35 34 if (view->chip == -1) { … … 124 123 125 124 // read in header, if not yet loaded 126 hdu = pmFPAviewThisHDU (view );125 hdu = pmFPAviewThisHDU (view, file->fpa); 127 126 128 char *filename = pmFPAviewNameFromRule (file->filerule, view );127 char *filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa); 129 128 file->fits = psFitsOpen (filename, "r"); 130 129 hdu->header = psFitsReadHeader (NULL, file->fits); … … 135 134 case PM_FPA_FILE_CMF: 136 135 // read in header, if not yet loaded 137 hdu = pmFPAviewThisHDU (view );136 hdu = pmFPAviewThisHDU (view, file->fpa); 138 137 if (hdu->header == NULL) { 139 char *headname = pmFPAviewNameFromRule (file->extxtra, view );138 char *headname = pmFPAviewNameFromRule (file->extxtra, view, file->fpa); 140 139 psFitsMoveExtName (file->fits, headname); 141 140 hdu->header = psFitsReadHeader (NULL, file->fits); 142 141 } 143 142 144 char *dataname = pmFPAviewNameFromRule (file->extrule, view );143 char *dataname = pmFPAviewNameFromRule (file->extrule, view, file->fpa); 145 144 psFitsMoveExtName (file->fits, dataname); 146 145 sources = pmSourcesReadCMF (file->fits, hdu->header); -
branches/rel10_ifa/psModules/src/objects/pmFPAviewWriteObjects.c
r6556 r6573 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-03- 09 03:14:23$5 * @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-03-14 02:21:07 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 117 117 switch (file->type) { 118 118 case PM_FPA_FILE_OBJ: 119 filename = pmFPAviewNameFromRule (file->filerule, view );119 filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa); 120 120 pmSourcesWriteOBJ (sources, filename); 121 121 break; 122 122 123 123 case PM_FPA_FILE_SX: 124 filename = pmFPAviewNameFromRule (file->filerule, view );124 filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa); 125 125 pmSourcesWriteSX (sources, filename); 126 126 break; … … 128 128 case PM_FPA_FILE_CMP: 129 129 // a SPLIT format : only one header and object table per file 130 hdu = pmFPAviewThisHDU (view );131 filename = pmFPAviewNameFromRule (file->filerule, view );130 hdu = pmFPAviewThisHDU (view, file->fpa); 131 filename = pmFPAviewNameFromRule (file->filerule, view, file->fpa); 132 132 pmSourcesWriteCMP (sources, filename, hdu->header); 133 133 break; … … 135 135 case PM_FPA_FILE_CMF: 136 136 // write header, if not yet written? 137 hdu = pmFPAviewThisHDU (view );137 hdu = pmFPAviewThisHDU (view, file->fpa); 138 138 139 139 // XXX is this needed? is it automatically added? … … 143 143 if (hdu->header) { 144 144 psMetadataItem *mdi = NULL; 145 headname = pmFPAviewNameFromRule (file->extxtra, view );145 headname = pmFPAviewNameFromRule (file->extxtra, view, file->fpa); 146 146 147 147 // set NAXIS to 0 (we don't write out the data array) … … 156 156 psFitsWriteHeader (hdu->header, file->fits); 157 157 } 158 dataname = pmFPAviewNameFromRule (file->extrule, view );158 dataname = pmFPAviewNameFromRule (file->extrule, view, file->fpa); 159 159 pmSourcesWriteCMF (file->fits, sources, hdu->header, dataname); 160 160 break;
Note:
See TracChangeset
for help on using the changeset viewer.
