IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27277 for trunk


Ignore:
Timestamp:
Mar 12, 2010, 2:05:16 PM (16 years ago)
Author:
Paul Price
Message:

Apply astrometric correction to sources to reduce rejection in the wings of bright stars.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackSources.c

    r27218 r27277  
    275275            options->norm = psVectorAlloc(num, PS_TYPE_F32);
    276276            for (int i = 0; i < num; i++) {
    277                 if (!isfinite(trans->data.F32[i])) {
     277                if (inputMask->data.U8[i] || !isfinite(trans->data.F32[i])) {
    278278                    continue;
    279279                }
     
    315315        // Double check: all transparencies should be zero
    316316        {
    317             psArray *matches = pmSourceMatchSources(sourceLists, radius); // List of matches
     317            psArray *matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches
    318318            if (!matches) {
    319319                psError(PPSTACK_ERR_DATA, false, "Unable to match sources");
     
    321321                return false;
    322322            }
    323             psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej,
    324                                                    transThresh, starRej, starSys);
     323            psVector *trans = pmSourceMatchRelphot(matches, zp, tol, iter1, starRej1, starSys1,
     324                                                   iter2, starRej2, starSys2, starLimit,
     325                                                   transIter, transRej, transThresh); // Transparencies
    325326            for (int i = 0; i < num; i++) {
    326327                fprintf(stderr, "Transparency of image %d: %f\n", i, trans->data.F32[i]);
    327328            }
    328329            psFree(trans);
    329         }
    330 #endif
    331     }
    332 
    333 
    334 #if 0
     330            psFree(matches);
     331        }
     332#endif
     333    }
     334
     335
     336#if 1
    335337    // Position offsets
    336338    {
     
    342344        }
    343345        for (int i = 0; i < num; i++) {
    344             psVector *offset = offsets->data[i];
    345             fprintf(stderr, "Offset %d: %f,%f\n", i, offset->data.F32[0], offset->data.F32[1]);
     346            if (options->inputMask->data.U8[i]) {
     347                continue;
     348            }
     349            psArray *sources = sourceLists->data[i]; // Sources of interest
     350            psVector *offset = offsets->data[i];                      // Offsets for image
     351            float dx = offset->data.F32[0], dy = offset->data.F32[1]; // Offsets to apply
     352            if (!isfinite(dx) || !isfinite(dy)) {
     353                continue;
     354            }
     355            psLogMsg("ppStack", PS_LOG_INFO, "Applying astrometric correction to image %d: %f,%f\n",
     356                     i, dx, dy);
     357            for (int j = 0; j < sources->n; j++) {
     358                pmSource *source = sources->data[j]; // Source of interest
     359                if (!source) {
     360                    continue;
     361                }
     362                if (source->modelPSF) {
     363                    source->modelPSF->params->data.F32[PM_PAR_XPOS] -= dx;
     364                    source->modelPSF->params->data.F32[PM_PAR_YPOS] -= dy;
     365                }
     366                if (source->peak) {
     367                    source->peak->xf -= dx;
     368                    source->peak->yf -= dy;
     369                }
     370            }
    346371        }
    347372        psFree(offsets);
    348373    }
    349374#endif
     375
     376#ifdef TESTING
     377        // Double check: all offsets should be zero
     378        {
     379            psArray *matches = pmSourceMatchSources(sourceLists, radius, true); // List of matches
     380            if (!matches) {
     381                psError(PPSTACK_ERR_DATA, false, "Unable to match sources");
     382                psFree(zp);
     383                return false;
     384            }
     385            psArray *offsets = pmSourceMatchRelastro(matches, num, tol, iter1, starRej1,
     386                                                     iter2, starRej2, starLimit); // Shifts for each image
     387            for (int i = 0; i < num; i++) {
     388                psVector *offset = offsets->data[i]; // Offsets for image
     389                fprintf(stderr, "Offset of image %d: %f,%f\n", i, offset->data.F32[0], offset->data.F32[1]);
     390            }
     391            psFree(offsets);
     392            psFree(matches);
     393        }
     394#endif
     395
    350396
    351397    if (options->photometry) {
Note: See TracChangeset for help on using the changeset viewer.