From c6e8e5f6a1f6754bdbf6a8ff9bb90d4c36747368 Mon Sep 17 00:00:00 2001 From: froejdh_e Date: Tue, 22 Apr 2025 16:16:27 +0200 Subject: [PATCH] inverted gain map --- conda-recipe/meta.yaml | 2 +- include/aare/ClusterFile.hpp | 2 +- pyproject.toml | 2 +- src/ClusterFile.cpp | 6 ++++++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 560e831..0d3b532 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,6 +1,6 @@ package: name: aare - version: 2025.4.1 #TODO! how to not duplicate this? + version: 2025.4.22 #TODO! how to not duplicate this? diff --git a/include/aare/ClusterFile.hpp b/include/aare/ClusterFile.hpp index bea9f48..b47a1d5 100644 --- a/include/aare/ClusterFile.hpp +++ b/include/aare/ClusterFile.hpp @@ -124,7 +124,7 @@ class ClusterFile { /** * @brief Set the gain map to use when reading clusters. If set the gain map will be applied - * to the clusters that pass ROI and noise_map selection. + * to the clusters that pass ROI and noise_map selection. The gain map is expected to be in ADU/energy. */ void set_gain_map(const NDView gain_map); diff --git a/pyproject.toml b/pyproject.toml index 4a477a3..6451f39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build" [project] name = "aare" -version = "2025.4.2" +version = "2025.4.22" requires-python = ">=3.11" dependencies = [ "numpy", diff --git a/src/ClusterFile.cpp b/src/ClusterFile.cpp index f77ac92..d24e803 100644 --- a/src/ClusterFile.cpp +++ b/src/ClusterFile.cpp @@ -41,6 +41,12 @@ void ClusterFile::set_noise_map(const NDView noise_map){ void ClusterFile::set_gain_map(const NDView gain_map){ m_gain_map = NDArray(gain_map); + + // Gain map is passed as ADU/keV to avoid dividing in when applying the gain + // map we invert it here + for (auto &item : m_gain_map->view()) { + item = 1.0 / item; + } } ClusterFile::~ClusterFile() { close(); }