IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.