Changeset 14889
- Timestamp:
- Sep 19, 2007, 11:37:58 AM (19 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 5 edited
-
pmFPA.h (modified) (2 diffs)
-
pmFPAfile.c (modified) (3 diffs)
-
pmFPAfile.h (modified) (3 diffs)
-
pmFPAfileDefine.c (modified) (9 diffs)
-
pmFPAfileDefine.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPA.h
r14647 r14889 6 6 * @author Eugene Magnier, IfA 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2007-0 8-23 23:42:41$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2007-09-19 21:37:58 $ 10 10 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii 11 11 */ … … 55 55 psMetadata *analysis; ///< FPA-level analysis metadata 56 56 const psMetadata *camera; ///< Camera configuration 57 const char *formatName; ///< Name of camera format 57 58 psArray *chips; ///< The component chips 58 59 pmHDU *hdu; ///< FITS header data unit of interest, or NULL -
trunk/psModules/src/camera/pmFPAfile.c
r14647 r14889 27 27 psTrace ("pmFPAfileFree", 5, "freeing %s\n", file->name); 28 28 psFree (file->fpa); 29 psFree (file->src); 29 30 psFree (file->readout); 30 31 psFree (file->names); 31 32 32 33 psFree (file->camera); 34 psFree (file->cameraName); 33 35 psFree (file->format); 34 36 psFree (file->formatName); … … 73 75 74 76 file->camera = NULL; 77 file->cameraName = NULL; 75 78 file->format = NULL; 76 79 file->formatName = NULL; … … 175 178 176 179 if (strstr (newName, "{FPA.NAME}") != NULL) { 177 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.NAME");178 if (name != NULL) {179 psStringSubstitute(&newName, "fpa", "{FPA.NAME}");180 }180 char *name = psMetadataLookupStr (NULL, fpa->concepts, "FPA.NAME"); 181 if (name != NULL) { 182 psStringSubstitute(&newName, "fpa", "{FPA.NAME}"); 183 } 181 184 } 182 185 if (strstr (newName, "{CHIP.NAME}") != NULL) { -
trunk/psModules/src/camera/pmFPAfile.h
r14647 r14889 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-0 8-23 23:42:41$6 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-09-19 21:37:58 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 65 65 psFits *fits; // for I/O files of fits type (IMAGE, CMP, CMF), we carry a file handle 66 66 67 bool wrote_phu; // have we written a PHU for this file?67 bool wrote_phu; // have we written a PHU for this file? 68 68 psMetadata *header; // pointer (view) to the current hdu header 69 69 … … 90 90 91 91 psMetadata *camera; // Camera configuration 92 psString cameraName; // Name of the camera 92 93 psMetadata *format; // Camera format 93 char *formatName;// name of the camera format94 psString formatName; // name of the camera format 94 95 } 95 96 pmFPAfile; -
trunk/psModules/src/camera/pmFPAfileDefine.c
r14647 r14889 79 79 file->fpa = psMemIncrRefCounter(fpa); 80 80 file->camera = psMemIncrRefCounter((psMetadata *)fpa->camera); 81 file->cameraName = psMemIncrRefCounter(config->cameraName); 81 82 } 82 83 … … 97 98 pmFPA *fpa, // Optional FPA to bind 98 99 const char *name, // Name of file rule 99 const char *cameraName, // Name of camera configuration to use100 const char *formatName // Name of camera format to use100 psString cameraName, // Name of camera configuration to use 101 psString formatName // Name of camera format to use 101 102 ) 102 103 { … … 164 165 } else { 165 166 camera = config->camera; 167 cameraName = config->cameraName; 166 168 } 167 169 } else { … … 184 186 } 185 187 file->camera = psMemIncrRefCounter(camera); 188 file->cameraName = psMemIncrRefCounter(cameraName); 186 189 187 190 // Use the format we were told to, the format specified in the file rule, or default to the default format 188 191 if (!formatName || strlen(formatName) == 0) { 189 // select the format list from the selected camera 190 formatName = psMetadataLookupStr(&status, data, "FILE.FORMAT"); 191 if (!formatName || strcmp(formatName, "NONE") == 0) { 192 // Try to get by with the default 193 formatName = config->formatName; 192 if (fpa && fpa->formatName && strlen(fpa->formatName) > 0) { 193 formatName = (psString)fpa->formatName; // Casting away "const" --- it will be copied, so no prob. 194 } else { 195 // select the format list from the selected camera 196 formatName = psMetadataLookupStr(&status, data, "FILE.FORMAT"); 197 if (!formatName || strcmp(formatName, "NONE") == 0) { 198 // Try to get by with the default 199 formatName = config->formatName; 200 } 194 201 } 195 202 } … … 263 270 264 271 return pmFPAfileDefineOutputForFormat(config, fpa, name, NULL, NULL); 272 } 273 274 // define a pmFPAfile, bind to the optional file if supplied 275 pmFPAfile *pmFPAfileDefineOutputFromFile(const pmConfig *config, pmFPAfile *file, const char *name) 276 { 277 PS_ASSERT_PTR_NON_NULL(config, NULL); 278 PS_ASSERT_PTR_NON_NULL(config->files, NULL); 279 PS_ASSERT_PTR_NON_NULL(config->camera, NULL); 280 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 281 282 char *cameraName = NULL, *formatName = NULL; // Name of camera and format 283 pmFPA *fpa = NULL; // FPA for file 284 if (file) { 285 cameraName = file->cameraName; 286 formatName = file->formatName; 287 fpa = file->fpa; 288 } 289 290 return pmFPAfileDefineOutputForFormat(config, fpa, name, cameraName, formatName); 265 291 } 266 292 … … 911 937 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 912 938 913 // Need to look up the format914 bool mdok; // Status of MD lookup915 psMetadata *formats = psMetadataLookupMetadata(&mdok, src->camera, "FORMATS"); // The FORMATS916 if (!mdok || !formats) {917 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find FORMATS in camera configuration %s.\n",918 config->cameraName);919 return NULL;920 }921 psMetadata *format = psMetadataLookupMetadata(&mdok, formats, config->formatName); // The format922 if (!mdok || !format) {923 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find camera format %s within camera %s.\n",924 config->formatName, config->cameraName);925 return NULL;926 }927 928 939 pmFPA *fpa = pmFPAConstruct(src->camera); 929 940 pmFPAfile *file = pmFPAfileDefineOutput (config, fpa, filename); … … 932 943 return NULL; 933 944 } 934 file->src = src; // inherit output elements from this source pmFPA945 file->src = psMemIncrRefCounter(src); // inherit output elements from this source pmFPA 935 946 file->xBin = xBin; 936 947 file->yBin = yBin; 937 948 psFree (fpa); 949 return file; 950 } 951 952 pmFPAfile *pmFPAfileDefineFromFile(const pmConfig *config, pmFPAfile *src, int xBin, int yBin, 953 const char *filename) 954 { 955 PS_ASSERT_PTR_NON_NULL(config, false); 956 PS_ASSERT_PTR_NON_NULL(src, false); 957 PS_ASSERT_STRING_NON_EMPTY(filename, NULL); 958 959 pmFPAfile *file = pmFPAfileDefineOutputForFormat(config, NULL, filename, src->cameraName, 960 src->formatName); 961 file->src = psMemIncrRefCounter(src->fpa); // inherit output elements from this source pmFPA 962 file->xBin = xBin; 963 file->yBin = yBin; 938 964 return file; 939 965 } … … 1038 1064 } 1039 1065 1040 file->src = src; // inherit output elements from this source pmFPA1066 file->src = psMemIncrRefCounter(src); // inherit output elements from this source pmFPA 1041 1067 1042 1068 file->mosaicLevel = PM_FPA_LEVEL_CHIP; // don't do any I/O on this at a lower level … … 1083 1109 } 1084 1110 1085 file->src = src; // inherit output elements from this source pmFPA1111 file->src = psMemIncrRefCounter(src); // inherit output elements from this source pmFPA 1086 1112 1087 1113 file->mosaicLevel = PM_FPA_LEVEL_FPA; // don't do any I/O on this at a lower level -
trunk/psModules/src/camera/pmFPAfileDefine.h
r14647 r14889 4 4 * @author EAM, IfA 5 5 * 6 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-0 8-23 23:42:41$6 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-09-19 21:37:58 $ 8 8 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii 9 9 */ … … 28 28 // Define an output pmFPAfile 29 29 pmFPAfile *pmFPAfileDefineOutput(const pmConfig *config, // Configuration 30 pmFPA *fpa, // Optional FPA to bind31 const char *name // Name of camera format to use30 pmFPA *fpa, // Optional FPA to bind 31 const char *name // Name of file rule 32 32 ); 33 33 34 /// Same as pmFPAfileDefineOutput, but binds to the fpa in the provided file 35 pmFPAfile *pmFPAfileDefineOutputFromFile(const pmConfig *config, // Configuration 36 pmFPAfile *file, // File to bind FPAs, or NULL 37 const char *name // Name of file rule 38 ); 39 40 /// Define the FPA file using the provided camera and format names. 34 41 pmFPAfile *pmFPAfileDefineOutputForFormat(const pmConfig *config, // Configuration 35 pmFPA *fpa, // Optional FPA to bind36 const char *name, // Name of file rule37 const char *cameraName, // Name of camera configuration to use38 const char *formatName // Name of camera format to use42 pmFPA *fpa, // Optional FPA to bind 43 const char *name, // Name of file rule 44 psString cameraName, // Name of camera configuration to use 45 psString formatName // Name of camera format to use 39 46 ); 40 47 … … 69 76 // reference count is held by the config->files metadata. 70 77 pmFPAfile *pmFPAfileDefineFromFPA (const pmConfig *config, pmFPA *src, int xBin, int yBin, const char *filename); 78 79 /// Same as pmFPAfileDefineFromFPA, except it uses an FPA file instead of an FPA 80 pmFPAfile *pmFPAfileDefineFromFile(const pmConfig *config, // Configuration 81 pmFPAfile *src, // Source file for this file 82 int xBin, int yBin, // Binning for this file 83 const char *filename // Name of file rule 84 ); 85 71 86 72 87 // create a new output pmFPAfile based on an existing FPA
Note:
See TracChangeset
for help on using the changeset viewer.
