- Timestamp:
- Sep 24, 2013, 12:09:27 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130904/psphot/src
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psphotKronFlux.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130904/psphot/src
- Property svn:ignore
-
old new 24 24 psphotModelTest 25 25 psphotMinimal 26 psphotFullForce
-
- Property svn:ignore
-
branches/eam_branches/ipp-20130904/psphot/src/psphotKronFlux.c
r36146 r36148 1 1 # include "psphotInternal.h" 2 2 3 bool psphotKronFlux (pmConfig *config, const pmFPAview *view, const char *filerule , int pass)3 bool psphotKronFlux (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 5 bool status = true; … … 35 35 psAssert (sources, "missing sources?"); 36 36 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)) { 41 38 psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for %s entry %d", filerule, i); 42 39 return false; … … 46 43 } 47 44 48 bool psphotKronFluxReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, const char * filerule, pmReadout *readout, psArray *sources, pmPSF *psf, int index, int pass) {45 bool psphotKronFluxReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, const char *filerule, pmReadout *readout, psArray *sources) { 49 46 50 47 bool status = false; … … 61 58 if (!status) { 62 59 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;73 60 } 74 61 … … 105 92 106 93 // 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"); 108 95 109 96 psArrayAdd(job->args, 1, readout); … … 111 98 PS_ARRAY_ADD_SCALAR(job->args, markVal, PS_TYPE_IMAGE_MASK); 112 99 PS_ARRAY_ADD_SCALAR(job->args, maskVal, PS_TYPE_IMAGE_MASK); 113 PS_ARRAY_ADD_SCALAR(job->args, pass, PS_TYPE_S32);114 100 115 101 // set this to 0 to run without threading … … 153 139 154 140 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); 158 144 159 145 for (int i = 0; i < sources->n; i++) { 160 161 // XXX what do i need for the kron flux (given a supplied kron radius?)162 146 163 147 pmSource *source = sources->data[i]; … … 180 164 } 181 165 182 // is th eright??183 float windowRadius = 6.0*source->moments->Mrf ;166 // is this right?? 167 float windowRadius = 2.5*source->moments->Mrf ; 184 168 185 169 // 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); 187 171 psAssert (source->pixels, "WTF?"); 188 172 … … 205 189 206 190 // the peak position is less accurate but less subject to extreme deviations 191 // XXX do this or just use the peak position? 207 192 float dX = source->moments->Mx - source->peak->xf; 208 193 float dY = source->moments->My - source->peak->yf; … … 211 196 float Yo = (dR < 2.0) ? source->moments->My : source->peak->yf; 212 197 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 213 203 // Calculate the Kron magnitude (make this block optional?) 214 204 // XXX set the aperture here 215 float radKron = 2.5* Mrf;205 float radKron = 2.5*source->moments->Mrf; 216 206 float radKron2 = radKron*radKron; 217 207 … … 222 212 // set vPix to the source pixels (it may have been set to the 223 213 // 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; 227 217 228 218 for (psS32 row = 0; row < source->pixels->numRows ; row++) {
Note:
See TracChangeset
for help on using the changeset viewer.
