IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5593


Ignore:
Timestamp:
Nov 25, 2005, 1:13:43 PM (21 years ago)
Author:
eugene
Message:

updated to use psLib.v8, dropping _EAM code everywhere

Location:
trunk/psphot
Files:
2 deleted
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/Makefile

    r5120 r5593  
    3636$(SRC)/psLibUtils.$(ARCH).o        \
    3737$(SRC)/psLine.$(ARCH).o            \
    38 $(SRC)/psMinimize.$(ARCH).o        \
    39 $(SRC)/psPolynomials.$(ARCH).o     \
    4038$(SRC)/psEllipse.$(ARCH).o         \
    4139$(SRC)/psModulesUtils.$(ARCH).o    \
     
    5553
    5654$(SRC)/pmModelGroup.$(ARCH).o: $(MODELS)
    57 
    58 # deprecated
    5955
    6056FITSOURCE = \
  • trunk/psphot/doc/notes.txt

    r5048 r5593  
    11
    22Notes on psphot
     3
     42005.11.16
     5
     6  I have made some fixes to make psphot work with pslib rel8_0.  I
     7  need to merge psphot with the rel8_0 version of the psMinimize and
     8  pmObjects code. 
    39
    4102005.09.06
  • trunk/psphot/src/models/pmModel_GAUSS.c

    r4977 r5593  
    124124    for (int i = 4; i < 7; i++) {
    125125        psPolynomial2D *poly = psf->params->data[i-4];
    126         out[i] = Polynomial2DEval_EAM (poly, out[2], out[3]);
     126        out[i] = psPolynomial2DEval (poly, out[2], out[3]);
    127127    }
    128128    return(true);
  • trunk/psphot/src/models/pmModel_PGAUSS.c

    r4977 r5593  
    140140    for (int i = 4; i < 7; i++) {
    141141        psPolynomial2D *poly = psf->params->data[i-4];
    142         out[i] = Polynomial2DEval_EAM (poly, out[2], out[3]);
     142        out[i] = psPolynomial2DEval (poly, out[2], out[3]);
    143143    }
    144144    return(true);
  • trunk/psphot/src/models/pmModel_QGAUSS.c

    r5129 r5593  
    170170    for (int i = 4; i < 8; i++) {
    171171        psPolynomial2D *poly = psf->params->data[i-4];
    172         out[i] = Polynomial2DEval_EAM (poly, out[2], out[3]);
     172        out[i] = psPolynomial2DEval (poly, out[2], out[3]);
    173173    }
    174174    return(true);
  • trunk/psphot/src/models/pmModel_SGAUSS.c

    r4977 r5593  
    300300    for (int i = 4; i < 9; i++) {
    301301        psPolynomial2D *poly = psf->params->data[i-4];
    302         out[i] = Polynomial2DEval_EAM (poly, out[2], out[3]);
     302        out[i] = psPolynomial2DEval (poly, out[2], out[3]);
    303303    }
    304304    return(true);
  • trunk/psphot/src/models/pmModel_TGAUSS.c

    r5130 r5593  
    173173    for (int i = 4; i < 8; i++) {
    174174        psPolynomial2D *poly = psf->params->data[i-4];
    175         out[i] = Polynomial2DEval_EAM (poly, out[2], out[3]);
     175        out[i] = psPolynomial2DEval (poly, out[2], out[3]);
    176176    }
    177177    return(true);
  • trunk/psphot/src/pmObjects_EAM.c

    r5351 r5593  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-10-17 19:04:33 $
     8 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-11-25 23:13:43 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    999999    int Ncr      = 0;
    10001000    int Nsatstar = 0;
    1001     // psRegion allArray;
     1001    psRegion allArray = psRegionSet (0, 0, 0, 0);
    10021002
    10031003    psVector *starsn = psVectorAlloc (sources->n, PS_TYPE_F32);
     
    10311031
    10321032        // XXX EAM : can we use the value of SATURATE if mask is NULL?
    1033         // XXX EAM *** serious errors in psImageCountPixelMask: inconsistent with psRegion and subimage
    1034         // allArray = psRegionSet (1, tmpSrc->mask->numCols, 1, tmpSrc->mask->numRows);
    1035         // int Nsatpix = psImageCountPixelMask (tmpSrc->mask, allArray, PSPHOT_MASK_SATURATED);
    1036         int Nsatpix = psImageCountPixelMask_EAM (tmpSrc->mask, PSPHOT_MASK_SATURATED);
     1033        // allArray = psRegionSet (0, 0, 0, 0);
     1034        int Nsatpix = psImageCountPixelMask (tmpSrc->mask, allArray, PSPHOT_MASK_SATURATED);
    10371035
    10381036        // saturated star (size consistent with PSF or larger)
     
    16481646                Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So));
    16491647
    1650                 // psMinimizeLMChi2_EAM takes wt = 1/dY^2
     1648                // psMinimizeLMChi2 takes wt = 1/dY^2
    16511649                if (source->weight->data.F32[i][j] == 0) {
    16521650                  yErr->data.F32[tmpCnt] = 0.0;
     
    17011699
    17021700    psTrace (".pmObjects.pmSourceFitModel", 5, "fitting function\n");
    1703     fitStatus = psMinimizeLMChi2_EAM(myMin, covar, params, paramMask, x, y, yErr, modelFunc);
     1701
     1702    fitStatus = psMinimizeLMChi2 (myMin, covar, params, paramMask, x, y, yErr, modelFunc);
    17041703    for (int i = 0; i < dparams->n; i++) {
    17051704        if ((paramMask != NULL) && paramMask->data.U8[i]) continue;
    17061705        dparams->data.F32[i] = sqrt(covar->data.F64[i][i]);
    17071706    }
    1708  
    17091707    // XXX EAM: we need to do something (give an error?) if rc is false
    17101708    // XXX EAM: psMinimizeLMChi2 does not check convergence
     
    17241722    if (paramMask != NULL) {
    17251723        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64);
    1726         psMinimizeGaussNewtonDelta_EAM (delta, params, NULL, x, y, yErr, modelFunc);
     1724        psMinimizeGaussNewtonDelta (delta, params, NULL, x, y, yErr, modelFunc);
    17271725        for (int i = 0; i < dparams->n; i++) {
    17281726            if (!paramMask->data.U8[i]) continue;
  • trunk/psphot/src/pmPSF.c

    r5126 r5593  
    3838    psf->params = psArrayAlloc (Nparams - 4);
    3939    for (int i = 0; i < psf->params->n; i++) {
    40         // XXX EAM : make this a user-defined value?
    41         // XXX EAM : future version (0.7.0?) psf->params->data[i] = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 1, 1);
     40        // XXX EAM : make polynomial order user-specified?
    4241        if (1) {
    43             psf->params->data[i] = Polynomial2DAlloc_EAM(PS_POLYNOMIAL_ORD, 1, 1);
     42            psf->params->data[i] = psPolynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD);
    4443        } else {
    45             psf->params->data[i] = Polynomial2DAlloc_EAM(PS_POLYNOMIAL_ORD, 0, 0);
     44            psf->params->data[i] = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD);
    4645        }
    4746    }
     
    9392
    9493        // XXX EAM : this is the expected API (cycle 7? cycle 8?)
    95         psf->params->data[i] = VectorClipFitPolynomial2D_EAM (psf->params->data[i], stats, mask, 0xff, z, dz, x, y);
     94        psf->params->data[i] = psVectorClipFitPolynomial2D (psf->params->data[i], stats, mask, 0xff, z, dz, x, y);
    9695
    9796        // XXX EAM : drop this when above is implemented...
  • trunk/psphot/src/pmPSFtry.c

    r5134 r5593  
    265265  }
    266266
    267   // linear fit to rfBin, daBin
    268   psPolynomial1D *poly = Polynomial1DAlloc_EAM (PS_POLYNOMIAL_ORD, 1);
    269 
    270   // XXX EAM : this is the intended API (cycle 7? cycle 8?)
     267  // linear clipped fit to rfBin, daBin
     268  psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD);
    271269  psStats *fitstat = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    272   poly = VectorClipFitPolynomial1D_EAM (poly, fitstat, maskB, 1, daBin, NULL, rfBin);
    273 
    274   // poly = VectorFitPolynomial1D_EAM (poly, maskB, 1, daBin, NULL, rfBin);
    275 
    276   // XXX EAM : replace this when the above version is implemented
    277   // poly = VectorFitPolynomial1DOrd_EAM (poly, maskB, rfBin, daBin, NULL);
    278 
    279   psVector *daBinFit = Polynomial1DEvalVector_EAM (poly, rfBin);
     270  poly = psVectorClipFitPolynomial1D (poly, fitstat, maskB, 1, daBin, NULL, rfBin);
     271
     272  psVector *daBinFit = psPolynomial1DEvalVector (poly, rfBin);
    280273  psVector *daResid  = (psVector *) psBinaryOp (NULL, (void *) daBin, "-", (void *) daBinFit);
    281274
     
    326319  stats->clipIter = 3;
    327320
    328   // linear fit to rfBin, daBin
    329   psPolynomial1D *poly = Polynomial1DAlloc_EAM (PS_POLYNOMIAL_ORD, 1);
    330 
    331   // XXX EAM : this is the intended API (cycle 7? cycle 8?)
    332   poly = VectorClipFitPolynomial1D_EAM (poly, stats, try->mask, PSFTRY_MASK_ALL, try->metric, NULL, rflux);
    333 
     321  // linear clipped fit to rfBin, daBin
     322  psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD);
     323  poly = psVectorClipFitPolynomial1D (poly, stats, try->mask, PSFTRY_MASK_ALL, try->metric, NULL, rflux);
    334324  fprintf (stderr, "fit stats: %f +/- %f\n", stats->sampleMedian, stats->sampleStdev);
    335 
    336   // these stats should come back from the fit above...
    337   // psVector *daFit   = Polynomial1DEvalVector_EAM (poly, rflux);
    338   // psVector *daResid = (psVector *) psBinaryOp (NULL, (void *) try->metric, "-", (void *) daFit);
    339 
    340   // stats = psStatsAlloc (PS_STAT_CLIPPED_STDEV);
    341   // stats->clipIter = 3;
    342   // stats->clipSigma = 3;
    343 
    344   // stats = psVectorStats (stats, daResid, NULL, maskB, 1);
    345325
    346326  try->psf->ApResid = poly->coeff[0];
  • trunk/psphot/src/pmPeaksSigmaLimit.c

    r5049 r5593  
    1616
    1717    psImage *smooth = psImageCopy (NULL, imdata->image, PS_TYPE_F32);
    18     psImageSmooth_EAM (smooth, SIGMA, NSIGMA);
     18    psImageSmooth (smooth, SIGMA, NSIGMA);
    1919    psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot"));
    2020
  • trunk/psphot/src/psLibUtils.c

    r5351 r5593  
    11# include <strings.h>  // for strncasecmp
     2# include <unistd.h>   // for write
    23# include <pslib.h>
    34# include "psLibUtils.h"
    45
    5 // XXX EAM : this is NOT included in the C99 headers ??
    6 FILE *fdopen(int fildes, const char *mode);
    7 
    8 // XXX EAM : these utility functions should be added back into PSLib
    9 
    10 # if (0) // now in psLib (v8)
    11 static psHash *timers = NULL;
    12 
    13 // start/restart a named timer
    14 bool psTimerStart (char *name) {
    15 
    16     psTime *start;
    17 
    18     if (timers == NULL) timers = psHashAlloc (16);
    19 
    20     start = psTimeGetNow (PS_TIME_UTC);
    21     psHashAdd (timers, name, start);
    22     psFree (start);
    23     return (TRUE);
    24 }
    25 
    26 bool psTimerClear (char *name) {
    27 
    28   bool status;
    29 
    30   if (name == NULL) return false;
    31 
    32   status = psHashRemove (timers, name);
    33   return (status);
    34 }
    35 
    36 // get current elapsed time on named timer
    37 psF64 psTimerMark (char *name) {
    38 
    39     psTime *start;
    40     psTime *mark;
    41     psF64   delta;
    42 
    43     if (timers == NULL) return (0);
    44 
    45     start = psHashLookup (timers, name);
    46     if (start == NULL) return (0);
    47 
    48     mark = psTimeGetNow (PS_TIME_UTC);
    49     delta = psTimeDelta (mark, start);
    50     psFree (mark);
    51     // psFree (start); -- XXX is psHashLookup not psMemCopying?
    52 
    53     return (delta);
    54 }
    55 
    56 void psTimerFree () {
    57 
    58   psFree (timers);
    59   p_psTimeFinalize();
    60   return;
    61 }
    62 # endif
    63 
    64 # if (0)
    65 // find the location of the specified argument
    66 int psArgumentGet (int argc, char **argv, char *arg) {
    67 
    68     int i;
    69 
    70     for (i = 0; i < argc; i++) {
    71         if (!strcmp(argv[i], arg))
    72             return (i);
    73     }
    74  
    75     return ((int)NULL);
    76 }
    77 
    78 // remove the specified argument (by location)
    79 int psArgumentRemove (int N, int *argc, char **argv) {
    80 
    81     int i;
    82 
    83     if ((N != (int)NULL) && (N != 0)) {
    84         (*argc)--;
    85         for (i = N; i < *argc; i++) {
    86             argv[i] = argv[i+1];
    87         }
    88     }
    89 
    90     return (N);
    91 }
    92 # endif
    93 
     6// XXX EAM : These two functions (psLogArguments and psTraceArguments) have been
     7//           rolled together into a single function in psLib
    948// we have log levels 1 (Error), 2 (Warning), 3 (Info), 4 (Details), 5 (Minutiae)
    959// 2 = default, -v = 3, -vv = 4, -vvv = 5
     
    15165}
    15266
    153 # if (0)
    154 // alternate implementation of this function from pmObjects.c
    155 // now defined in psLib SDRS as psImageRow
    156 psVector *psGetRowVectorFromImage(psImage *image,
    157                                   psU32 row)
    158 {
    159     PS_ASSERT_IMAGE_NON_NULL(image, NULL);
    160     PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL);
    161 
    162     psVector *tmpVector = psVectorAlloc(image->numCols, PS_TYPE_F32);
    163     memcpy (tmpVector->data.F32, image->data.F32[row], image->numCols*sizeof(psF32));
    164     return(tmpVector);
    165 }
    166 # endif
    167 
    168 // XXX EAM : this is now in psLib
    169 void psImageSmooth_EAM (psImage *image, float sigma, float Nsigma) {
    170 
    171     int Nx, Ny, Npixel, Nrange;
    172     float factor, g, s;
    173     psVector *temp;
    174 
    175     // relevant terms
    176     Nrange = sigma*Nsigma + 0.5;
    177     Npixel = 2*Nrange + 1;
    178     factor = -0.5/(sigma*sigma);
    179 
    180     Nx = image->numCols;
    181     Ny = image->numRows;
    182 
    183     // generate gaussian
    184     psVector *gaussnorm = psVectorAlloc (Npixel, PS_TYPE_F32);
    185     for (int i = -Nrange; i < Nrange + 1; i++) {
    186         gaussnorm->data.F32[i+Nrange] = exp (factor*i*i);
    187     }
    188     psF32 *gauss = &gaussnorm->data.F32[Nrange];
    189 
    190     // smooth in X direction
    191     temp = psVectorAlloc (Nx, PS_TYPE_F32);
    192     for (int j = 0; j < Ny; j++) {
    193         psF32 *vi = image->data.F32[j];
    194         psF32 *vo = temp->data.F32;
    195         for (int i = 0; i < Nx; i++) {
    196             g = s = 0;
    197             for (int n = -Nrange; n < Nrange + 1; n++) {
    198                 if (i+n < 0) continue;
    199                 if (i+n >= Nx) continue;
    200                 s += gauss[n]*vi[i+n];
    201                 g += gauss[n];
    202             }
    203             vo[i] = s / g;
    204         }
    205         memcpy (image->data.F32[j], temp->data.F32, Nx*sizeof(psF32));
    206     }
    207     psFree (temp);
    208 
    209     // smooth in Y direction
    210     temp = psVectorAlloc (image->numRows, PS_TYPE_F32);
    211     for (int i = 0; i < Nx; i++) {
    212         psF32  *vo = temp->data.F32;
    213         psF32 **vi = image->data.F32;
    214         for (int j = 0; j < Ny; j++) {
    215             g = s = 0;
    216             for (int n = -Nrange; n < Nrange + 1; n++) {
    217                 if (j+n < 0) continue;
    218                 if (j+n >= Ny) continue;
    219                 s += gauss[n]*vi[j+n][i];
    220                 g += gauss[n];
    221             }
    222             vo[j] = s / g;
    223         }
    224         // replace temp in image
    225         for (int j = 0; j < Ny; j++) {
    226             vi[j][i] = vo[j];
    227         }
    228     }
    229     psFree (temp);
    230     psFree (gaussnorm);
    231 }
    232    
    233 bool psImageInit (psImage *image,...) {
    234 
    235   va_list argp;
    236   psU8  vU8;
    237   psF32 vF32;
    238   psF64 vF64;
    239 
    240   if (image == NULL) return (false);
    241 
    242   va_start (argp, image);
    243 
    244   switch (image->type.type) {
    245     case PS_TYPE_U8:
    246       vU8 = va_arg (argp, psU32);
    247 
    248       for (int iy = 0; iy < image->numRows; iy++) {
    249         for (int ix = 0; ix < image->numCols; ix++) {
    250           image->data.U8[iy][ix] = vU8;
    251         }
    252       }
    253       break;
    254 
    255     case PS_TYPE_F32:
    256       vF32 = va_arg (argp, psF64);
    257      
    258       for (int iy = 0; iy < image->numRows; iy++) {
    259         for (int ix = 0; ix < image->numCols; ix++) {
    260           image->data.F32[iy][ix] = vF32;
    261         }
    262       }
    263       return (true);
    264 
    265     case PS_TYPE_F64:
    266       vF64 = va_arg (argp, psF64);
    267 
    268       for (int iy = 0; iy < image->numRows; iy++) {
    269         for (int ix = 0; ix < image->numCols; ix++) {
    270           image->data.F64[iy][ix] = vF64;
    271         }
    272       }
    273       return (true);
    274 
    275     default:
    276       psAbort ("psphot.psUtils", "datatype %d not defined in psImageInit\n", image->type);
    277       return (false);
    278   }
    279   return (false);
    280 }           
    281 
    282 // now in psLib (v8)
    283 // count number of pixels with given mask value
    284 // XXX EAM : version in psLib is broken
    285 int psImageCountPixelMask_EAM (psImage *mask, psU8 value)
    286 {
    287     int Npixels = 0;
    288  
    289     for (int i = 0; i < mask->numRows; i++) {
    290         for (int j = 0; j < mask->numCols; j++) {
    291             if (mask->data.U8[i][j] & value) {
    292                 Npixels ++;
    293             }
    294         }
    295     }
    296     return (Npixels);
    297 }
    298 
    299 // define a square region centered on the given coordinate
    300 // XXX EAM : this is now in psLib
    301 # if (0)
    302 psRegion *psRegionSquare (psF32 x, psF32 y, psF32 radius) {
    303     psRegion *region;
    304     region = psRegionAlloc (x - radius, x + radius + 1,   
    305                             y - radius, y + radius + 1);
    306     return (region);
    307 }
    308 # endif
    309 
    310 // set actual region based on image parameters:
    311 // compensate for negative upper limits
    312 // XXX this is inconsistent: the coordindates should always be in the parent
    313 //     frame, which means the negative values should subtract from Nx,Ny of
    314 //     the parent, not the child.  but, we don't carry the dimensions of the
    315 //     parent in the psImage container.  for now, use the child Nx,Ny
    316 //     force range to be on this subimage
    317 // XXX EAM : this needs to be changed to use psRegion rather than psRegion*
    318 // XXX EAM : this is now in psLib
    319 # if (0)
    320 psRegion *psRegionForImage (psRegion *out, psImage *image, psRegion *in) {
    321    
    322     // x0,y0, x1,y1 are in *parent* units
    323 
    324     if (out == NULL) {
    325         out = psRegionAlloc(in->x0, in->x1, in->y0, in->y1);
    326     } else {
    327         *out = *in;
    328     }
    329     // XXX these are probably wrong (see above)
    330     if (out->x1 <= 0) {
    331         out->x1 = image->col0 + image->numCols + out->x1;
    332     }
    333     if (out->y1 <= 0) {
    334         out->y1 = image->row0 + image->numRows + out->y1;
    335     }
    336 
    337     // force the lower-limits to be on the child
    338     out->x0 = PS_MAX(image->col0, out->x0);
    339     out->y0 = PS_MAX(image->row0, out->y0);
    340 
    341     // force the upper-limits to be on the child
    342     out->x1 = PS_MIN(image->col0 + image->numCols, out->x1);
    343     out->y1 = PS_MIN(image->row0 + image->numRows, out->y1);
    344     return (out);
    345 }
    346 # endif
    347 
    348 // mask the area contained by the region
    349 // the region is defined wrt the parent image
    350 // XXX EAM : this is now in psLib
    351 # if (0)
    352 void psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue) {
    353 
    354     for (int iy = 0; iy < image->numRows; iy++) {
    355         for (int ix = 0; ix < image->numCols; ix++) {
    356             if (ix + image->col0 <  region->x0) continue;
    357             if (ix + image->col0 >= region->x1) continue;
    358             if (iy + image->row0 <  region->y0) continue;
    359             if (iy + image->row0 >= region->y1) continue;
    360             if (logical_and) {
    361                 image->data.U8[iy][ix] &= maskValue;
    362             } else {
    363                 image->data.U8[iy][ix] |= maskValue;
    364             }
    365         }
    366     }
    367 }
    368 # endif
    369 
    370 // mask the area not contained by the region
    371 // the region is defined wrt the parent image
    372 // XXX EAM : this is now in psLib
    373 # if (0)
    374 void psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue) {
    375 
    376     for (int iy = 0; iy < image->numRows; iy++) {
    377         for (int ix = 0; ix < image->numCols; ix++) {
    378             if (ix + image->col0 <  region->x0) goto maskit;
    379             if (ix + image->col0 >= region->x1) goto maskit;
    380             if (iy + image->row0 <  region->y0) goto maskit;
    381             if (iy + image->row0 >= region->y1) goto maskit;
    382             continue;
    383         maskit:
    384             if (logical_and) {
    385                 image->data.U8[iy][ix] &= maskValue;
    386             } else {
    387                 image->data.U8[iy][ix] |= maskValue;
    388             }
    389         }
    390     }
    391 }
    392 # endif
    393 
    394 // mask the area contained by the region
    395 // the region is defined wrt the parent image
    396 // XXX EAM : this is now in psLib
    397 # if (0)
    398 void psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue) {
    399 
    400     double dx, dy, r2, R2;
    401 
    402     R2 = PS_SQR(radius);
    403 
    404     for (int iy = 0; iy < image->numRows; iy++) {
    405         for (int ix = 0; ix < image->numCols; ix++) {
    406             dx = ix + image->col0 - x;
    407             dy = iy + image->row0 - y;
    408             r2 = PS_SQR(dx) + PS_SQR(dy);
    409             if (r2 > R2) continue;
    410             if (logical_and) {
    411                 image->data.U8[iy][ix] &= maskValue;
    412             } else {
    413                 image->data.U8[iy][ix] |= maskValue;
    414             }
    415         }
    416     }
    417 }
    418 # endif
    419 
    420 // mask the area contained by the region
    421 // the region is defined wrt the parent image
    422 // XXX EAM : this is now in psLib
    423 # if (0)
    424 void psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue) {
    425 
    426     double dx, dy, r2, R2;
    427 
    428     R2 = PS_SQR(radius);
    429 
    430     for (int iy = 0; iy < image->numRows; iy++) {
    431         for (int ix = 0; ix < image->numCols; ix++) {
    432             dx = ix + image->col0 - x;
    433             dy = iy + image->row0 - y;
    434             r2 = PS_SQR(dx) + PS_SQR(dy);
    435             if (r2 < R2) continue;
    436             if (logical_and) {
    437                 image->data.U8[iy][ix] &= maskValue;
    438             } else {
    439                 image->data.U8[iy][ix] |= maskValue;
    440             }
    441         }
    442     }
    443 }
    444 # endif
    445 
    446 # if (0)
    447 psVector *psVectorCreate (double lower, double upper, double delta, psElemType type) {
    448 
    449   int nBin = (upper - lower) / delta;
    450 
    451   psVector *out = psVectorAlloc (nBin, type);
    452  
    453   for (int i = 0; i < nBin; i++) {
    454     out->data.F64[i] = lower + i * delta;
    455   }
    456 
    457   return (out);
    458 }
    459 # endif
    460 
    46167// XXX EAM a utility function
    46268bool p_psVectorPrintRow (int fd, psVector *a, char *name)
    46369{
    46470
    465     FILE *f;
    466     f = fdopen(fd, "a+");
    467     fprintf (f, "vector: %s\n", name);
     71    char line[1024];
     72
     73    sprintf (line, "vector: %s\n", name);
     74    write (fd, line, strlen(line));
    46875
    46976    for (int i = 0; i < a[0].n; i++) {
    470         fprintf (f, "%f  ", p_psVectorGetElementF64(a, i));
     77        sprintf (line, "%f  ", p_psVectorGetElementF64(a, i));
     78        write (fd, line, strlen(line));
    47179    }
    472     fprintf (f, "\n");
    473     fclose(f);
     80    write (fd, "\n", 1);
    47481    return (true);
    47582}
    476 // XXX EAM is the use of fdopen here a good way to do this?
  • trunk/psphot/src/psphotFitGalaxies.c

    r5058 r5593  
    7575        // fit FLT (not PSF) model (set/unset the pixel mask)
    7676        psImageKeepCircle (source->mask, x, y, model->radius, "OR", PSPHOT_MASK_MARKED);
    77         // XXX EAM : 0.5.0 code used _EAM version
    78         // status = pmSourceFitModel (source, model, false);
    7977        status = pmSourceFitModel (source, model, false);
    8078        psImageKeepCircle (source->mask, x, y, model->radius, "AND", ~PSPHOT_MASK_MARKED);
Note: See TracChangeset for help on using the changeset viewer.