mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2026-02-19 16:48:42 +01:00
Dev/rosenblatttransform (#241)
- added rosenblatttransform - added 3x3 eta methods - interpolation can be used with various eta functions - added documentation for interpolation, eta calculation - exposed full eta struct in python - disable ClusterFinder for 2x2 clusters - factory function for ClusterVector --------- Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch> Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
This commit is contained in:
@@ -5,7 +5,7 @@ import time
|
||||
from pathlib import Path
|
||||
import pickle
|
||||
|
||||
from aare import ClusterFile, ClusterVector
|
||||
from aare import ClusterFile, ClusterVector, calculate_eta2
|
||||
from aare import _aare
|
||||
from conftest import test_data_path
|
||||
|
||||
@@ -44,6 +44,19 @@ def test_max_2x2_sum():
|
||||
assert max_2x2[0]["index"] == 2
|
||||
|
||||
|
||||
def test_eta2():
|
||||
"""calculate eta2"""
|
||||
cv = _aare.ClusterVector_Cluster3x3i()
|
||||
cv.push_back(_aare.Cluster3x3i(19, 22, np.ones(9, dtype=np.int32)))
|
||||
assert cv.size == 1
|
||||
eta2 = calculate_eta2(cv)
|
||||
assert eta2.size == 1
|
||||
assert eta2[0]["x"] == 0.5
|
||||
assert eta2[0]["y"] == 0.5
|
||||
assert eta2[0]["c"] == 0
|
||||
assert eta2[0]["sum"] == 4
|
||||
|
||||
|
||||
def test_make_a_hitmap_from_cluster_vector():
|
||||
cv = _aare.ClusterVector_Cluster3x3i()
|
||||
|
||||
@@ -74,11 +87,11 @@ def test_2x2_reduction():
|
||||
reduced_cv = np.array(_aare.reduce_to_2x2(cv), copy=False)
|
||||
|
||||
assert reduced_cv.size == 2
|
||||
assert reduced_cv[0]["x"] == 4
|
||||
assert reduced_cv[0]["x"] == 5
|
||||
assert reduced_cv[0]["y"] == 5
|
||||
assert (reduced_cv[0]["data"] == np.array([[2, 3], [2, 2]], dtype=np.int32)).all()
|
||||
assert reduced_cv[1]["x"] == 4
|
||||
assert reduced_cv[1]["y"] == 6
|
||||
assert reduced_cv[1]["x"] == 5
|
||||
assert reduced_cv[1]["y"] == 5
|
||||
assert (reduced_cv[1]["data"] == np.array([[2, 2], [2, 3]], dtype=np.int32)).all()
|
||||
|
||||
|
||||
@@ -93,6 +106,6 @@ def test_3x3_reduction():
|
||||
reduced_cv = np.array(_aare.reduce_to_3x3(cv), copy=False)
|
||||
|
||||
assert reduced_cv.size == 2
|
||||
assert reduced_cv[0]["x"] == 4
|
||||
assert reduced_cv[0]["x"] == 5
|
||||
assert reduced_cv[0]["y"] == 5
|
||||
assert (reduced_cv[0]["data"] == np.array([[1.0, 2.0, 1.0], [2.0, 2.0, 3.0], [1.0, 2.0, 1.0]], dtype=np.double)).all()
|
||||
assert (reduced_cv[0]["data"] == np.array([[2.0, 1.0, 1.0], [2.0, 3.0, 1.0], [2.0, 1.0, 1.0]], dtype=np.double)).all()
|
||||
Reference in New Issue
Block a user