Changeset 21519 for trunk/psphot/src/psphotApResid.c
- Timestamp:
- Feb 16, 2009, 12:34:24 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotApResid.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotApResid.c
r21359 r21519 1 1 # include "psphotInternal.h" 2 3 bool psphotApResidMags_Unthreaded (int *nskip, int *nfail, psArray *sources, pmPSF *psf, pmSourcePhotometryMode photMode, psImageMaskType maskVal);4 2 5 3 # define SKIPSTAR(MSG) { psTrace ("psphot", 3, "invalid : %s", MSG); continue; } … … 95 93 for (int j = 0; j < cells->n; j++) { 96 94 97 if (nThreads) {98 // allocate a job -- if threads are not defined, this just runs the job99 psThreadJob *job = psThreadJobAlloc ("PSPHOT_APRESID_MAGS"); 100 101 psArrayAdd(job->args, 1, cells->data[j]); // sources102 psArrayAdd(job->args, 1, psf);103 PS_ARRAY_ADD_SCALAR(job->args, photMode, PS_TYPE_S32);104 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 105 106 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nskip107 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail 108 109 if (!psThreadJobAddPending(job)) {110 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");111 psFree (job);112 return false;113 }114 psFree(job); 115 } else { 95 // allocate a job -- if threads are not defined, this just runs the job 96 psThreadJob *job = psThreadJobAlloc ("PSPHOT_APRESID_MAGS"); 97 98 psArrayAdd(job->args, 1, cells->data[j]); // sources 99 psArrayAdd(job->args, 1, psf); 100 PS_ARRAY_ADD_SCALAR(job->args, photMode, PS_TYPE_S32); 101 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 102 103 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nskip 104 PS_ARRAY_ADD_SCALAR(job->args, 0, PS_TYPE_S32); // this is used as a return value for Nfail 105 106 if (!psThreadJobAddPending(job)) { 107 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 108 psFree (job); 109 return false; 110 } 111 psFree(job); 112 113 # if (0) 116 114 int nskip = 0; 117 115 int nfail = 0; … … 123 121 Nskip += nskip; 124 122 Nfail += nfail; 125 } 123 # endif 126 124 127 125 } 128 126 129 if (nThreads) { 130 // wait for the threads to finish and manage results 131 if (!psThreadPoolWait (false)) { 132 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 133 return false; 127 // wait for the threads to finish and manage results 128 if (!psThreadPoolWait (false)) { 129 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 130 return false; 131 } 132 133 // we have only supplied one type of job, so we can assume the types here 134 psThreadJob *job = NULL; 135 while ((job = psThreadJobGetDone()) != NULL) { 136 if (job->args->n < 1) { 137 fprintf (stderr, "error with job\n"); 138 } else { 139 psScalar *scalar = NULL; 140 scalar = job->args->data[4]; 141 Nskip += scalar->data.S32; 142 scalar = job->args->data[5]; 143 Nfail += scalar->data.S32; 134 144 } 135 136 // we have only supplied one type of job, so we can assume the types here 137 psThreadJob *job = NULL; 138 while ((job = psThreadJobGetDone()) != NULL) { 139 if (job->args->n < 1) { 140 fprintf (stderr, "error with job\n"); 141 } else { 142 psScalar *scalar = NULL; 143 scalar = job->args->data[4]; 144 Nskip += scalar->data.S32; 145 scalar = job->args->data[5]; 146 Nfail += scalar->data.S32; 147 } 148 psFree(job); 149 } 145 psFree(job); 150 146 } 151 147 } … … 497 493 continue; 498 494 } 495 source->mode |= PM_SOURCE_MODE_AP_MAGS; 499 496 } 500 497 … … 509 506 } 510 507 508 # if (0) 511 509 bool psphotApResidMags_Unthreaded (int *nskip, int *nfail, psArray *sources, pmPSF *psf, pmSourcePhotometryMode photMode, psImageMaskType maskVal) { 512 510 … … 542 540 return true; 543 541 } 542 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
