Skip to content
Snippets Groups Projects

[AGIPD][TESTs]test_agipdlib AGIPDCtrl and get_bias_voltage for AGIPD1M and AGIPD500K

Merged Karim Ahmed requested to merge test/test_agipdlib into master
All threads resolved!
2 files
+ 8
25
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -120,35 +120,18 @@ def histogram2d(cnp.ndarray[float, ndim=1] data_x, cnp.ndarray[float, ndim=1] da
return ret, np.linspace(min_x, max_x, bins_x+1), np.linspace(min_y, max_y, bins_y+1)
@boundscheck(False)
@wraparound(False)
def gain_choose(cnp.ndarray[cnp.uint8_t, ndim=3] a, cnp.ndarray[cnp.float32_t, ndim=4] choices):
"""Specialised fast equivalent of np.choose(), to select data for a per-pixel gain stage"""
cdef int i, j, k
cdef cnp.uint8_t v
cdef cnp.ndarray[cnp.float32_t, ndim=3] out
out = np.zeros_like(a, dtype=np.float32)
assert (<object>choices).shape == (3,) + (<object>a).shape
with nogil:
for i in range(a.shape[0]):
for j in range(a.shape[1]):
for k in range(a.shape[2]):
v = a[i, j, k]
out[i, j, k] = choices[v, i, j, k]
return out
ctypedef fused choices_t:
cnp.float32_t
cnp.int32_t
@boundscheck(False)
@wraparound(False)
def gain_choose_int(cnp.ndarray[cnp.uint8_t, ndim=3] a, cnp.ndarray[cnp.int32_t, ndim=4] choices):
def gain_choose(cnp.ndarray[cnp.uint8_t, ndim=3] a, cnp.ndarray[choices_t, ndim=4] choices):
"""Specialised fast equivalent of np.choose(), to select data for a per-pixel gain stage"""
cdef int i, j, k
cdef cnp.uint8_t v
cdef cnp.ndarray[cnp.int32_t, ndim=3] out
out = np.zeros_like(a, dtype=np.int32)
cdef cnp.ndarray[choices_t, ndim=3] out
out = np.zeros_like(a, dtype=(<object>choices).dtype)
assert (<object>choices).shape == (3,) + (<object>a).shape
Loading