mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-12-27 23:41:25 +01:00
3x3 reduction for general cluszter sizes
This commit is contained in:
@@ -106,7 +106,7 @@ void define_ClusterVector(py::module &m, const std::string &typestr) {
|
||||
|
||||
template <typename Type, uint8_t ClusterSizeX, uint8_t ClusterSizeY,
|
||||
typename CoordType = uint16_t>
|
||||
void define_reduction(py::module &m) {
|
||||
void define_2x2_reduction(py::module &m) {
|
||||
m.def("reduce_to_2x2",
|
||||
[](const ClusterVector<
|
||||
Cluster<Type, ClusterSizeX, ClusterSizeY, CoordType>> &cv) {
|
||||
@@ -115,11 +115,15 @@ void define_reduction(py::module &m) {
|
||||
});
|
||||
}
|
||||
|
||||
template <typename Type, uint8_t ClusterSizeX, uint8_t ClusterSizeY,
|
||||
typename CoordType = uint16_t>
|
||||
void define_3x3_reduction(py::module &m) {
|
||||
m.def("reduce_5x5_to_3x3",
|
||||
[](const ClusterVector<Cluster<int, 5, 5, uint16_t>> &cv) {
|
||||
return new ClusterVector<Cluster<int, 3, 3, uint16_t>>(
|
||||
reduce_5x5_to_3x3(cv));
|
||||
|
||||
m.def("reduce_to_3x3",
|
||||
[](const ClusterVector<
|
||||
Cluster<Type, ClusterSizeX, ClusterSizeY, CoordType>> &cv) {
|
||||
return new ClusterVector<Cluster<Type, 3, 3, CoordType>>(
|
||||
reduce_to_3x3(cv));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ double, 'f' for float)
|
||||
define_ClusterCollector<T, N, M, U>(m, "Cluster" #N "x" #M #TYPE_CODE); \
|
||||
define_Cluster<T, N, M, U>(m, #N "x" #M #TYPE_CODE); \
|
||||
register_calculate_eta<T, N, M, U>(m); \
|
||||
define_reduction<T, N, M, U>(m);
|
||||
define_2x2_reduction<T, N, M, U>(m);
|
||||
|
||||
PYBIND11_MODULE(_aare, m) {
|
||||
define_file_io_bindings(m);
|
||||
@@ -86,5 +86,16 @@ PYBIND11_MODULE(_aare, m) {
|
||||
DEFINE_CLUSTER_BINDINGS(double, 9, 9, uint16_t, d);
|
||||
DEFINE_CLUSTER_BINDINGS(float, 9, 9, uint16_t, f);
|
||||
|
||||
define_3x3_reduction(m);
|
||||
define_3x3_reduction<int, 3, 3>(m);
|
||||
define_3x3_reduction<double, 3, 3>(m);
|
||||
define_3x3_reduction<float, 3, 3>(m);
|
||||
define_3x3_reduction<int, 5, 5>(m);
|
||||
define_3x3_reduction<double, 5, 5>(m);
|
||||
define_3x3_reduction<float, 5, 5>(m);
|
||||
define_3x3_reduction<int, 7, 7>(m);
|
||||
define_3x3_reduction<double, 7, 7>(m);
|
||||
define_3x3_reduction<float, 7, 7>(m);
|
||||
define_3x3_reduction<int, 9, 9>(m);
|
||||
define_3x3_reduction<double, 9, 9>(m);
|
||||
define_3x3_reduction<float, 9, 9>(m);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user