Changeset 6481 for trunk/psphot/src/psModulesUtils.c
- Timestamp:
- Feb 23, 2006, 6:16:11 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psModulesUtils.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psModulesUtils.c
r6379 r6481 144 144 int xIs, xJs, yIs, yJs; 145 145 int xIe, yIe; 146 float flux ;146 float flux, wt; 147 147 148 148 psImage *Pi = Mi->pixels; 149 149 psImage *Pj = Mj->pixels; 150 151 psImage *Wi = Mi->weight; 150 152 151 153 psImage *Ti = Mi->mask; … … 166 168 yIe = Ye - Pi->row0; 167 169 170 // note that this is addressing the same image pixels, 171 // though only if both are source not model images 168 172 flux = 0; 169 173 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { … … 171 175 if (Ti->data.U8[yi][xi]) continue; 172 176 if (Tj->data.U8[yj][xj]) continue; 173 flux += Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]; 177 wt = Wi->data.F32[yi][xi]; 178 if (wt > 0) { 179 flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt; 180 } 181 } 182 } 183 return (flux); 184 } 185 186 float pmSourceCrossWeight (pmSource *Mi, pmSource *Mj) { 187 188 int Xs, Xe, Ys, Ye; 189 int xi, xj, yi, yj; 190 int xIs, xJs, yIs, yJs; 191 int xIe, yIe; 192 float flux, wt; 193 194 psImage *Pi = Mi->pixels; 195 psImage *Pj = Mj->pixels; 196 197 psImage *Wi = Mi->weight; 198 199 psImage *Ti = Mi->mask; 200 psImage *Tj = Mj->mask; 201 202 Xs = PS_MAX (Pi->col0, Pj->col0); 203 Xe = PS_MIN (Pi->col0 + Pi->numCols, Pj->col0 + Pj->numCols); 204 205 Ys = PS_MAX (Pi->row0, Pj->row0); 206 Ye = PS_MIN (Pi->row0 + Pi->numRows, Pj->row0 + Pj->numRows); 207 208 xIs = Xs - Pi->col0; 209 xJs = Xs - Pj->col0; 210 yIs = Ys - Pi->row0; 211 yJs = Ys - Pj->row0; 212 213 xIe = Xe - Pi->col0; 214 yIe = Ye - Pi->row0; 215 216 // note that this is addressing the same image pixels, 217 // though only if both are source not model images 218 flux = 0; 219 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 220 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 221 if (Ti->data.U8[yi][xi]) continue; 222 if (Tj->data.U8[yj][xj]) continue; 223 wt = Wi->data.F32[yi][xi]; 224 if (wt > 0) { 225 flux += 1.0 / wt; 226 } 174 227 } 175 228 } … … 250 303 return NULL; 251 304 } 305 306 bool psRegionIsNaN (psRegion region) { 307 308 if (!isfinite(region.x0)) return true; 309 if (!isfinite(region.x1)) return true; 310 if (!isfinite(region.y0)) return true; 311 if (!isfinite(region.y1)) return true; 312 return false; 313 }
Note:
See TracChangeset
for help on using the changeset viewer.
