IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35611


Ignore:
Timestamp:
May 30, 2013, 2:32:30 PM (13 years ago)
Author:
bills
Message:

convert the x and y coordinates of the sources to the coordinate system of the stamp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/ppstampMakeStamp.c

    r35497 r35611  
    814814    psArray *inSources = inDetections->allSources;
    815815
     816    // copy analysis metadata in order to pick up any data stored there from the input file.
     817    // This includes detection efficiency analysis and extended source parameters.
     818    psMetadataCopy(outReadout->analysis, inReadout->analysis);
     819
     820    // now replace the sources with a new container
    816821    pmDetections *outDetections = pmDetectionsAlloc();
    817822    psMetadataAddPtr (outReadout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN,
     
    820825    psArray *outSources = outDetections->allSources = psArrayAllocEmpty( 100 );
    821826
    822     // include sources that are off the stamp by just a little bit
     827    // include sources that are off the stamp by just a little bit
     828    // XXX: should I be doing this?
    823829    #define EXPAND_SIZE 16
    824830    psRegion sourceRegion = extractRegion;
     
    828834    sourceRegion.y1 += EXPAND_SIZE;
    829835
     836    bool adjustCoords = extractRegion.x0 != 0 || extractRegion.y0 != 0;
     837
    830838    for (int i = 0; i < inSources->n; i++ ) {
    831839        pmSource *src = inSources->data[i];
     
    837845            continue;
    838846        }
     847        if (adjustCoords) {
     848            // adjust the source position for the stamp coordinate system
     849            src->peak->x  -= extractRegion.x0;
     850            src->peak->xf -= extractRegion.x0;
     851
     852            src->peak->y  -= extractRegion.y0;
     853            src->peak->yf -= extractRegion.y0;
     854            if (src->moments) {
     855                src->moments->Mx -= extractRegion.x0;
     856                src->moments->My -= extractRegion.y0;
     857            }
     858            if (src->modelPSF) {
     859                src->modelPSF->params->data.F32[PM_PAR_XPOS] -= extractRegion.x0;
     860                src->modelPSF->params->data.F32[PM_PAR_YPOS] -= extractRegion.y0;
     861            }
     862
     863            if (src->modelFits) {
     864                for (int j = 0; j < src->modelFits->n; j++) {
     865                    pmModel *model = src->modelFits->data[j];
     866                    assert (model != NULL);
     867                    model->params->data.F32[PM_PAR_XPOS] -= extractRegion.x0;
     868                    model->params->data.F32[PM_PAR_YPOS] -= extractRegion.y0;
     869                }
     870            }
     871        }
     872
    839873        psArrayAdd(outSources, 100, src);
    840874    }
Note: See TracChangeset for help on using the changeset viewer.