IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 9, 2006, 10:17:10 AM (20 years ago)
Author:
magnier
Message:

adjust mask region to follow interpolated shift, if applied; added test centroid, moments code (commented out)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r9883 r9925  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-11-07 09:11:12 $
     5 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-11-09 20:17:10 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    132132        float dx = 0.5 - x + (int)x;
    133133        float dy = 0.5 - y + (int)y;
     134        x += dx;
     135        y += dy;
    134136        flux = psImageShift (NULL, source->pixels, dx, dy, 0.0, PS_INTERPOLATE_BICUBE);
     137        // flux = psImageShift (NULL, source->pixels, dx, dy, 0.0, PS_INTERPOLATE_BILINEAR);
     138
     139        // XXX this is test code to verify the shift is doing the right thing (seems to be)
     140        # if (0)
     141            // measure centroid of unshifted gaussian (should be 16.0,16.0)
     142        {
     143            psImage *image = source->pixels;
     144            float xo = 0.0;
     145            float yo = 0.0;
     146            float xo2 = 0.0;
     147            float yo2 = 0.0;
     148            float no = 0.0;
     149            for (int j = 0; j < image->numRows; j++)
     150            {
     151                for (int i = 0; i < image->numCols; i++) {
     152                    xo += i*image->data.F32[j][i];
     153                    yo += j*image->data.F32[j][i];
     154                    xo2 += i*i*image->data.F32[j][i];
     155                    yo2 += j*j*image->data.F32[j][i];
     156                    no += image->data.F32[j][i];
     157                }
     158            }
     159            xo /= no;
     160            yo /= no;
     161            xo2 = sqrt (xo2/no - xo*xo);
     162            yo2 = sqrt (yo2/no - yo*yo);
     163            fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
     164        }
     165
     166        // measure centroid of unshifted gaussian (should be 16.0,16.0)
     167        {
     168            psImage *image = flux;
     169            float xo = 0.0;
     170            float yo = 0.0;
     171            float xo2 = 0.0;
     172            float yo2 = 0.0;
     173            float no = 0.0;
     174            for (int j = 0; j < image->numRows; j++)
     175            {
     176                for (int i = 0; i < image->numCols; i++) {
     177                    xo += i*image->data.F32[j][i];
     178                    yo += j*image->data.F32[j][i];
     179                    xo2 += i*i*image->data.F32[j][i];
     180                    yo2 += j*j*image->data.F32[j][i];
     181                    no += image->data.F32[j][i];
     182                }
     183            }
     184            xo /= no;
     185            yo /= no;
     186            xo2 = sqrt (xo2/no - xo*xo);
     187            yo2 = sqrt (yo2/no - yo*yo);
     188            fprintf (stderr, "pre-shift centroid: %f,%f, sigma: %f,%f: flux: %f\n", xo, yo, xo2, yo2, no);
     189        }
     190        # endif
     191
    135192    } else {
    136193        flux = source->pixels;
    137194    }
    138 
    139195    // set aperture mask circle to model radius
    140196    // XXX use a different radius for apertures and fits...
Note: See TracChangeset for help on using the changeset viewer.