Commit 68f8a73d authored by Carsten Richter's avatar Carsten Richter

changed the way the projections are done -- may beed cross-check

parent d9c0fd18
......@@ -87,11 +87,26 @@ def project(data, hits=None):
if hits is not None:
with warnings.catch_warnings():
warnings.simplefilter('ignore', RuntimeWarning)
data /= hits
data[hits <= 0] = 0
dim2_sum = data.sum(axis=0).sum(axis=0)
data_sum_dim2 = data.sum(axis=2)
dim1_sum = data_sum_dim2.sum(axis=0)
dim0_sum = data_sum_dim2.sum(axis=1)
tmp = hits.sum(2)
hits0_sum = tmp.sum(1)
hits1_sum = tmp.sum(0)
hits2_sum = hits.sum((0,1))
print(data.dtype, hits.dtype)
else:
hits0_sum = hits1_sum = hits2_sum = 1
tmp = data.sum(2)
dim0_sum = tmp.sum(1) / hits0_sum
dim1_sum = tmp.sum(0) / hits1_sum
dim2_sum = data.sum((0,1)) / hits2_sum
# to get smth that resembles the sum rather than the mean,
# one can here multiply element wise by the summed 2D area
if hits is not None:
dim0_sum[hits0_sum<=0] = 0
dim1_sum[hits1_sum<=0] = 0
dim2_sum[hits2_sum<=0] = 0
return dim0_sum, dim1_sum, dim2_sum
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment