IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34268 for trunk/psModules


Ignore:
Timestamp:
Aug 1, 2012, 11:50:55 AM (14 years ago)
Author:
eugene
Message:

read XFIT, XRAD, XSRC for all CMF formats, but do not raise an error if it does not exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO.c

    r33463 r34268  
    10311031        if (!exttype) psAbort("cannot read table type");
    10321032
     1033# define PM_SOURCES_READ_PSF(NAME,TYPE)                          \
     1034        if (!strcmp (exttype, NAME)) {                           \
     1035            sources = pmSourcesRead_##TYPE(file->fits, hdu->header);    \
     1036        }                                                                       
     1037
    10331038        // XXX these are case-sensitive since the EXTYPE is case-sensitive
    10341039        if (file->type == PM_FPA_FILE_CMF) {
    1035             if (!strcmp (exttype, "SMPDATA")) {
    1036                 sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
    1037             }
    1038             if (!strcmp (exttype, "PS1_DEV_0")) {
    1039                 sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
    1040             }
    1041             if (!strcmp (exttype, "PS1_DEV_1")) {
    1042                 sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
    1043             }
    1044             if (!strcmp (exttype, "PS1_V1")) {
    1045                 sources = pmSourcesRead_CMF_PS1_V1 (file->fits, hdu->header);
    1046             }
    1047             if (!strcmp (exttype, "PS1_V2")) {
    1048                 sources = pmSourcesRead_CMF_PS1_V2 (file->fits, hdu->header);
    1049             }
    1050             if (!strcmp (exttype, "PS1_V3")) {
    1051                 sources = pmSourcesRead_CMF_PS1_V3 (file->fits, hdu->header);
    1052             }
    1053             if (!strcmp (exttype, "PS1_V4")) {
    1054                 sources = pmSourcesRead_CMF_PS1_V4 (file->fits, hdu->header);
    1055             }
    1056             if (!strcmp (exttype, "PS1_SV1")) {
    1057                 sources = pmSourcesRead_CMF_PS1_SV1 (file->fits, hdu->header);
    1058             }
    1059             if (!strcmp (exttype, "PS1_DV1")) {
    1060                 sources = pmSourcesRead_CMF_PS1_DV1 (file->fits, hdu->header);
    1061             }
    1062             if (!strcmp (exttype, "PS1_DV2")) {
    1063                 sources = pmSourcesRead_CMF_PS1_DV2 (file->fits, hdu->header);
    1064             }
     1040            PM_SOURCES_READ_PSF("SMPDATA",   SMPDATA);
     1041            PM_SOURCES_READ_PSF("PS1_DEV_0", PS1_DEV_0);
     1042            PM_SOURCES_READ_PSF("PS1_DEV_1", PS1_DEV_1);
     1043            PM_SOURCES_READ_PSF("PS1_CAL_0", PS1_CAL_0);
     1044            PM_SOURCES_READ_PSF("PS1_V1",    CMF_PS1_V1);
     1045            PM_SOURCES_READ_PSF("PS1_V2",    CMF_PS1_V2);
     1046            PM_SOURCES_READ_PSF("PS1_V3",    CMF_PS1_V3);
     1047            PM_SOURCES_READ_PSF("PS1_V4",    CMF_PS1_V4);
     1048            PM_SOURCES_READ_PSF("PS1_SV1",   CMF_PS1_SV1);
     1049            PM_SOURCES_READ_PSF("PS1_DV1",   CMF_PS1_DV1);
     1050            PM_SOURCES_READ_PSF("PS1_DV2",   CMF_PS1_DV2);
    10651051
    10661052            long *sourceIndex = NULL;
     
    10881074            }
    10891075            if (XSRC_OUTPUT && xsrcname) {
     1076                // a cmf file may have an XSRC extension, but it is not required
    10901077                if (!pmReadoutReadXSRC(file, exttype, hdu->header, xsrcname, sources, sourceIndex)) {
    1091                     // XXX: is this an error?
    1092                     psErrorClear();
     1078                    // do anything?
    10931079                }
    10941080                psFree(xsrcname);
    10951081            }
    10961082            if (XFIT_OUTPUT && xfitname) {
     1083                // a cmf file may have an XFIT extension, but it is not required
    10971084                if (!pmReadoutReadXFIT(file, exttype, hdu->header, xfitname, sources, sourceIndex)) {
    1098                     // XXX: is this an error?
    1099                     psErrorClear();
     1085                    // do anything?
    11001086                }
    11011087                psFree(xfitname);
    11021088            }
    11031089            if (XRAD_OUTPUT && xradname) {
     1090                // a cmf file may have an XRAD extension, but it is not required
    11041091                if (!pmReadoutReadXRAD(file, readout, exttype, hdu->header, xradname, sources, sourceIndex)) {
    1105                     // XXX: is this an error?
    1106                     psErrorClear();
     1092                    // do anything?
    11071093                }
    11081094                psFree(xradname);
     
    12411227{
    12421228    if (!psFitsMoveExtName (file->fits, xsrcname)) {
    1243         psError(PS_ERR_UNKNOWN, false, "cannot find xsrc extension %s in %s", xsrcname, file->filename);
     1229        psWarning ("cannot find xsrc extension %s in %s, skipping", xsrcname, file->filename);
    12441230        return false;
    12451231    }
     
    12551241    }
    12561242
    1257     // XXX these are case-sensitive since the EXTYPE is case-sensitive
     1243# define PM_SOURCES_READ_XSRC(NAME,TYPE)                                \
     1244    if (!strcmp (exttype, NAME)) {                                      \
     1245        status = pmSourcesRead_##TYPE##_XSRC(file->fits, hduHeader, sources, sourceIndex); \
     1246    }                                                                   
     1247
    12581248    bool status = false;
    12591249    if (file->type == PM_FPA_FILE_CMF) {
    1260         if (!strcmp (exttype, "PS1_SV1")) {
    1261             status  = pmSourcesRead_CMF_PS1_SV1_XSRC (file->fits, hduHeader, sources, sourceIndex);
    1262         }
     1250        PM_SOURCES_READ_XSRC("SMPDATA",   SMPDATA);
     1251        PM_SOURCES_READ_XSRC("PS1_DEV_0", PS1_DEV_0);
     1252        PM_SOURCES_READ_XSRC("PS1_DEV_1", PS1_DEV_1);
     1253        PM_SOURCES_READ_XSRC("PS1_CAL_0", PS1_CAL_0);
     1254        PM_SOURCES_READ_XSRC("PS1_V1",    CMF_PS1_V1);
     1255        PM_SOURCES_READ_XSRC("PS1_V2",    CMF_PS1_V2);
     1256        PM_SOURCES_READ_XSRC("PS1_V3",    CMF_PS1_V3);
     1257        PM_SOURCES_READ_XSRC("PS1_V4",    CMF_PS1_V4);
     1258        PM_SOURCES_READ_XSRC("PS1_SV1",   CMF_PS1_SV1);
     1259        PM_SOURCES_READ_XSRC("PS1_DV1",   CMF_PS1_DV1);
     1260        PM_SOURCES_READ_XSRC("PS1_DV2",   CMF_PS1_DV2);
    12631261    }
    12641262    psFree(tableHeader);
     
    12691267{
    12701268    if (!psFitsMoveExtName (file->fits, extname)) {
    1271         psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename);
     1269        psWarning ("cannot find xfit extension %s in %s, skipping", extname, file->filename);
    12721270        return false;
    12731271    }
     
    12831281    }
    12841282
    1285     // XXX these are case-sensitive since the EXTYPE is case-sensitive
     1283# define PM_SOURCES_READ_XFIT(NAME,TYPE)                                \
     1284    if (!strcmp (exttype, NAME)) {                                      \
     1285        status = pmSourcesRead_##TYPE##_XFIT(file->fits, hduHeader, sources, sourceIndex); \
     1286    }                                                                   
     1287
    12861288    bool status = false;
    12871289    if (file->type == PM_FPA_FILE_CMF) {
    1288         if (!strcmp (exttype, "PS1_SV1")) {
    1289             status  = pmSourcesRead_CMF_PS1_SV1_XFIT (file->fits, hduHeader, sources, sourceIndex);
    1290         }
     1290        PM_SOURCES_READ_XFIT("SMPDATA",   SMPDATA);
     1291        PM_SOURCES_READ_XFIT("PS1_DEV_0", PS1_DEV_0);
     1292        PM_SOURCES_READ_XFIT("PS1_DEV_1", PS1_DEV_1);
     1293        PM_SOURCES_READ_XFIT("PS1_CAL_0", PS1_CAL_0);
     1294        PM_SOURCES_READ_XFIT("PS1_V1",    CMF_PS1_V1);
     1295        PM_SOURCES_READ_XFIT("PS1_V2",    CMF_PS1_V2);
     1296        PM_SOURCES_READ_XFIT("PS1_V3",    CMF_PS1_V3);
     1297        PM_SOURCES_READ_XFIT("PS1_V4",    CMF_PS1_V4);
     1298        PM_SOURCES_READ_XFIT("PS1_SV1",   CMF_PS1_SV1);
     1299        PM_SOURCES_READ_XFIT("PS1_DV1",   CMF_PS1_DV1);
     1300        PM_SOURCES_READ_XFIT("PS1_DV2",   CMF_PS1_DV2);
    12911301    }
    12921302    psFree(tableHeader);
     
    12961306{
    12971307    if (!psFitsMoveExtName (file->fits, extname)) {
    1298         psError(PS_ERR_UNKNOWN, false, "cannot find extension %s in %s", extname, file->filename);
     1308        psWarning ("cannot find xrad extension %s in %s, skipping", extname, file->filename);
    12991309        return false;
    13001310    }
     
    13101320    }
    13111321
    1312     // XXX these are case-sensitive since the EXTYPE is case-sensitive
     1322# define PM_SOURCES_READ_XRAD(NAME,TYPE)                                \
     1323    if (!strcmp (exttype, NAME)) {                                      \
     1324        status = pmSourcesRead_##TYPE##_XRAD(file->fits, readout, hduHeader, sources, sourceIndex); \
     1325    }                                                                   
     1326
    13131327    bool status = false;
    13141328    if (file->type == PM_FPA_FILE_CMF) {
    1315         if (!strcmp (exttype, "PS1_SV1")) {
    1316             status  = pmSourcesRead_CMF_PS1_SV1_XRAD (file->fits, readout, hduHeader, sources, sourceIndex);
    1317         }
     1329        PM_SOURCES_READ_XRAD("SMPDATA",   SMPDATA);
     1330        PM_SOURCES_READ_XRAD("PS1_DEV_0", PS1_DEV_0);
     1331        PM_SOURCES_READ_XRAD("PS1_DEV_1", PS1_DEV_1);
     1332        PM_SOURCES_READ_XRAD("PS1_CAL_0", PS1_CAL_0);
     1333        PM_SOURCES_READ_XRAD("PS1_V1",    CMF_PS1_V1);
     1334        PM_SOURCES_READ_XRAD("PS1_V2",    CMF_PS1_V2);
     1335        PM_SOURCES_READ_XRAD("PS1_V3",    CMF_PS1_V3);
     1336        PM_SOURCES_READ_XRAD("PS1_V4",    CMF_PS1_V4);
     1337        PM_SOURCES_READ_XRAD("PS1_SV1",   CMF_PS1_SV1);
     1338        PM_SOURCES_READ_XRAD("PS1_DV1",   CMF_PS1_DV1);
     1339        PM_SOURCES_READ_XRAD("PS1_DV2",   CMF_PS1_DV2);
    13181340    }
    13191341    psFree(tableHeader);
Note: See TracChangeset for help on using the changeset viewer.