IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 10, 2007, 10:10:05 AM (19 years ago)
Author:
Paul Price
Message:

Preparing to take a (long) list of sources as candidate stamps. Changed the list of stamps from a simple array to a more complicated structure so that I can carry around a list of candidate stamps for each region of interest; when one is rejected, it is replaced by the next brightest within the same region. Optionally apply an exclusion zone around stamps, which is important when we're convolving to a specified PSF (as opposed to convolving to match an image).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r14753 r14801  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.58 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-09-05 21:20:20 $
     6 *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-09-10 20:10:05 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    582582
    583583
    584 bool pmSubtractionCalculateEquation(psArray *stamps, const pmSubtractionKernels *kernels, int footprint)
    585 {
    586     PS_ASSERT_ARRAY_NON_NULL(stamps, false);
     584bool pmSubtractionCalculateEquation(pmSubtractionStampList *stamps, const pmSubtractionKernels *kernels,
     585                                    int footprint)
     586{
     587    PM_ASSERT_SUBTRACTION_STAMP_LIST_NON_NULL(stamps, false);
    587588    PS_ASSERT_PTR_NON_NULL(kernels, false);
    588589    PS_ASSERT_VECTORS_SIZE_EQUAL(kernels->u, kernels->v, false);
     
    601602    // We iterate over each stamp, allocate the matrix and vectors if
    602603    // necessary, and then calculate those matrix/vectors.
    603     for (int i = 0; i < stamps->n; i++) {
    604         pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     604    for (int i = 0; i < stamps->num; i++) {
     605        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    605606        if (stamp->status != PM_SUBTRACTION_STAMP_CALCULATE) {
    606607            continue;
     
    736737
    737738
    738 psVector *pmSubtractionSolveEquation(psVector *solution, const psArray *stamps)
    739 {
    740     PS_ASSERT_ARRAY_NON_NULL(stamps, NULL);
     739psVector *pmSubtractionSolveEquation(psVector *solution, const pmSubtractionStampList *stamps)
     740{
     741    PM_ASSERT_SUBTRACTION_STAMP_LIST_NON_NULL(stamps, NULL);
    741742
    742743    // Check inputs, while summing the stamp matrices and vectors
    743744    long numParams = -1;                // Number of parameters
    744     for (int i = 0; i < stamps->n; i++) {
    745         pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     745    for (int i = 0; i < stamps->num; i++) {
     746        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    746747        PS_ASSERT_PTR_NON_NULL(stamp, NULL);
    747748        if (stamp->status != PM_SUBTRACTION_STAMP_USED) {
     
    772773    psVectorInit(sumVector, 0.0);
    773774    psImageInit(sumMatrix, 0.0);
    774     for (int i = 0; i < stamps->n; i++) {
    775         pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     775    for (int i = 0; i < stamps->num; i++) {
     776        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    776777        if (stamp->status == PM_SUBTRACTION_STAMP_USED) {
    777778            (void)psBinaryOp(sumMatrix, sumMatrix, "+", stamp->matrix);
     
    810811
    811812
    812 int pmSubtractionRejectStamps(psArray *stamps, psImage *subMask, const psVector *solution,
     813int pmSubtractionRejectStamps(pmSubtractionStampList *stamps, psImage *subMask, const psVector *solution,
    813814                              int footprint, float sigmaRej, const pmSubtractionKernels *kernels)
    814815{
    815     PS_ASSERT_ARRAY_NON_NULL(stamps, -1);
     816    PM_ASSERT_SUBTRACTION_STAMP_LIST_NON_NULL(stamps, -1);
    816817    PS_ASSERT_IMAGE_NON_EMPTY(subMask, -1);
    817818    PS_ASSERT_IMAGE_TYPE(subMask, PS_TYPE_MASK, -1);
     
    825826
    826827    // Measure deviations
    827     psVector *deviations = psVectorAlloc(stamps->n, PS_TYPE_F32); // Mean deviation for stamps
     828    psVector *deviations = psVectorAlloc(stamps->num, PS_TYPE_F32); // Mean deviation for stamps
    828829    double totalSquareDev = 0.0;        // Total square deviation from zero
    829830    int numStamps = 0;                  // Number of used stamps
     
    834835        float background = solution->data.F64[solution->n-1]; // The difference in background
    835836
    836         for (int i = 0; i < stamps->n; i++) {
    837             pmSubtractionStamp *stamp = stamps->data[i]; // The stamp of interest
     837        for (int i = 0; i < stamps->num; i++) {
     838            pmSubtractionStamp *stamp = stamps->stamps->data[i]; // The stamp of interest
    838839            if (stamp->status != PM_SUBTRACTION_STAMP_USED) {
    839840                continue;
     
    899900
    900901    int numRejected = 0;
    901     for (int i = 0; i < stamps->n; i++) {
    902         pmSubtractionStamp *stamp = stamps->data[i]; // Stamp of interest
     902    for (int i = 0; i < stamps->num; i++) {
     903        pmSubtractionStamp *stamp = stamps->stamps->data[i]; // Stamp of interest
    903904        if (stamp->status == PM_SUBTRACTION_STAMP_USED && deviations->data.F32[i] > limit) {
    904905            // Mask out the stamp in the image so you it's not found again
Note: See TracChangeset for help on using the changeset viewer.