Changeset 10421 for trunk/psModules/src/camera
- Timestamp:
- Dec 3, 2006, 8:48:10 AM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 6 edited
-
pmFPA_JPEG.c (modified) (14 diffs)
-
pmFPA_JPEG.h (modified) (2 diffs)
-
pmFPA_MANAPLOT.c (modified) (13 diffs)
-
pmFPA_MANAPLOT.h (modified) (2 diffs)
-
pmFPAfileDefine.c (modified) (5 diffs)
-
pmFPAfileIO.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPA_JPEG.c
r10417 r10421 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-12-0 2 04:24:48$7 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-12-03 18:48:10 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 32 32 33 bool pmFPAviewWriteJPEG(const pmFPAview *view, pmFPAfile *file )33 bool pmFPAviewWriteJPEG(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 34 34 { 35 35 PS_ASSERT_PTR_NON_NULL(view, false); … … 39 39 40 40 if (view->chip == -1) { 41 pmFPAWriteJPEG (fpa, view, file );41 pmFPAWriteJPEG (fpa, view, file, config); 42 42 return true; 43 43 } … … 49 49 50 50 if (view->cell == -1) { 51 pmChipWriteJPEG (chip, view, file );51 pmChipWriteJPEG (chip, view, file, config); 52 52 return true; 53 53 } … … 59 59 60 60 if (view->readout == -1) { 61 pmCellWriteJPEG (cell, view, file );61 pmCellWriteJPEG (cell, view, file, config); 62 62 return true; 63 63 } … … 68 68 pmReadout *readout = cell->readouts->data[view->readout]; 69 69 70 pmReadoutWriteJPEG (readout, view, file );70 pmReadoutWriteJPEG (readout, view, file, config); 71 71 return true; 72 72 } 73 73 74 74 // read in all chip-level JPEG files for this FPA 75 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file )75 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 76 76 { 77 77 PS_ASSERT_PTR_NON_NULL(fpa, false); … … 82 82 83 83 pmChip *chip = fpa->chips->data[i]; 84 pmChipWriteJPEG (chip, view, file );84 pmChipWriteJPEG (chip, view, file, config); 85 85 } 86 86 return true; … … 88 88 89 89 // read in all cell-level JPEG files for this chip 90 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file )90 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 91 91 { 92 92 PS_ASSERT_PTR_NON_NULL(chip, false); … … 97 97 98 98 pmCell *cell = chip->cells->data[i]; 99 pmCellWriteJPEG (cell, view, file );99 pmCellWriteJPEG (cell, view, file, config); 100 100 } 101 101 return true; … … 103 103 104 104 // read in all readout-level JPEG files for this cell 105 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file )105 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 106 106 { 107 107 PS_ASSERT_PTR_NON_NULL(cell, false); … … 112 112 113 113 pmReadout *readout = cell->readouts->data[i]; 114 pmReadoutWriteJPEG (readout, view, file );114 pmReadoutWriteJPEG (readout, view, file, config); 115 115 } 116 116 return true; … … 118 118 119 119 // read in all readout-level Objects files for this cell 120 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file )120 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 121 121 { 122 122 PS_ASSERT_PTR_NON_NULL(readout, false); … … 178 178 179 179 psString name = pmFPAfileNameFromRule (file->filerule, file, view); 180 psString newName = pmConfigConvertFilename (name, config); 180 181 psString mapname = pmFPAfileNameFromRule (file->filextra, file, view); 181 182 psImageJpegColormap *map = psImageJpegColormapSet (NULL, mapname); … … 185 186 } 186 187 187 psImageJpeg (map, readout->image, name, min, max); 188 psImageJpeg (map, readout->image, newName, min, max); 189 psFree(newName); 188 190 psFree(name); 189 191 psFree(map); -
trunk/psModules/src/camera/pmFPA_JPEG.h
r7017 r10421 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2006- 05-01 01:55:43$9 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-12-03 18:48:10 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 19 19 /// @{ 20 20 21 bool pmFPAviewWriteJPEG (const pmFPAview *view, pmFPAfile *file );22 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file );23 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file );24 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file );25 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file );21 bool pmFPAviewWriteJPEG (const pmFPAview *view, pmFPAfile *file, pmConfig *config); 22 bool pmFPAWriteJPEG (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 23 bool pmChipWriteJPEG (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 24 bool pmCellWriteJPEG (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 25 bool pmReadoutWriteJPEG (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 26 26 27 27 # endif -
trunk/psModules/src/camera/pmFPA_MANAPLOT.c
r9585 r10421 5 5 * @author EAM, IfA 6 6 * 7 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $8 * @date $Date: 2006-1 0-17 00:41:05$7 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-12-03 18:48:10 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 31 31 32 32 33 bool pmFPAviewWriteMANAPLOT(const pmFPAview *view, pmFPAfile *file )33 bool pmFPAviewWriteMANAPLOT(const pmFPAview *view, pmFPAfile *file, pmConfig *config) 34 34 { 35 35 PS_ASSERT_PTR_NON_NULL(view, false); … … 39 39 40 40 if (view->chip == -1) { 41 pmFPAWriteMANAPLOT (fpa, view, file );41 pmFPAWriteMANAPLOT (fpa, view, file, config); 42 42 return true; 43 43 } … … 49 49 50 50 if (view->cell == -1) { 51 pmChipWriteMANAPLOT (chip, view, file );51 pmChipWriteMANAPLOT (chip, view, file, config); 52 52 return true; 53 53 } … … 59 59 60 60 if (view->readout == -1) { 61 pmCellWriteMANAPLOT (cell, view, file );61 pmCellWriteMANAPLOT (cell, view, file, config); 62 62 return true; 63 63 } … … 68 68 pmReadout *readout = cell->readouts->data[view->readout]; 69 69 70 pmReadoutWriteMANAPLOT (readout, view, file );70 pmReadoutWriteMANAPLOT (readout, view, file, config); 71 71 return true; 72 72 } 73 73 74 74 // read in all chip-level MANAPLOT files for this FPA 75 bool pmFPAWriteMANAPLOT (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file )75 bool pmFPAWriteMANAPLOT (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 76 76 { 77 77 PS_ASSERT_PTR_NON_NULL(fpa, false); … … 82 82 83 83 pmChip *chip = fpa->chips->data[i]; 84 pmChipWriteMANAPLOT (chip, view, file );84 pmChipWriteMANAPLOT (chip, view, file, config); 85 85 } 86 86 return true; … … 88 88 89 89 // read in all cell-level MANAPLOT files for this chip 90 bool pmChipWriteMANAPLOT (pmChip *chip, const pmFPAview *view, pmFPAfile *file )90 bool pmChipWriteMANAPLOT (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 91 91 { 92 92 PS_ASSERT_PTR_NON_NULL(chip, false); … … 97 97 98 98 pmCell *cell = chip->cells->data[i]; 99 pmCellWriteMANAPLOT (cell, view, file );99 pmCellWriteMANAPLOT (cell, view, file, config); 100 100 } 101 101 return true; … … 103 103 104 104 // read in all readout-level MANAPLOT files for this cell 105 bool pmCellWriteMANAPLOT (pmCell *cell, const pmFPAview *view, pmFPAfile *file )105 bool pmCellWriteMANAPLOT (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 106 106 { 107 107 PS_ASSERT_PTR_NON_NULL(cell, false); … … 112 112 113 113 pmReadout *readout = cell->readouts->data[i]; 114 pmReadoutWriteMANAPLOT (readout, view, file );114 pmReadoutWriteMANAPLOT (readout, view, file, config); 115 115 } 116 116 return true; … … 118 118 119 119 // read in all readout-level Objects files for this cell 120 bool pmReadoutWriteMANAPLOT (pmReadout *readout, const pmFPAview *view, pmFPAfile *file )120 bool pmReadoutWriteMANAPLOT (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config) 121 121 { 122 122 PS_ASSERT_PTR_NON_NULL(readout, false); … … 136 136 // output : filerule 137 137 138 psString input = pmFPAfileNameFromRule (file->filextra, file, view); 139 psString output = pmFPAfileNameFromRule (file->filerule, file, view); 140 psString script = pmFPAfileNameFromRule (file->extname, file, view); 138 psString tmpName; 139 tmpName = pmFPAfileNameFromRule (file->filextra, file, view); 140 psString input = pmConfigConvertFilename (tmpName, config); 141 psFree (tmpName); 142 143 tmpName = pmFPAfileNameFromRule (file->filerule, file, view); 144 psString output = pmConfigConvertFilename (tmpName, config); 145 psFree (tmpName); 146 147 tmpName = pmFPAfileNameFromRule (file->extname, file, view); 148 psString script = pmConfigConvertFilename (tmpName, config); 149 psFree (tmpName); 141 150 142 151 psString line = NULL; -
trunk/psModules/src/camera/pmFPA_MANAPLOT.h
r9585 r10421 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-1 0-17 00:41:05$9 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-12-03 18:48:10 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 19 19 /// @{ 20 20 21 bool pmFPAviewWriteMANAPLOT (const pmFPAview *view, pmFPAfile *file );22 bool pmFPAWriteMANAPLOT (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file );23 bool pmChipWriteMANAPLOT (pmChip *chip, const pmFPAview *view, pmFPAfile *file );24 bool pmCellWriteMANAPLOT (pmCell *cell, const pmFPAview *view, pmFPAfile *file );25 bool pmReadoutWriteMANAPLOT (pmReadout *readout, const pmFPAview *view, pmFPAfile *file );21 bool pmFPAviewWriteMANAPLOT (const pmFPAview *view, pmFPAfile *file, pmConfig *config); 22 bool pmFPAWriteMANAPLOT (pmFPA *fpa, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 23 bool pmChipWriteMANAPLOT (pmChip *chip, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 24 bool pmCellWriteMANAPLOT (pmCell *cell, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 25 bool pmReadoutWriteMANAPLOT (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, pmConfig *config); 26 26 27 27 # endif -
trunk/psModules/src/camera/pmFPAfileDefine.c
r9950 r10421 277 277 } 278 278 279 psString realName = pmConfigConvertFilename (infiles->data[0], config); 280 if (!realName) { 281 psError(PS_ERR_IO, false, "Failed to convert file name %s\n", (char *) infiles->data[0]); 282 return NULL; 283 } 284 279 285 // load the header of the first image 280 fits = psFitsOpen (infiles->data[0], "r"); 286 fits = psFitsOpen (realName, "r"); 287 if (!fits) { 288 psError(PS_ERR_IO, false, "Failed to open file %s\n", realName); 289 psFree (realName); 290 return NULL; 291 } 281 292 phu = psFitsReadHeader (NULL, fits); 293 if (!phu) { 294 psError(PS_ERR_IO, false, "Failed to read file header %s\n", realName); 295 psFree (realName); 296 return NULL; 297 } 282 298 psFitsClose (fits); 283 299 … … 286 302 format = pmConfigCameraFormatFromHeader (config, phu); 287 303 if (!format) { 288 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", (char *)infiles->data[0]);304 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName); 289 305 psFree(phu); 306 psFree (realName); 290 307 return NULL; 291 308 } … … 294 311 fpa = pmFPAConstruct (config->camera); 295 312 if (!fpa) { 296 psError(PS_ERR_IO, false, "Failed to construct FPA from %s", (char *)infiles->data[0]); 297 return NULL; 298 } 313 psError(PS_ERR_IO, false, "Failed to construct FPA from %s", realName); 314 psFree (realName); 315 return NULL; 316 } 317 psFree (realName); 299 318 300 319 // load the given filerule (from config->camera) and bind it to the fpa … … 337 356 for (int i = 0; i < infiles->n; i++) { 338 357 if (i > 0) { 339 fits = psFitsOpen (infiles->data[i], "r"); 358 psString realName = pmConfigConvertFilename (infiles->data[i], config); 359 if (!realName) { 360 psError(PS_ERR_IO, false, "Failed to convert file name %s", (char *) infiles->data[i]); 361 return NULL; 362 } 363 fits = psFitsOpen (realName, "r"); 364 if (!fits) { 365 psError(PS_ERR_IO, false, "Failed to open file %s\n", realName); 366 psFree (realName); 367 return NULL; 368 } 340 369 phu = psFitsReadHeader (NULL, fits); 341 pmConfigValidateCameraFormat (format, phu); 370 if (!phu) { 371 psError(PS_ERR_IO, false, "Failed to read file header %s", realName); 372 psFree (realName); 373 psFitsClose (fits); 374 return NULL; 375 } 376 if (!pmConfigValidateCameraFormat (format, phu)) { 377 psError(PS_ERR_IO, false, "file %s is not from the required camera", realName); 378 psFree (realName); 379 psFitsClose (fits); 380 return NULL; 381 } 342 382 psFitsClose (fits); 343 383 } … … 545 585 546 586 // Prepend the global path to the file rule 547 if (config->workdir) {548 psStringPrepend(&file->filerule, "%s/", config->workdir);549 }587 psString tmpName = pmConfigConvertFilename (file->filerule, config); 588 psFree (file->filerule); 589 file->filerule = tmpName; 550 590 551 591 if (found) { -
trunk/psModules/src/camera/pmFPAfileIO.c
r10385 r10421 210 210 } 211 211 212 // XXXX this is very ad-hoc213 // XXXX prepend the value config[WORKDIR] to the filename...214 char *workdir = psMetadataLookupStr (NULL, config->site, "WORKDIR");215 if (workdir) {216 psStringPrepend (&file->filename, "%s/", workdir);217 }218 219 212 psTrace ("pmFPAfile", 6, "got detrend file %s\n", file->filename); 220 213 psFree (extra); 221 214 } 222 // if () "neb://" -> get from neb... 215 216 // apply filename mangling rules (file://, path://, neb://, WORKDIR) 217 psString tmpName = pmConfigConvertFilename (file->filename, config); 218 psFree (file->filename); 219 file->filename = tmpName; 223 220 224 221 switch (file->type) { … … 353 350 case PM_FPA_FILE_CMP: 354 351 case PM_FPA_FILE_CMF: 355 pmFPAviewReadObjects (view, file );352 pmFPAviewReadObjects (view, file, config); 356 353 psTrace ("pmFPAfile", 5, "reading %s (type: %d)\n", file->filename, file->type); 357 354 break; 358 355 359 356 case PM_FPA_FILE_PSF: 360 pmFPAviewReadPSFmodel (view, file );357 pmFPAviewReadPSFmodel (view, file, config); 361 358 psTrace ("pmFPAfile", 5, "reading %s (type: %d)\n", file->filename, file->type); 362 359 break; … … 508 505 case PM_FPA_FILE_CMF: 509 506 psTrace ("pmFPAfile", 5, "writing object %s (fpa: %p)\n", file->filename, file->fpa); 510 if (!pmFPAviewWriteObjects (view, file )) {507 if (!pmFPAviewWriteObjects (view, file, config)) { 511 508 psError(PS_ERR_IO, false, "Failed to write object %s", file->filename); 512 509 return false; … … 516 513 517 514 case PM_FPA_FILE_PSF: 518 pmFPAviewWritePSFmodel (view, file );515 pmFPAviewWritePSFmodel (view, file, config); 519 516 psTrace ("pmFPAfile", 5, "wrote PSF %s (fpa: %p)\n", file->filename, file->fpa); 520 517 break; 521 518 522 519 case PM_FPA_FILE_JPEG: 523 pmFPAviewWriteJPEG (view, file );520 pmFPAviewWriteJPEG (view, file, config); 524 521 psTrace ("pmFPAfile", 5, "wrote JPEG %s (fpa: %p)\n", file->filename, file->fpa); 525 522 break; 526 523 527 524 case PM_FPA_FILE_MANAPLOT: 528 pmFPAviewWriteMANAPLOT (view, file );525 pmFPAviewWriteMANAPLOT (view, file, config); 529 526 psTrace ("pmFPAfile", 5, "wrote MANAPLOT %s (fpa: %p)\n", file->filename, file->fpa); 530 527 break;
Note:
See TracChangeset
for help on using the changeset viewer.
