- Timestamp:
- Feb 19, 2009, 7:59:50 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branch_20090215/psphot/src/psphotMagnitudes.c
r21392 r21536 1 1 # include "psphotInternal.h" 2 3 bool psphotMagnitudes_Unthreaded (int *nap, psArray *sources, pmPSF *psf, psImageBinning *binning, pmReadout *backModel, pmReadout *backStdev, pmSourcePhotometryMode photMode, psImageMaskType maskVal);4 2 5 3 bool psphotMagnitudes(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources, pmPSF *psf) { … … 59 57 for (int j = 0; j < cells->n; j++) { 60 58 61 if (nThreads) {62 // allocate a job -- if threads are not defined, this just runs the job63 psThreadJob *job = psThreadJobAlloc ("PSPHOT_MAGNITUDES"); 64 65 psArrayAdd(job->args, 1, cells->data[j]); // sources66 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) 82 80 int nap = 0; 83 81 if (!psphotMagnitudes_Unthreaded (&nap, cells->data[j], psf, binning, backModel, backStdev, photMode, maskVal)) { … … 86 84 } 87 85 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); 109 105 } 110 106 } … … 162 158 } 163 159 160 # if (0) 164 161 bool psphotMagnitudes_Unthreaded (int *nap, psArray *sources, pmPSF *psf, psImageBinning *binning, pmReadout *backModel, pmReadout *backStdev, pmSourcePhotometryMode photMode, psImageMaskType maskVal) { 165 162 … … 198 195 return true; 199 196 } 197 # endif 200 198 201 199 bool psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources) { … … 295 293 } 296 294 297 status = pmSourcePixelWeight (&source->pixWeight, model, source-> pixels, source->maskObj, maskVal);295 status = pmSourcePixelWeight (&source->pixWeight, model, source->maskObj, maskVal); 298 296 if (!status) { 299 297 psTrace ("psphot", 3, "fail to measure pixel weight");
Note:
See TracChangeset
for help on using the changeset viewer.
