IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 19, 2009, 7:59:50 AM (17 years ago)
Author:
beaumont
Message:

Added visualizations to ppSub. Set up a single variable in pmVisual to control when plots are drawn.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branch_20090215/psphot/src/psphotMagnitudes.c

    r21392 r21536  
    11# include "psphotInternal.h"
    2 
    3 bool psphotMagnitudes_Unthreaded (int *nap, psArray *sources, pmPSF *psf, psImageBinning *binning, pmReadout *backModel, pmReadout *backStdev, pmSourcePhotometryMode photMode, psImageMaskType maskVal);
    42
    53bool psphotMagnitudes(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, pmPSF *psf) {
     
    5957        for (int j = 0; j < cells->n; j++) {
    6058
    61             if (nThreads) {
    62                 // allocate a job -- if threads are not defined, this just runs the job
    63                 psThreadJob *job = psThreadJobAlloc ("PSPHOT_MAGNITUDES");
    64 
    65                 psArrayAdd(job->args, 1, cells->data[j]); // sources
    66                 psArrayAdd(job->args, 1, psf);
    67                 psArrayAdd(job->args, 1, binning);
    68                 psArrayAdd(job->args, 1, backModel);
    69                 psArrayAdd(job->args, 1, backStdev);
    70 
    71                 PS_ARRAY_ADD_SCALAR(job->args, photMode, PS_TYPE_S32);
    72                 PS_ARRAY_ADD_SCALAR(job->args, maskVal,  PS_TYPE_IMAGE_MASK);
    73                 PS_ARRAY_ADD_SCALAR(job->args, 0,        PS_TYPE_S32); // this is used as a return value for nAp
    74 
    75                 if (!psThreadJobAddPending(job)) {
    76                     psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
    77                     psFree (job);
    78                     return false;
    79                 }
    80                 psFree(job);
    81             } else {
     59            // allocate a job -- if threads are not defined, this just runs the job
     60            psThreadJob *job = psThreadJobAlloc ("PSPHOT_MAGNITUDES");
     61
     62            psArrayAdd(job->args, 1, cells->data[j]); // sources
     63            psArrayAdd(job->args, 1, psf);
     64            psArrayAdd(job->args, 1, binning);
     65            psArrayAdd(job->args, 1, backModel);
     66            psArrayAdd(job->args, 1, backStdev);
     67
     68            PS_ARRAY_ADD_SCALAR(job->args, photMode, PS_TYPE_S32);
     69            PS_ARRAY_ADD_SCALAR(job->args, maskVal,  PS_TYPE_IMAGE_MASK);
     70            PS_ARRAY_ADD_SCALAR(job->args, 0,        PS_TYPE_S32); // this is used as a return value for nAp
     71
     72            if (!psThreadJobAddPending(job)) {
     73                psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     74                psFree (job);
     75                return false;
     76            }
     77            psFree(job);
     78
     79# if (0)
    8280                int nap = 0;
    8381                if (!psphotMagnitudes_Unthreaded (&nap, cells->data[j], psf, binning, backModel, backStdev, photMode, maskVal)) {
     
    8684                }
    8785                Nap += nap;
    88             }
    89         }
    90 
    91         if (nThreads) {
    92             // wait for the threads to finish and manage results
    93             if (!psThreadPoolWait (false)) {
    94                 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
    95                 return false;
    96             }
    97 
    98             // we have only supplied one type of job, so we can assume the types here
    99             psThreadJob *job = NULL;
    100             while ((job = psThreadJobGetDone()) != NULL) {
    101                 if (job->args->n < 1) {
    102                     fprintf (stderr, "error with job\n");
    103                 } else {
    104                     psScalar *scalar = job->args->data[7];
    105                     Nap += scalar->data.S32;
    106                 }
    107                 psFree(job);
    108             }
     86# endif
     87        }
     88
     89        // wait for the threads to finish and manage results
     90        if (!psThreadPoolWait (false)) {
     91            psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");
     92            return false;
     93        }
     94
     95        // we have only supplied one type of job, so we can assume the types here
     96        psThreadJob *job = NULL;
     97        while ((job = psThreadJobGetDone()) != NULL) {
     98            if (job->args->n < 1) {
     99                fprintf (stderr, "error with job\n");
     100            } else {
     101                psScalar *scalar = job->args->data[7];
     102                Nap += scalar->data.S32;
     103            }
     104            psFree(job);
    109105        }
    110106    }
     
    162158}
    163159
     160# if (0)
    164161bool psphotMagnitudes_Unthreaded (int *nap, psArray *sources, pmPSF *psf, psImageBinning *binning, pmReadout *backModel, pmReadout *backStdev, pmSourcePhotometryMode photMode, psImageMaskType maskVal) {
    165162
     
    198195    return true;
    199196}
     197# endif
    200198
    201199bool psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources) {
     
    295293        }
    296294
    297         status = pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->maskObj, maskVal);
     295        status = pmSourcePixelWeight (&source->pixWeight, model, source->maskObj, maskVal);
    298296        if (!status) {
    299297          psTrace ("psphot", 3, "fail to measure pixel weight");
Note: See TracChangeset for help on using the changeset viewer.