Skip to content
Snippets Groups Projects
Commit d452a318 authored by Loïc Le Guyader's avatar Loïc Le Guyader
Browse files

Merge branch 'ai-fastccd' into 'master'

Ai fastccd

See merge request SCS/ToolBox!59
parents 53f9f852 84f29ac7
No related branches found
No related tags found
1 merge request!59Ai fastccd
......@@ -496,7 +496,7 @@ class FastCCD:
im_pumped_mean = im_pumped_arranged.mean(axis=0)
im_unpumped_mean = im_unpumped_arranged.mean(axis=0)
ai = tb.azimuthal_integrator(im_pumped_mean.shape, center, angle_range, dr=dr)
ai = tb.azimuthal_integrator(im_pumped_mean.shape, center, angle_range, dr=dr, aspect=1)
norm = ai(~np.isnan(im_pumped_mean))
az_pump = []
......
import numpy as np
class azimuthal_integrator(object):
def __init__(self, imageshape, center, polar_range, dr=2):
def __init__(self, imageshape, center, polar_range, dr=2, aspect=204/236):
'''
Create a reusable integrator for repeated azimuthal integration of similar
images. Calculates array indices for a given parameter set that allows
......@@ -21,6 +21,9 @@ class azimuthal_integrator(object):
dr : int, default 2
radial width of the integration slices. Takes non-square DSSC pixels into account.
aspect: float, default 204/236 for DSSC
aspect ratio of the pixel pitch
Returns
=======
ai : azimuthal_integrator instance
......@@ -39,7 +42,7 @@ class azimuthal_integrator(object):
ycoord -= cy
# distance from center, hexagonal pixel shape taken into account
dist_array = np.hypot(xcoord * 204 / 236, ycoord)
dist_array = np.hypot(xcoord * aspect, ycoord)
# array of polar angles
if np.abs(polar_range[1]-polar_range[0]) > 180:
......@@ -53,7 +56,7 @@ class azimuthal_integrator(object):
polar_array = np.mod(polar_array, np.pi)
self.polar_mask = (polar_array > tmin) * (polar_array < tmax)
self.maxdist = min(sx - cx, sy - cy)
self.maxdist = max(sx - cx, sy - cy)
ix, iy = np.indices(dimensions=(sx, sy))
self.index_array = np.ravel_multi_index((ix, iy), (sx, sy))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment