IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 24, 2013, 12:09:27 PM (13 years ago)
Author:
eugene
Message:

first version of psphotFullForce which builds

Location:
branches/eam_branches/ipp-20130904/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psphot/src

    • Property svn:ignore
      •  

        old new  
        2424psphotModelTest
        2525psphotMinimal
         26psphotFullForce
  • branches/eam_branches/ipp-20130904/psphot/src/psphotKronFlux.c

    r36146 r36148  
    11# include "psphotInternal.h"
    22
    3 bool psphotKronFlux (pmConfig *config, const pmFPAview *view, const char *filerule, int pass)
     3bool psphotKronFlux (pmConfig *config, const pmFPAview *view, const char *filerule)
    44{
    55    bool status = true;
     
    3535        psAssert (sources, "missing sources?");
    3636
    37         pmPSF *psf = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
    38         // psAssert (psf, "missing psf?");
    39 
    40         if (!psphotKronFluxReadout (config, recipe, view, filerule, readout, sources, psf, i, pass)) {
     37        if (!psphotKronFluxReadout (config, recipe, view, filerule, readout, sources)) {
    4138            psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for %s entry %d", filerule, i);
    4239            return false;
     
    4643}
    4744
    48 bool psphotKronFluxReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, const char * filerule, pmReadout *readout, psArray *sources, pmPSF *psf, int index, int pass) {
     45bool psphotKronFluxReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, const char *filerule, pmReadout *readout, psArray *sources) {
    4946
    5047    bool status = false;
     
    6158    if (!status) {
    6259        nThreads = 0;
    63     }
    64 
    65     bool KRON_APPLY_WEIGHT = psMetadataLookupBool (&status, recipe, "KRON_APPLY_WEIGHT");
    66     if (!status) {
    67         KRON_APPLY_WEIGHT = true;
    68     }
    69 
    70     bool KRON_APPLY_WINDOW = psMetadataLookupBool (&status, recipe, "KRON_APPLY_WINDOW");
    71     if (!status) {
    72         KRON_APPLY_WINDOW = false;
    7360    }
    7461
     
    10592
    10693            // allocate a job -- if threads are not defined, this just runs the job
    107             psThreadJob *job = psThreadJobAlloc ("PSPHOT_KRON_ITERATE");
     94            psThreadJob *job = psThreadJobAlloc ("PSPHOT_KRON_FLUX");
    10895
    10996            psArrayAdd(job->args, 1, readout);
     
    11198            PS_ARRAY_ADD_SCALAR(job->args, markVal,            PS_TYPE_IMAGE_MASK);
    11299            PS_ARRAY_ADD_SCALAR(job->args, maskVal,            PS_TYPE_IMAGE_MASK);
    113             PS_ARRAY_ADD_SCALAR(job->args, pass,               PS_TYPE_S32);
    114100
    115101// set this to 0 to run without threading
     
    153139
    154140    pmReadout *readout              = job->args->data[0];
    155     psArray *sources                = job->args->data[2];
    156     psImageMaskType markVal         = PS_SCALAR_VALUE(job->args->data[4],PS_TYPE_IMAGE_MASK_DATA);
    157     psImageMaskType maskVal         = PS_SCALAR_VALUE(job->args->data[5],PS_TYPE_IMAGE_MASK_DATA);
     141    psArray *sources                = job->args->data[1];
     142    psImageMaskType markVal         = PS_SCALAR_VALUE(job->args->data[2],PS_TYPE_IMAGE_MASK_DATA);
     143    psImageMaskType maskVal         = PS_SCALAR_VALUE(job->args->data[3],PS_TYPE_IMAGE_MASK_DATA);
    158144
    159145    for (int i = 0; i < sources->n; i++) {
    160 
    161         // XXX what do i need for the kron flux (given a supplied kron radius?)
    162146
    163147        pmSource *source = sources->data[i];
     
    180164        }
    181165
    182         // is the right??
    183         float windowRadius = 6.0*source->moments->Mrf ;
     166        // is this right??
     167        float windowRadius = 2.5*source->moments->Mrf ;
    184168
    185169        // re-allocate image, weight, mask arrays for each peak with box big enough to fit BIG_RADIUS
    186         bool extend = pmSourceRedefinePixels (source, readout, source->peak->x, source->peak->y, windowRadius + 2);
     170        pmSourceRedefinePixels (source, readout, source->peak->x, source->peak->y, windowRadius + 2);
    187171        psAssert (source->pixels, "WTF?");
    188172
     
    205189
    206190    // the peak position is less accurate but less subject to extreme deviations
     191    // XXX do this or just use the peak position?
    207192    float dX = source->moments->Mx - source->peak->xf;
    208193    float dY = source->moments->My - source->peak->yf;
     
    211196    float Yo = (dR < 2.0) ? source->moments->My : source->peak->yf;
    212197
     198    // center of mass in subimage.  Note: the calculation below uses pixel index, so we correct
     199    // xCM, yCM from pixel coords to pixel index here.
     200    psF32 xCM = Xo - 0.5 - source->pixels->col0; // coord of peak in subimage
     201    psF32 yCM = Yo - 0.5 - source->pixels->row0; // coord of peak in subimage
     202
    213203    // Calculate the Kron magnitude (make this block optional?)
    214204    // XXX set the aperture here
    215     float radKron  = 2.5*Mrf;
     205    float radKron  = 2.5*source->moments->Mrf;
    216206    float radKron2 = radKron*radKron;
    217207
     
    222212    // set vPix to the source pixels (it may have been set to the
    223213    // smoothed image above)
    224     vPix = source->pixels->data.F32;
    225     vWgt = source->variance->data.F32;
    226     vMsk = source->mask->data.F32;
     214    psF32 **vPix = source->pixels->data.F32;
     215    psF32 **vWgt = source->variance->data.F32;
     216    psImageMaskType **vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
    227217
    228218    for (psS32 row = 0; row < source->pixels->numRows ; row++) {
Note: See TracChangeset for help on using the changeset viewer.