IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28218


Ignore:
Timestamp:
Jun 4, 2010, 10:44:09 AM (16 years ago)
Author:
Paul Price
Message:

Bug fixes to get it working. Seems a bit slow, but it's working.

Location:
trunk/ppTranslate/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppTranslate/src/ppMopsMerge.c

    r28212 r28218  
    4141    for (int i = 0; i < numInputs; i++) {
    4242        ppMopsDetections *det = detections->data[i]; // Detections from
     43        if (!det || det->num == 0) {
     44            continue;
     45        }
    4346        psVector *dupes = duplicates->data[i] = psVectorAlloc(det->num, PS_TYPE_U8);
    4447        psVectorInit(dupes, 0);
    4548        total += det->num;
    4649    }
    47 
    48     psVector *raMerged = psVectorAllocEmpty(total, PS_TYPE_F64); // Merged RAs
    49     psVector *decMerged = psVectorAllocEmpty(total, PS_TYPE_F64); // Merged Decs
    50 #if 0
    51     psVector *xMerged = psVectorAllocEmpty(total, PS_TYPE_F32);   // Merged x coords
    52     psVector *yMerged = psVectorAllocEmpty(total, PS_TYPE_F32);   // Merged y coords
    53 #endif
    54     psVector *sourceMerged = psVectorAllocEmpty(total, PS_TYPE_U16); // Source image of merged sources
    55     psVector *indexMerged = psVectorAllocEmpty(total, PS_TYPE_U32); // Index of merged sources
     50    psTrace("ppMops.merge", 2, "Total detections: %ld\n", total);
     51
     52    psVector *raMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged RAs
     53    psVector *decMerged = psVectorAlloc(total, PS_TYPE_F64); // Merged Decs
     54    psVector *sourceMerged = psVectorAlloc(total, PS_TYPE_U16); // Source image of merged sources
     55    psVector *indexMerged = psVectorAlloc(total, PS_TYPE_U32); // Index of merged sources
    5656    long num = 0;                                                   // Number of merged sources
    5757
     
    6262    double mjd = NAN;                           // Time of exposure
    6363
    64     for (int i = 0; i < detections->n; i++) {
     64    for (int i = 0; i < numInputs; i++) {
    6565        ppMopsDetections *det = detections->data[i]; // Detections of interest
    6666        if (!det) {
     
    8282            alt = det->alt;
    8383            az = det->az;
    84             continue;
    8584        } else {
    8685            if (strcmp(raBoresight, det->raBoresight) != 0) {
     
    132131
    133132        psTrace("ppMops.merge", 3, "Accepting %ld detections from input %d\n", det->num, i);
    134         memcpy(&raMerged->data.F64[num], det->ra, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    135         memcpy(&decMerged->data.F64[num], det->dec, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     133        memcpy(&raMerged->data.F64[num], det->ra->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
     134        memcpy(&decMerged->data.F64[num], det->dec->data.F64, det->num * PSELEMTYPE_SIZEOF(PS_TYPE_F64));
    136135        for (long j = 0, k = num; j < det->num; j++, k++) {
    137136            sourceMerged->data.U16[k] = i;
     
    215214                dupNum->data.U32[i]++;
    216215            }
     216            psFree(indices);
    217217        }
    218218        psFree(coords);
     
    250250        psArray *table = psListToArray(det->table->list); // Table of data
    251251        for (int j = 0; j < table->n; j++) {
    252             psVector *vector = table->data[j]; // Vector to purge
     252            psMetadataItem *item = table->data[j]; // Table item
     253            psAssert(item->type == PS_DATA_VECTOR, "Table column is not a vector: %x", item->type);
     254            psVector *vector = item->data.V; // Vector to purge
    253255            switch (vector->type.type) {
    254256                VECTOR_PURGE_CASE(U8);
  • trunk/ppTranslate/src/ppMopsRead.c

    r28212 r28218  
    6868        psFitsClose(fits);
    6969
    70         det->ra = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "RA_PSF"));
    71         det->dec = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "DEC_PSF"));
     70        psVector *ra = psMetadataLookupVector(NULL, table, "RA_PSF");
     71        psVector *dec = psMetadataLookupVector(NULL, table, "DEC_PSF");
     72
     73        det->ra = (psVector*)psBinaryOp(NULL, ra, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
     74        det->dec = (psVector*)psBinaryOp(NULL, dec, "*", psScalarAlloc(DEG_TO_RAD(1.0), PS_TYPE_F64));
    7275        det->x = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "X_PSF"));
    7376        det->y = psMemIncrRefCounter(psMetadataLookupVector(NULL, table, "Y_PSF"));
     
    7780        }
    7881
    79         psTrace("ppMops.read", 2, "Read %ld rows from %s\n", det->ra->n, (const char*)inNames->data[i]);
     82        psTrace("ppMops.read", 2, "Read %ld rows from %s\n", det->num, (const char*)inNames->data[i]);
    8083
    8184        detections->data[i] = det;
Note: See TracChangeset for help on using the changeset viewer.