Changeset 6847
- Timestamp:
- Apr 12, 2006, 8:18:22 PM (20 years ago)
- Location:
- branches/rel10_ifa/psModules/src
- Files:
-
- 6 edited
-
astrom/pmFPAConstruct.c (modified) (1 diff)
-
astrom/pmFPAConstruct.h (modified) (1 diff)
-
astrom/pmFPAfile.c (modified) (13 diffs)
-
astrom/pmFPAfile.h (modified) (4 diffs)
-
config/pmConfig.c (modified) (2 diffs)
-
config/pmConfig.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.c
r6841 r6847 392 392 393 393 bool pmFPAAddSourceFromView(pmFPA *fpa, // The FPA 394 pmFPAview *phuView, // The view, corresponding to the PHU394 const pmFPAview *phuView, // The view, corresponding to the PHU 395 395 psMetadata *format // Format of file 396 396 ) -
branches/rel10_ifa/psModules/src/astrom/pmFPAConstruct.h
r6834 r6847 11 11 12 12 bool pmFPAAddSourceFromView(pmFPA *fpa, // The FPA 13 pmFPAview *phuView, // The view, corresponding to the PHU13 const pmFPAview *phuView, // The view, corresponding to the PHU 14 14 psMetadata *format // Format of file 15 15 ); -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.c
r6834 r6847 2 2 #include "pslib.h" 3 3 #include "psAdditionals.h" 4 #include "pmConfig.h" 4 5 #include "pmHDU.h" 5 6 #include "pmFPA.h" … … 22 23 psFree (file->names); 23 24 25 psFree (file->format); 26 psFree (file->name); 27 24 28 if (file->fits != NULL) { 25 29 psFitsClose (file->fits); … … 54 58 file->fits = NULL; 55 59 file->names = psMetadataAlloc(); 60 61 file->format = NULL; 62 file->name = NULL; 56 63 57 64 file->filerule = NULL; … … 188 195 if (fpa != NULL) { 189 196 file->fpa = psMemIncrRefCounter(fpa); 197 } 198 199 // for WRITE type of data, the output format needs to be determined 200 // this is only needed if the output file is not identical in structure to the input 201 char *formatName = psMetadataLookupStr (&status, data, "FILE.FORMAT"); 202 if (formatName && strcasecmp (formatName, "NONE")) { 203 psMetadata *formats = psMetadataLookupMD(&status, camera, "FORMATS"); // List of formats 204 char *formatFile = psMetadataLookupStr (&status, formats, formatName); 205 readConfig (&file->format, formatFile, formatName); 190 206 } 191 207 … … 332 348 bool pmFPAfileWrite (pmFPAfile *file, const pmFPAview *view) 333 349 { 350 // XXX test return false; 351 334 352 if (file->mode != PM_FPA_MODE_WRITE) 335 353 return false; … … 372 390 bool pmFPAfileCreate (pmFPAfile *file, const pmFPAview *view) 373 391 { 392 // XXX test return false; 374 393 if (file->mode != PM_FPA_MODE_WRITE) 375 394 return false; … … 389 408 case PM_FPA_FILE_IMAGE: 390 409 /* create a PHU for thie file, if it does not exist */ 391 pmFPAfileCopy View (file->src, file->fpa, view);410 pmFPAfileCopyStructureView (file->fpa, file->src, file->format, file->xBin, file->yBin, view); 392 411 psTrace ("pmFPAfile", 5, "created fpa data elements for %s (fpa: %p)\n", file->filename, file->fpa); 393 412 break; … … 698 717 699 718 // set the view to the corresponding entry for this phu 700 pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format);719 pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format); 701 720 702 721 // XXX is this the correct psMD to save the filename? … … 786 805 787 806 // set the view to the corresponding entry for this phu 788 pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format);807 pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, format); 789 808 790 809 // XXX is this the correct psMD to save the filename? … … 803 822 } 804 823 # endif 824 825 // create a new output pmFPAfile based on an existing FPA 826 pmFPAfile *pmFPAfileFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename) 827 { 828 // XXX pmFPAConstruct has many leaks (6919) 829 pmFPA *fpa = pmFPAConstruct (config->camera); 830 pmFPAfile *file = pmFPAfileDefine (config->files, config->camera, fpa, filename); 831 file->src = src; // inherit output elements from this source pmFPA 832 file->xBin = xBin; 833 file->yBin = yBin; 834 835 return file; 836 } 805 837 806 838 // look for the given name on the argument list. … … 879 911 880 912 // set the view to the corresponding entry for this phu 881 pmFPAview *view = pmFPAAddSourceFromHeader (file->fpa, phu, format);913 pmFPAview *view = pmFPAAddSourceFromHeader (file->fpa, phu, format); 882 914 883 915 // XXX is this the correct psMD to save the filename? … … 957 989 bool pmFPAfileCopyView (pmFPA *out, pmFPA *in, const pmFPAview *view) 958 990 { 959 // XXX how to we transmit the required binning factor?960 991 // pmFPAWrite takes care of all PHUs as needed 961 992 if (view->chip == -1) { … … 985 1016 return false; 986 1017 987 // XXX disable readout write for now 988 # if (0) 989 990 if (view->readout >= cell->readouts->n) { 991 return false; 992 } 993 pmReadout *readout = cell->readouts->data[view->readout]; 994 995 if (view->nRows == 0) { 996 pmReadoutWrite (readout, fits, NULL, NULL); 997 } else { 998 pmReadoutWriteSegment (readout, fits, view->nRows, view->iRows, NULL, NULL); 999 } 1000 return true; 1001 # endif 1002 } 1003 1004 // need to distinguish between a "copy structure" and a "copy data" 1005 // need to allow for binning when performing the "copy structure" 1018 // XXX add readout / segment equivalents 1019 } 1020 1021 // given an already-opened fits file, write the components corresponding 1022 // to the specified view 1023 bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, psMetadata *format, int xBin, int yBin, const pmFPAview *view) 1024 { 1025 // pmFPAWrite takes care of all PHUs as needed 1026 if (view->chip == -1) { 1027 pmFPAAddSourceFromView (out, view, format); 1028 pmFPACopyStructure (out, in, xBin, yBin); 1029 return true; 1030 } 1031 if (view->chip >= in->chips->n) { 1032 return false; 1033 } 1034 pmChip *inChip = in->chips->data[view->chip]; 1035 pmChip *outChip = out->chips->data[view->chip]; 1036 1037 if (view->cell == -1) { 1038 pmFPAAddSourceFromView (out, view, format); 1039 pmChipCopyStructure (outChip, inChip, xBin, yBin); 1040 return true; 1041 } 1042 if (view->cell >= inChip->cells->n) { 1043 return false; 1044 } 1045 pmCell *inCell = inChip->cells->data[view->cell]; 1046 pmCell *outCell = outChip->cells->data[view->cell]; 1047 1048 if (view->readout == -1) { 1049 pmFPAAddSourceFromView (out, view, format); 1050 pmCellCopyStructure (outCell, inCell, xBin, yBin); 1051 return true; 1052 } 1053 return false; 1054 1055 // XXX add readout / segment equivalents 1056 } -
branches/rel10_ifa/psModules/src/astrom/pmFPAfile.h
r6827 r6847 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1.2.1 0$ $Name: not supported by cvs2svn $10 * @date $Date: 2006-04-1 0 20:22:42$9 * @version $Revision: 1.1.2.11 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2006-04-13 06:17:28 $ 11 11 * 12 12 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii … … 81 81 int xBin; // desired binning in x direction 82 82 int yBin; // desired binning in y direction 83 psMetadata *format; 83 84 } 84 85 pmFPAfile; … … 137 138 pmFPAfile *pmFPAfileFromConf (bool *found, pmConfig *config, char *filename, pmFPA *input); 138 139 140 // create a new output pmFPAfile based on an existing FPA 141 pmFPAfile *pmFPAfileFromFPA (pmConfig *config, pmFPA *src, int xBin, int yBin, char *filename); 142 139 143 // add the specified filename info (value) to the files of the given mode using the given reference name 140 144 bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode); … … 145 149 bool pmFPAfileCopyView (pmFPA *out, pmFPA *in, const pmFPAview *view); 146 150 151 bool pmFPAfileCopyStructureView (pmFPA *out, pmFPA *in, psMetadata *format, int xBin, int yBin, const pmFPAview *view); 152 147 153 # endif -
branches/rel10_ifa/psModules/src/config/pmConfig.c
r6819 r6847 3 3 * @author PAP, IfA 4 4 * 5 * @version $Revision: 1.7.4.1 0$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-04- 08 20:13:03$5 * @version $Revision: 1.7.4.11 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-04-13 06:18:22 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 63 63 * 64 64 */ 65 staticbool readConfig(65 bool readConfig( 66 66 psMetadata **config, // Config to output 67 67 const char *name, // Name of file -
branches/rel10_ifa/psModules/src/config/pmConfig.h
r6819 r6847 3 3 * @author PAP, IfA 4 4 * 5 * @version $Revision: 1.3.4. 7$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-04- 08 20:13:03$5 * @version $Revision: 1.3.4.8 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-04-13 06:18:22 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 52 52 int *argc, 53 53 char **argv); 54 55 /** we need this elsewhere; make it public **/ 56 bool readConfig( 57 psMetadata **config, // Config to output 58 const char *name, // Name of file 59 const char *description // Description of file 60 ); 54 61 55 62 /** pmConfigValidateCamera
Note:
See TracChangeset
for help on using the changeset viewer.
