diff options
author | Thomas White <taw@physics.org> | 2010-04-06 17:01:54 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-04-06 17:07:57 +0200 |
commit | 1932df41cf4a71c2a89a134a20b9e6e1f65bc31f (patch) | |
tree | e92b27a419eaca6b163750977f0d68959fdaf2ca /src | |
parent | 33c6e3f3250c983a13f9967b4ae4923fa7b5cd18 (diff) |
Compensate for pixel solid angle when integrating peaks
Diffstat (limited to 'src')
-rw-r--r-- | src/peaks.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/peaks.c b/src/peaks.c index b44bd011..104cf170 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -143,6 +143,9 @@ static void integrate_peak(struct image *image, int xp, int yp, for ( y=-INTEGRATION_RADIUS; y<+INTEGRATION_RADIUS; y++ ) { int val; + struct panel *p; + double sa, pix_area, Lsq, dsq, proj_area; + float tt; /* Circular mask */ if ( x*x + y*y > lim ) continue; @@ -150,7 +153,24 @@ static void integrate_peak(struct image *image, int xp, int yp, if ( ((x+xp)>=image->width) || ((x+xp)<0) ) continue; if ( ((y+yp)>=image->height) || ((y+yp)<0) ) continue; - val = image->data[(x+xp)+image->width*(y+yp)]; + p = find_panel(&image->det, x+xp, y+yp); + + /* Area of one pixel */ + pix_area = pow(1.0/p->res, 2.0); + Lsq = pow(p->clen, 2.0); + + /* Area of pixel as seen from crystal (approximate) */ + get_q(image, x+xp, y+yp, 1, &tt, 1.0 / image->lambda); + proj_area = pix_area * cos(tt); + + /* Calculate distance from crystal to pixel */ + dsq = pow(((double)(x+xp) - p->cx) / p->res, 2.0); + dsq += pow(((double)(y+yp) - p->cy) / p->res, 2.0); + + /* Projected area of pixel divided by distance squared */ + sa = 1.0e7 * proj_area / (dsq + Lsq); + + val = image->data[(x+xp)+image->width*(y+yp)] / sa; total += val; |