IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32977


Ignore:
Timestamp:
Dec 19, 2011, 3:12:24 PM (14 years ago)
Author:
bills
Message:

pass readout down to the Read XRAD functions so that we can save the
fwhmValues vector on the analysis metadata

Location:
trunk/psModules/src/objects
Files:
3 edited

Legend:

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

    r32971 r32977  
    5959static bool pmReadoutReadXSRC(pmFPAfile *file, char * exttype, psMetadata *hduHeader, psString xsrcname, psArray *sources, long *sourceIndex);
    6060static bool pmReadoutReadXFIT(pmFPAfile *file, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex);
    61 static bool pmReadoutReadXRAD(pmFPAfile *file, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex);
     61static bool pmReadoutReadXRAD(pmFPAfile *file, pmReadout *readout, char * exttype, psMetadata *hduHeader, psString xfitname, psArray *sources, long *sourceIndex);
    6262
    6363// lookup the EXTNAME values used for table data and image header segments
     
    10971097            }
    10981098            if (XRAD_OUTPUT && xradname) {
    1099                 if (!pmReadoutReadXRAD(file, exttype, hdu->header, xradname, sources, sourceIndex)) {
     1099                if (!pmReadoutReadXRAD(file, readout, exttype, hdu->header, xradname, sources, sourceIndex)) {
    11001100                    // XXX: is this an error?
    11011101                    psErrorClear();
     
    12531253    bool status = false;
    12541254    if (file->type == PM_FPA_FILE_CMF) {
    1255 #ifdef notyet
    1256         if (!strcmp (exttype, "SMPDATA")) {
    1257             status  = pmSourcesRead_SMPDATA_XSRC (file->fits, hduHeader, sources);
    1258         }
    1259         if (!strcmp (exttype, "PS1_DEV_0")) {
    1260             status  = pmSourcesRead_PS1_DEV_0_XSRC (file->fits, hduHeader, sources);
    1261         }
    1262         if (!strcmp (exttype, "PS1_DEV_1")) {
    1263             status  = pmSourcesRead_PS1_DEV_1_XSRC (file->fits, hduHeader, sources);
    1264         }
    1265         if (!strcmp (exttype, "PS1_V1")) {
    1266             status  = pmSourcesRead_CMF_PS1_V1_XSRC (file->fits, hduHeader, sources);
    1267         }
    1268         if (!strcmp (exttype, "PS1_V2")) {
    1269             status  = pmSourcesRead_CMF_PS1_V2_XSRC (file->fits, hduHeader, sources);
    1270         }
    1271         if (!strcmp (exttype, "PS1_V3")) {
    1272             status  = pmSourcesRead_CMF_PS1_V3_XSRC (file->fits, hduHeader, sources);
    1273         }
    1274         if (!strcmp (exttype, "PS1_V4")) {
    1275             status  = pmSourcesRead_CMF_PS1_V4_XSRC (file->fits, hduHeader, sources);
    1276         }
    1277 #endif // notyet
    12781255        if (!strcmp (exttype, "PS1_SV1")) {
    12791256            status  = pmSourcesRead_CMF_PS1_SV1_XSRC (file->fits, hduHeader, sources, sourceIndex);
    12801257        }
    1281 #ifdef notyet
    1282         if (!strcmp (exttype, "PS1_DV1")) {
    1283             status  = pmSourcesRead_CMF_PS1_DV1_XSRC (file->fits, hduHeader, sources);
    1284         }
    1285         if (!strcmp (exttype, "PS1_DV2")) {
    1286             status  = pmSourcesRead_CMF_PS1_DV2_XSRC (file->fits, hduHeader, sources);
    1287         }
    1288 #endif // notyet
    12891258    }
    12901259    psFree(tableHeader);
     
    13121281    bool status = false;
    13131282    if (file->type == PM_FPA_FILE_CMF) {
    1314 #ifdef notyet
    1315         if (!strcmp (exttype, "SMPDATA")) {
    1316             status  = pmSourcesRead_SMPDATA_XFIT (file->fits, hduHeader, sources);
    1317         }
    1318         if (!strcmp (exttype, "PS1_DEV_0")) {
    1319             status  = pmSourcesRead_PS1_DEV_0_XFIT (file->fits, hduHeader, sources);
    1320         }
    1321         if (!strcmp (exttype, "PS1_DEV_1")) {
    1322             status  = pmSourcesRead_PS1_DEV_1_XFIT (file->fits, hduHeader, sources);
    1323         }
    1324         if (!strcmp (exttype, "PS1_V1")) {
    1325             status  = pmSourcesRead_CMF_PS1_V1_XFIT (file->fits, hduHeader, sources);
    1326         }
    1327         if (!strcmp (exttype, "PS1_V2")) {
    1328             status  = pmSourcesRead_CMF_PS1_V2_XFIT (file->fits, hduHeader, sources);
    1329         }
    1330         if (!strcmp (exttype, "PS1_V3")) {
    1331             status  = pmSourcesRead_CMF_PS1_V3_XFIT (file->fits, hduHeader, sources);
    1332         }
    1333         if (!strcmp (exttype, "PS1_V4")) {
    1334             status  = pmSourcesRead_CMF_PS1_V4_XFIT (file->fits, hduHeader, sources);
    1335         }
    1336 #endif // notyet
    13371283        if (!strcmp (exttype, "PS1_SV1")) {
    13381284            status  = pmSourcesRead_CMF_PS1_SV1_XFIT (file->fits, hduHeader, sources, sourceIndex);
    13391285        }
    1340 #ifdef notyet
    1341         if (!strcmp (exttype, "PS1_DV1")) {
    1342             status  = pmSourcesRead_CMF_PS1_DV1_XFIT (file->fits, hduHeader, sources);
    1343         }
    1344         if (!strcmp (exttype, "PS1_DV2")) {
    1345             status  = pmSourcesRead_CMF_PS1_DV2_XFIT (file->fits, hduHeader, sources);
    1346         }
    1347 #endif // notyet
    13481286    }
    13491287    psFree(tableHeader);
    13501288    return status;
    13511289}
    1352 static bool pmReadoutReadXRAD(pmFPAfile *file, char *exttype, psMetadata *hduHeader, psString extname, psArray *sources, long *sourceIndex)
     1290static bool pmReadoutReadXRAD(pmFPAfile *file, pmReadout *readout, char *exttype, psMetadata *hduHeader, psString extname, psArray *sources, long *sourceIndex)
    13531291{
    13541292    if (!psFitsMoveExtName (file->fits, extname)) {
     
    13701308    bool status = false;
    13711309    if (file->type == PM_FPA_FILE_CMF) {
    1372 #ifdef notyet
    1373         if (!strcmp (exttype, "SMPDATA")) {
    1374             status  = pmSourcesRead_SMPDATA_XRAD (file->fits, hduHeader, sources);
    1375         }
    1376         if (!strcmp (exttype, "PS1_DEV_0")) {
    1377             status  = pmSourcesRead_PS1_DEV_0_XRAD (file->fits, hduHeader, sources);
    1378         }
    1379         if (!strcmp (exttype, "PS1_DEV_1")) {
    1380             status  = pmSourcesRead_PS1_DEV_1_XRAD (file->fits, hduHeader, sources);
    1381         }
    1382         if (!strcmp (exttype, "PS1_V1")) {
    1383             status  = pmSourcesRead_CMF_PS1_V1_XRAD (file->fits, hduHeader, sources);
    1384         }
    1385         if (!strcmp (exttype, "PS1_V2")) {
    1386             status  = pmSourcesRead_CMF_PS1_V2_XRAD (file->fits, hduHeader, sources);
    1387         }
    1388         if (!strcmp (exttype, "PS1_V3")) {
    1389             status  = pmSourcesRead_CMF_PS1_V3_XRAD (file->fits, hduHeader, sources);
    1390         }
    1391         if (!strcmp (exttype, "PS1_V4")) {
    1392             status  = pmSourcesRead_CMF_PS1_V4_XRAD (file->fits, hduHeader, sources);
    1393         }
    1394 #endif // notyet
    13951310        if (!strcmp (exttype, "PS1_SV1")) {
    1396             status  = pmSourcesRead_CMF_PS1_SV1_XRAD (file->fits, hduHeader, sources, sourceIndex);
    1397         }
    1398 #ifdef notyet
    1399         if (!strcmp (exttype, "PS1_DV1")) {
    1400             status  = pmSourcesRead_CMF_PS1_DV1_XRAD (file->fits, hduHeader, sources);
    1401         }
    1402         if (!strcmp (exttype, "PS1_DV2")) {
    1403             status  = pmSourcesRead_CMF_PS1_DV2_XRAD (file->fits, hduHeader, sources);
    1404         }
    1405 #endif // notyet
     1311            status  = pmSourcesRead_CMF_PS1_SV1_XRAD (file->fits, readout, hduHeader, sources, sourceIndex);
     1312        }
    14061313    }
    14071314    psFree(tableHeader);
  • trunk/psModules/src/objects/pmSourceIO.h

    r32971 r32977  
    9595bool pmSourcesRead_CMF_PS1_SV1_XSRC (psFits *fits, psMetadata *header, psArray *sources, long *);
    9696bool pmSourcesRead_CMF_PS1_SV1_XFIT (psFits *fits, psMetadata *header, psArray *sources, long *);
    97 bool pmSourcesRead_CMF_PS1_SV1_XRAD (psFits *fits, psMetadata *header, psArray *sources, long *);
     97bool pmSourcesRead_CMF_PS1_SV1_XRAD (psFits *fits, pmReadout *readout, psMetadata *header, psArray *sources, long *);
    9898psArray *pmSourcesRead_CMF_PS1_DV1 (psFits *fits, psMetadata *header);
    9999psArray *pmSourcesRead_CMF_PS1_DV2 (psFits *fits, psMetadata *header);
  • trunk/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c

    r32971 r32977  
    10261026}
    10271027
    1028 bool pmSourcesRead_CMF_PS1_SV1_XRAD(psFits *fits, psMetadata *hduHeader, psArray *sources, long *sourceIndex)
     1028bool pmSourcesRead_CMF_PS1_SV1_XRAD(psFits *fits, pmReadout *readout, psMetadata *hduHeader, psArray *sources, long *sourceIndex)
    10291029{
    10301030    PS_ASSERT_PTR_NON_NULL(fits, false);
     
    10371037        return false;
    10381038    }
     1039
     1040    long       seq_first = -1;
     1041    long       seq_last = -1;
     1042    psVector   *fwhmValues = psVectorAllocEmpty(10, PS_TYPE_F32);
     1043    long       max_entries = -1;
     1044    long       num_entries = -1;
    10391045
    10401046    for (long i = 0; i < numSources; i++) {
     
    10611067            return false;
    10621068        }
     1069        if (seq_first == -1) {
     1070            seq_first = seq;
     1071        }
     1072        if (seq == seq_first) {
     1073            psF32 value = psMetadataLookupF32(&status, row, "PSF_FWHM");
     1074            psVectorAppend(fwhmValues, value);
     1075        }
     1076        if (seq == seq_last) {
     1077            num_entries++;
     1078        } else {
     1079            num_entries = 1;
     1080            seq_last = seq;
     1081        }
     1082        if (num_entries > max_entries) {
     1083            max_entries = num_entries;
     1084        }
     1085
    10631086        if (!source->radialAper) {
    10641087            // XXX: where to find the number of models to expect?
     
    10781101    }
    10791102
     1103    // check for consistency between the length of fwhmValues and the maximum number of entries for each row
     1104    if (fwhmValues->n != max_entries) {
     1105        psError(PS_ERR_PROGRAMMING, true, "number of PSF_FWHM values found %ld does not match expected number: %ld\n",
     1106            fwhmValues->n, max_entries);
     1107        psAssert(0, "fixme");
     1108    }
     1109
     1110    if (!readout->analysis) {
     1111        readout->analysis = psMetadataAlloc();
     1112    }
     1113
     1114    psMetadataAddVector(readout->analysis, PS_LIST_TAIL, "STACK.PSF.FWHM.VALUES", PS_META_REPLACE, "PSF sizes", fwhmValues);
     1115    psFree(fwhmValues);
     1116
    10801117    return true;
    10811118}
Note: See TracChangeset for help on using the changeset viewer.