Changeset 36441 for trunk/psModules/src/objects/pmSourceIO.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/bills_branches/bills_201312 (added) merged: 36383,36386,36388-36396,36406-36407,36409-36412,36415-36420,36422-36427,36433,36436-36439
- Property svn:mergeinfo changed
-
trunk/psModules
- Property svn:mergeinfo changed
/branches/bills_branches/bills_201312/psModules (added) merged: 36389,36412,36422-36424
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmSourceIO.c
r36375 r36441 61 61 static bool pmReadoutReadXFIT(pmFPAfile *file, pmReadout *readout, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex); 62 62 static bool pmReadoutReadXRAD(pmFPAfile *file, pmReadout *readout, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex); 63 static bool pmReadoutReadXGAL(pmFPAfile *file, pmReadout *readout, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex); 63 64 64 65 // lookup the EXTNAME values used for table data and image header segments … … 374 375 } \ 375 376 if (xgalname) { \ 376 status &= pmSourcesWrite_##TYPE##_XGAL (file->fits, sources, xgalname, recipe); \377 status &= pmSourcesWrite_##TYPE##_XGAL (file->fits, readout, sources, xgalname, recipe); \ 377 378 } \ 378 379 } … … 1036 1037 bool XFIT_OUTPUT = psMetadataLookupBool(&status, recipe, "EXTENDED_SOURCE_FITS"); 1037 1038 bool XRAD_OUTPUT = psMetadataLookupBool(&status, recipe, "RADIAL_APERTURES"); 1038 bool XGAL_OUTPUT = false; //psMetadataLookupBool(&status, recipe, "GALAXY_SHAPES");1039 bool XGAL_OUTPUT = psMetadataLookupBool(&status, recipe, "GALAXY_SHAPES"); 1039 1040 1040 1041 if (!pmSourceIOextnames(&headname, &dataname, &deteffname, … … 1122 1123 1123 1124 long *sourceIndex = NULL; 1124 if (XSRC_OUTPUT || XFIT_OUTPUT || XRAD_OUTPUT) { 1125 if (XSRC_OUTPUT || XFIT_OUTPUT || XRAD_OUTPUT || XGAL_OUTPUT) { 1126 // Build sourceIndex. Lookup table from source->seq to index in sources array. 1127 // Consists of an array of length max(source->seq) + 1. 1128 1129 // find maximum sequence number 1125 1130 long seq_max = -1; 1126 1131 for (long i = sources->n -1; i >= 0; i--) { … … 1135 1140 } 1136 1141 } 1142 // allocate and initialize the index 1137 1143 sourceIndex = psAlloc((seq_max + 1) * sizeof(long)); 1138 1144 for (long i = 0; i < seq_max; i++) { 1139 1145 sourceIndex[i] = -1; 1140 1146 } 1147 // populate the index 1141 1148 for (long i = 0; i < sources->n; i++) { 1142 1149 pmSource *source = sources->data[i]; … … 1165 1172 psFree(xradname); 1166 1173 } 1174 if (XGAL_OUTPUT && xgalname) { 1175 // a cmf file may have an XGAL extension, but it is not required 1176 if (!pmReadoutReadXGAL(file, readout, exttype, hdu->header, xgalname, sources, sourceIndex)) { 1177 // do anything? 1178 } 1179 psFree(xgalname); 1180 } 1167 1181 psFree(sourceIndex); 1168 1182 … … 1461 1475 return status; 1462 1476 } 1477 static bool pmReadoutReadXGAL(pmFPAfile *file, pmReadout *readout, char *exttype, psMetadata *hduHeader, psString xgalname, psArray *sources, long *sourceIndex) 1478 { 1479 if (!psFitsMoveExtNameClean (file->fits, xgalname)) { 1480 psTrace ("pmFPAfile", 1, "cannot find xgal extension %s in %s, skipping", xgalname, file->filename); 1481 return false; 1482 } 1483 1484 psMetadata *tableHeader = psFitsReadHeader(NULL, file->fits); // The FITS header 1485 if (!tableHeader) psAbort("cannot read table header"); 1486 1487 char *xtension = psMetadataLookupStr (NULL, tableHeader, "XTENSION"); 1488 if (!xtension) psAbort("cannot read table type"); 1489 if (strcmp (xtension, "BINTABLE")) { 1490 psFree(tableHeader); 1491 psWarning ("no binary table in extension %s, skipping\n", xgalname); 1492 return false; 1493 } 1494 1495 # define PM_SOURCES_READ_XGAL(NAME,TYPE) \ 1496 if (!strcmp (exttype, NAME)) { \ 1497 status = pmSourcesRead_##TYPE##_XGAL(file->fits, readout, hduHeader, tableHeader, sources, sourceIndex); \ 1498 } 1499 1500 bool status = false; 1501 if (file->type == PM_FPA_FILE_CMF) { 1502 PM_SOURCES_READ_XGAL("PS1_V1", CMF_PS1_V1); 1503 PM_SOURCES_READ_XGAL("PS1_V2", CMF_PS1_V2); 1504 PM_SOURCES_READ_XGAL("PS1_V3", CMF_PS1_V3); 1505 PM_SOURCES_READ_XGAL("PS1_V4", CMF_PS1_V4); 1506 PM_SOURCES_READ_XGAL("PS1_SV1", CMF_PS1_SV1); 1507 PM_SOURCES_READ_XGAL("PS1_SV2", CMF_PS1_SV2); 1508 PM_SOURCES_READ_XGAL("PS1_DV1", CMF_PS1_DV1); 1509 PM_SOURCES_READ_XGAL("PS1_DV2", CMF_PS1_DV2); 1510 PM_SOURCES_READ_XGAL("PS1_DV3", CMF_PS1_DV3); 1511 } 1512 psFree(tableHeader); 1513 return status; 1514 }
Note:
See TracChangeset
for help on using the changeset viewer.
