IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 23, 2006, 6:16:11 PM (20 years ago)
Author:
eugene
Message:

fixed some errors with double sources, added second-pass linear PSF fit, multiple-depths

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psModulesUtils.c

    r6379 r6481  
    144144    int xIs, xJs, yIs, yJs;
    145145    int xIe, yIe;
    146     float flux;
     146    float flux, wt;
    147147
    148148    psImage *Pi = Mi->pixels;
    149149    psImage *Pj = Mj->pixels;
     150
     151    psImage *Wi = Mi->weight;
    150152
    151153    psImage *Ti = Mi->mask;
     
    166168    yIe = Ye - Pi->row0;
    167169
     170    // note that this is addressing the same image pixels,
     171    // though only if both are source not model images
    168172    flux = 0;
    169173    for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) {
     
    171175            if (Ti->data.U8[yi][xi]) continue;
    172176            if (Tj->data.U8[yj][xj]) continue;
    173             flux += Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj];
     177            wt = Wi->data.F32[yi][xi];
     178            if (wt > 0) {
     179                flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt;
     180            }
     181        }
     182    }
     183    return (flux);
     184}
     185
     186float pmSourceCrossWeight (pmSource *Mi, pmSource *Mj) {
     187
     188    int Xs, Xe, Ys, Ye;
     189    int xi, xj, yi, yj;
     190    int xIs, xJs, yIs, yJs;
     191    int xIe, yIe;
     192    float flux, wt;
     193
     194    psImage *Pi = Mi->pixels;
     195    psImage *Pj = Mj->pixels;
     196
     197    psImage *Wi = Mi->weight;
     198
     199    psImage *Ti = Mi->mask;
     200    psImage *Tj = Mj->mask;
     201
     202    Xs = PS_MAX (Pi->col0, Pj->col0);
     203    Xe = PS_MIN (Pi->col0 + Pi->numCols, Pj->col0 + Pj->numCols);
     204   
     205    Ys = PS_MAX (Pi->row0, Pj->row0);
     206    Ye = PS_MIN (Pi->row0 + Pi->numRows, Pj->row0 + Pj->numRows);
     207   
     208    xIs = Xs - Pi->col0;
     209    xJs = Xs - Pj->col0;
     210    yIs = Ys - Pi->row0;
     211    yJs = Ys - Pj->row0;
     212
     213    xIe = Xe - Pi->col0;
     214    yIe = Ye - Pi->row0;
     215
     216    // note that this is addressing the same image pixels,
     217    // though only if both are source not model images
     218    flux = 0;
     219    for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) {
     220        for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) {
     221            if (Ti->data.U8[yi][xi]) continue;
     222            if (Tj->data.U8[yj][xj]) continue;
     223            wt = Wi->data.F32[yi][xi];
     224            if (wt > 0) {
     225                flux += 1.0 / wt;
     226            }
    174227        }
    175228    }
     
    250303    return NULL;
    251304}
     305
     306bool psRegionIsNaN (psRegion region) {
     307
     308    if (!isfinite(region.x0)) return true;
     309    if (!isfinite(region.x1)) return true;
     310    if (!isfinite(region.y0)) return true;
     311    if (!isfinite(region.y1)) return true;
     312    return false;
     313}
Note: See TracChangeset for help on using the changeset viewer.