- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psModules (modified) (1 prop)
-
psModules/src/objects (modified) (1 prop)
-
psModules/src/objects/pmSourceIO.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psModules
- Property svn:mergeinfo set to
-
branches/meh_branches/ppstack_test/psModules/src/objects
- Property svn:ignore
-
old new 5 5 *.la 6 6 *.lo 7 pmSourceIO_CMF_PS1_V1.c 8 pmSourceIO_CMF_PS1_V2.c 9 pmSourceIO_CMF_PS1_V3.c 10 pmSourceIO_CMF_PS1_V4.c 11 pmSourceIO_CMF_PS1_V3.v1.c 12 pmSourceIO_CMF_PS1_V1.v1.c 13 pmSourceIO_CMF_PS1_V2.v1.c 14
-
- Property svn:ignore
-
branches/meh_branches/ppstack_test/psModules/src/objects/pmSourceIO.c
r31670 r33415 57 57 #define BLANK_HEADERS "BLANK.HEADERS" // Name of metadata in camera configuration containing header names 58 58 // for putting values into a blank PHU 59 static bool pmReadoutReadXSRC(pmFPAfile *file, char * exttype, psMetadata *hduHeader, psString xsrcname, psArray *sources, long *sourceIndex); 60 static bool pmReadoutReadXFIT(pmFPAfile *file, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex); 61 static bool pmReadoutReadXRAD(pmFPAfile *file, pmReadout *readout, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex); 59 62 60 63 // lookup the EXTNAME values used for table data and image header segments … … 569 572 PM_SOURCES_WRITE("PS1_V2", CMF_PS1_V2); 570 573 PM_SOURCES_WRITE("PS1_V3", CMF_PS1_V3); 574 PM_SOURCES_WRITE("PS1_V4", CMF_PS1_V4); 571 575 PM_SOURCES_WRITE("PS1_SV1", CMF_PS1_SV1); 572 576 PM_SOURCES_WRITE("PS1_DV1", CMF_PS1_DV1); … … 960 964 psString dataname = NULL; 961 965 psString deteffname = NULL; 962 if (!pmSourceIOextnames(&headname, &dataname, &deteffname, NULL, NULL, NULL, file, view)) { 966 psString xsrcname = NULL; 967 psString xfitname = NULL; 968 psString xradname = NULL; 969 970 // determine the output table format. Assume if we need to output extendend source 971 // parameters that they may exist in the input. 972 // XXX: Perhaps we should use different recipe values. 973 // I.E. EXTENDED_SOURCE_ANALYSIS_READ or something like that 974 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, "PSPHOT"); 975 if (!status) { 976 psError(PS_ERR_UNKNOWN, true, "missing recipe PSPHOT in config data"); 977 return false; 978 } 979 // if this is not TRUE, the output files only contain the psf measurements. 980 bool XSRC_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_ANALYSIS"); 981 bool XFIT_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_FITS"); 982 bool XRAD_OUTPUT = psMetadataLookupBool(&status, recipe, "RADIAL_APERTURES"); 983 984 if (!pmSourceIOextnames(&headname, &dataname, &deteffname, 985 XSRC_OUTPUT ? &xsrcname : NULL, 986 XFIT_OUTPUT ? &xfitname : NULL, 987 XRAD_OUTPUT ? &xradname : NULL, 988 file, view)) { 963 989 return false; 964 990 } … … 1025 1051 sources = pmSourcesRead_CMF_PS1_V3 (file->fits, hdu->header); 1026 1052 } 1053 if (!strcmp (exttype, "PS1_V4")) { 1054 sources = pmSourcesRead_CMF_PS1_V4 (file->fits, hdu->header); 1055 } 1027 1056 if (!strcmp (exttype, "PS1_SV1")) { 1028 1057 sources = pmSourcesRead_CMF_PS1_SV1 (file->fits, hdu->header); … … 1034 1063 sources = pmSourcesRead_CMF_PS1_DV2 (file->fits, hdu->header); 1035 1064 } 1065 1066 long *sourceIndex = NULL; 1067 if (XSRC_OUTPUT || XFIT_OUTPUT || XRAD_OUTPUT) { 1068 long seq_max = -1; 1069 for (long i = sources->n -1; i >= 0; i--) { 1070 pmSource *source = sources->data[i]; 1071 if (source->seq > seq_max) { 1072 seq_max = source->seq; 1073 } 1074 } 1075 sourceIndex = psAlloc((seq_max + 1) * sizeof(long)); 1076 for (long i = 0; i < seq_max; i++) { 1077 sourceIndex[i] = -1; 1078 } 1079 for (long i = 0; i < sources->n; i++) { 1080 pmSource *source = sources->data[i]; 1081 sourceIndex[source->seq] = i; 1082 } 1083 } 1084 if (XSRC_OUTPUT && xsrcname) { 1085 if (!pmReadoutReadXSRC(file, exttype, hdu->header, xsrcname, sources, sourceIndex)) { 1086 // XXX: is this an error? 1087 psErrorClear(); 1088 } 1089 psFree(xsrcname); 1090 } 1091 if (XFIT_OUTPUT && xfitname) { 1092 if (!pmReadoutReadXFIT(file, exttype, hdu->header, xfitname, sources, sourceIndex)) { 1093 // XXX: is this an error? 1094 psErrorClear(); 1095 } 1096 psFree(xfitname); 1097 } 1098 if (XRAD_OUTPUT && xradname) { 1099 if (!pmReadoutReadXRAD(file, readout, exttype, hdu->header, xradname, sources, sourceIndex)) { 1100 // XXX: is this an error? 1101 psErrorClear(); 1102 } 1103 psFree(xradname); 1104 } 1105 psFree(sourceIndex); 1036 1106 1037 1107 if (!pmReadoutReadDetEff(file->fits, readout, deteffname)) { … … 1161 1231 } 1162 1232 1163 1233 // XXX: We might be able to macroize this and reuse for the other types 1234 1235 static bool pmReadoutReadXSRC(pmFPAfile *file, char *exttype, psMetadata *hduHeader, psString xsrcname, psArray *sources, long *sourceIndex) 1236 { 1237 if (!psFitsMoveExtName (file->fits, xsrcname)) { 1238 psError(PS_ERR_UNKNOWN, false, "cannot find xsrc extension %s in %s", xsrcname, file->filename); 1239 return false; 1240 } 1241 1242 psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header 1243 if (!tableHeader) psAbort("cannot read table header"); 1244 1245 char *xtension = psMetadataLookupStr (NULL, tableHeader, "XTENSION"); 1246 if (!xtension) psAbort("cannot read table type"); 1247 if (strcmp (xtension, "BINTABLE")) { 1248 psWarning ("no binary table in extension %s, skipping\n", xsrcname); 1249 return false; 1250 } 1251 1252 // XXX these are case-sensitive since the EXTYPE is case-sensitive 1253 bool status = false; 1254 if (file->type == PM_FPA_FILE_CMF) { 1255 if (!strcmp (exttype, "PS1_SV1")) { 1256 status = pmSourcesRead_CMF_PS1_SV1_XSRC (file->fits, hduHeader, sources, sourceIndex); 1257 } 1258 } 1259 psFree(tableHeader); 1260 return status; 1261 } 1262 1263 static bool pmReadoutReadXFIT(pmFPAfile *file, char *exttype, psMetadata *hduHeader, psString extname, psArray *sources, long *sourceIndex) 1264 { 1265 if (!psFitsMoveExtName (file->fits, extname)) { 1266 psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename); 1267 return false; 1268 } 1269 1270 psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header 1271 if (!tableHeader) psAbort("cannot read table header"); 1272 1273 char *xtension = psMetadataLookupStr (NULL, tableHeader, "XTENSION"); 1274 if (!xtension) psAbort("cannot read table type"); 1275 if (strcmp (xtension, "BINTABLE")) { 1276 psWarning ("no binary table in extension %s, skipping\n", extname); 1277 return false; 1278 } 1279 1280 // XXX these are case-sensitive since the EXTYPE is case-sensitive 1281 bool status = false; 1282 if (file->type == PM_FPA_FILE_CMF) { 1283 if (!strcmp (exttype, "PS1_SV1")) { 1284 status = pmSourcesRead_CMF_PS1_SV1_XFIT (file->fits, hduHeader, sources, sourceIndex); 1285 } 1286 } 1287 psFree(tableHeader); 1288 return status; 1289 } 1290 static bool pmReadoutReadXRAD(pmFPAfile *file, pmReadout *readout, char *exttype, psMetadata *hduHeader, psString extname, psArray *sources, long *sourceIndex) 1291 { 1292 if (!psFitsMoveExtName (file->fits, extname)) { 1293 psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename); 1294 return false; 1295 } 1296 1297 psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header 1298 if (!tableHeader) psAbort("cannot read table header"); 1299 1300 char *xtension = psMetadataLookupStr (NULL, tableHeader, "XTENSION"); 1301 if (!xtension) psAbort("cannot read table type"); 1302 if (strcmp (xtension, "BINTABLE")) { 1303 psWarning ("no binary table in extension %s, skipping\n", extname); 1304 return false; 1305 } 1306 1307 // XXX these are case-sensitive since the EXTYPE is case-sensitive 1308 bool status = false; 1309 if (file->type == PM_FPA_FILE_CMF) { 1310 if (!strcmp (exttype, "PS1_SV1")) { 1311 status = pmSourcesRead_CMF_PS1_SV1_XRAD (file->fits, readout, hduHeader, sources, sourceIndex); 1312 } 1313 } 1314 psFree(tableHeader); 1315 return status; 1316 }
Note:
See TracChangeset
for help on using the changeset viewer.
