Commit Graph

474 Commits

Author SHA1 Message Date
Erik Fröjdh 0130567108 Merge branch 'dev/pixel-hist' of github.com:slsdetectorgroup/aare into dev/pixel-hist
Build on RHEL9 / build (push) Successful in 2m52s
Build on RHEL8 / build (push) Successful in 3m31s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
2026-06-03 14:56:12 +02:00
Erik Fröjdh 0ef6689800 comparing with correct type 2026-06-03 14:56:04 +02:00
Erik Fröjdh 7904f34312 Merge branch 'main' into dev/pixel-hist 2026-06-03 14:30:55 +02:00
Erik Fröjdh 8f317af8a4 removing pending
Build on RHEL9 / build (push) Successful in 2m35s
Build on RHEL8 / build (push) Successful in 3m6s
Run tests using data on local RHEL8 / build (push) Successful in 4m0s
2026-06-03 13:56:38 +02:00
Erik Fröjdh f9f78765f5 updated pixel histogram to use fill_unchecked since we know it is within range
Build on RHEL9 / build (push) Successful in 2m31s
Build on RHEL8 / build (push) Successful in 3m5s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s
2026-06-03 13:02:32 +02:00
Erik Fröjdh 8354d3c428 added checked fill
Build on RHEL9 / build (push) Successful in 2m31s
Build on RHEL8 / build (push) Successful in 3m1s
Run tests using data on local RHEL8 / build (push) Successful in 3m49s
2026-06-03 12:34:53 +02:00
maliakal_d 8e69b498e5 Fix version (#319)
Build on RHEL9 / build (push) Successful in 2m34s
Build on RHEL8 / build (push) Successful in 3m2s
Run tests using data on local RHEL8 / build (push) Successful in 3m45s
Build on local RHEL8 / build (push) Successful in 2m38s
- install VERSION file and copy to build
- fix lookup for VERSION file in case of error
- update documentation for installing python bindings
2026-06-03 12:10:58 +02:00
Erik Fröjdh 19472b6a6f test for filling with NDArray
Build on RHEL9 / build (push) Successful in 2m35s
Build on RHEL8 / build (push) Successful in 3m4s
Run tests using data on local RHEL8 / build (push) Successful in 4m2s
2026-06-03 12:09:48 +02:00
Erik Fröjdh 06b04fa143 moved hist location 2026-06-03 12:03:33 +02:00
Erik Fröjdh 6fd26d7252 fix format
Build on RHEL9 / build (push) Successful in 2m30s
Build on RHEL8 / build (push) Successful in 3m3s
Run tests using data on local RHEL8 / build (push) Successful in 4m2s
2026-06-02 16:08:15 +02:00
Erik Frojdh c20a94015c removing warnings
Build on RHEL9 / build (push) Successful in 2m33s
Build on RHEL8 / build (push) Successful in 3m24s
Run tests using data on local RHEL8 / build (push) Successful in 3m55s
2026-06-02 15:47:42 +02:00
Erik Frojdh fc76f36413 added timer and file processing 2026-06-02 15:24:01 +02:00
Lars Erik Fröjd c10bcb8075 removed sync fill
Build on RHEL9 / build (push) Successful in 2m30s
Build on RHEL8 / build (push) Successful in 3m5s
Run tests using data on local RHEL8 / build (push) Successful in 3m55s
2026-06-01 14:59:57 +02:00
Lars Erik Fröjd 1f78c9f7d1 removed use of boost histogram
Build on RHEL9 / build (push) Successful in 2m35s
Build on RHEL8 / build (push) Successful in 3m6s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
2026-05-27 17:12:10 +02:00
Erik Fröjdh e90977cfc8 Merge branch 'main' into dev/pixel-hist
Build on RHEL9 / build (push) Successful in 2m41s
Build on RHEL8 / build (push) Successful in 3m13s
Run tests using data on local RHEL8 / build (push) Successful in 4m9s
2026-05-27 16:29:47 +02:00
Lars Erik Fröjd dbe68fd963 cleanup and updated dev env
Build on RHEL9 / build (push) Successful in 2m32s
Build on RHEL8 / build (push) Successful in 3m28s
Run tests using data on local RHEL8 / build (push) Successful in 4m5s
2026-05-27 16:05:00 +02:00
Lars Erik Fröjd 7b55a94dd9 special version with pedestal tracking
Build on RHEL9 / build (push) Successful in 2m33s
Build on RHEL8 / build (push) Successful in 3m19s
Run tests using data on local RHEL8 / build (push) Successful in 4m8s
2026-05-27 15:18:13 +02:00
lunin_l 282debcc94 Add __version__ variable for python library (#308)
Build on RHEL9 / build (push) Successful in 2m23s
Build on RHEL8 / build (push) Successful in 3m5s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s
Build on local RHEL8 / build (push) Successful in 2m38s
[PEP 396](https://peps.python.org/pep-0396/)

---------

Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
2026-05-27 14:38:35 +02:00
Lars Erik Fröjd e7bc1253ea vendor boost histogram
Build on RHEL9 / build (push) Successful in 2m37s
Build on RHEL8 / build (push) Successful in 3m18s
Run tests using data on local RHEL8 / build (push) Successful in 4m3s
2026-05-26 21:41:09 +02:00
Erik Frojdh e71bbb8288 fill_async
Build on RHEL8 / build (push) Failing after 1m17s
Build on RHEL9 / build (push) Failing after 1m22s
Run tests using data on local RHEL8 / build (push) Failing after 1m54s
2026-05-24 10:02:49 +02:00
Erik Frojdh ee6b6dc990 row bug and memcpy
Build on RHEL8 / build (push) Failing after 1m20s
Build on RHEL9 / build (push) Failing after 1m24s
Run tests using data on local RHEL8 / build (push) Failing after 1m55s
2026-05-24 07:47:05 +02:00
Erik Frojdh 61b765c4b8 fixed conversion, checking over and underflow
Build on RHEL8 / build (push) Failing after 1m16s
Build on RHEL9 / build (push) Failing after 1m22s
Run tests using data on local RHEL8 / build (push) Failing after 1m53s
2026-05-23 16:28:32 +02:00
Erik Frojdh 5ceb63337d MT implementation
Build on RHEL8 / build (push) Failing after 1m19s
Build on RHEL9 / build (push) Failing after 1m22s
Run tests using data on local RHEL8 / build (push) Failing after 2m8s
2026-05-23 10:07:25 +02:00
Erik Frojdh 4084d18b16 reduced storage size
Run tests using data on local RHEL8 / build (push) Failing after 2m1s
Build on RHEL8 / build (push) Failing after 1m17s
Build on RHEL9 / build (push) Failing after 1m38s
2026-05-22 17:01:53 +02:00
Erik Frojdh 913dd0da54 first implementation 2026-05-22 16:17:46 +02:00
mazzol_a 41c47cb54b dont reinstall fmt (#314)
Build on RHEL9 / build (push) Successful in 2m24s
Build on RHEL8 / build (push) Successful in 2m58s
Run tests using data on local RHEL8 / build (push) Successful in 3m43s
Build on local RHEL8 / build (push) Successful in 2m37s
- dont reinstall fmt/nlohmann
2026-05-22 15:44:35 +02:00
mazzol_a 502c37a00a number of clusters is always uint32_t (#313)
Build on RHEL9 / build (push) Successful in 2m45s
Build on RHEL8 / build (push) Successful in 3m21s
Run tests using data on local RHEL8 / build (push) Successful in 3m55s
Build on local RHEL8 / build (push) Successful in 2m37s
2026-05-22 09:22:29 +02:00
Khalil Ferjaoui 52b5cf6b9f Feature/gauss+plateau (#312)
Build on RHEL9 / build (push) Successful in 2m27s
Build on RHEL8 / build (push) Successful in 3m1s
Run tests using data on local RHEL8 / build (push) Successful in 3m54s
Build on local RHEL8 / build (push) Successful in 2m36s
Adds three Minuit2-backed spectrum models to the Python-exposed fitting
API:

- `GaussianErfcPlateau`
- `GaussianChargeSharing`
- `GaussianChargeSharingKb`

Closes #297
2026-05-21 08:33:02 +02:00
Xiangyu Xie de74f12640 Dev var cluster finder (#310)
Build on RHEL9 / build (push) Successful in 2m30s
Build on RHEL8 / build (push) Successful in 3m36s
Run tests using data on local RHEL8 / build (push) Successful in 3m51s
Build on local RHEL8 / build (push) Successful in 2m36s
Add options for var cluster_finder_X:
1. number of neighbors (for better segmentation of clusters)
2. option to empty the surrounding pixels

---------

Co-authored-by: xiangyu.xie <xiangyu.xie@psi.ch>
2026-05-18 16:16:09 +02:00
lunin_l 4e3b70140a CI/CD: add conda build installation (#309)
Build on RHEL8 / build (push) Successful in 2m59s
Build on RHEL9 / build (push) Successful in 2m56s
Run tests using data on local RHEL8 / build (push) Successful in 3m41s
Build on local RHEL8 / build (push) Successful in 2m37s
Build conda pkgs workflows
[failing](https://github.com/slsdetectorgroup/aare/actions/runs/25800676450/job/75789547058#step:5:10)
due to the missing `conda build` command.

This PR fixes the issue.
2026-05-13 16:32:02 +02:00
mazzol_a 2736d975c5 Dev/enable custom etas (#305)
Build on RHEL9 / build (push) Successful in 2m29s
Build on RHEL8 / build (push) Successful in 2m52s
Run tests using data on local RHEL8 / build (push) Successful in 3m49s
Build on local RHEL8 / build (push) Successful in 2m32s
- Allowing the users more flexibility to play around with custom eta
functions without touching the c++ code

- passing vector of eta values to ``transform_eta_values`` 

```
from aare import Interpolator, ClusterVector, Etai, Cluster
import numpy as np 

def custom_eta(cluster_pixel_coordinate_x, cluster_pixel_coordinate_y, cluster_data):
    # dummy custom eta function that just returns the sum of the cluster data
    eta = Etai()
    eta.x = 0.1 # dummy x value
    eta.y = 0.1 # dummy y value
    eta.sum = np.sum(cluster_data) # sum of the cluster data as the "energy
    return eta

# Create a dummy eta distribution and bins
eta_distribution = np.zeros((10, 10, 1)) # dummy eta distribution
etax_bins = np.linspace(0, 1.0, 11)
etay_bins = np.linspace(0, 1.0, 11)
e_bins = np.array([0., 10.]) # dummy energy bins

# Create the interpolator
interpolator = Interpolator(eta_distribution, etax_bins, etay_bins, e_bins)

# Create a dummy cluster vector
cluster_vector = ClusterVector()
cluster_vector.push_back(Cluster(10, 5, np.ones(shape=9, dtype = np.int32)))
cluster_vector.push_back(Cluster(20, 10, np.ones(shape=9, dtype = np.int32)))

# Create dummy etas for the clusters
cluster_array = np.array(cluster_vector)
etas = np.array([custom_eta(cluster["x"], cluster["y"], cluster["data"]) for cluster in cluster_array])

# transform eta values to uniform coordinates 
uniform_coordinates = interpolator.transform_eta_values(etas)

# Interpolate to get the photon coordinates e.g. apply interpolation logic 
photon_coordinates_x = cluster_array["x"] + uniform_coordinates["x"] # add to pixel coordinate 
photon_coordinates_y = cluster_array["y"] + uniform_coordinates["y"] # add to pixel coordinate 

```
advantage: full control over interpolation logic, 
downside: inefficient quite some loops in python
- passing pre computed eta values to interpolate function 
```
Interpolator.interpolate(cluster_vector, etas) 
```
downside: less flexibility in interpolation logic. 
downside: People might misuse it instead of using interpolate directly
with a pre compiled eta function implemented in c++
2026-04-24 14:01:13 +02:00
mazzol_a 6ff664f812 allow passing mask to clustervector (#304)
Build on RHEL9 / build (push) Successful in 2m24s
Build on RHEL8 / build (push) Successful in 2m54s
Run tests using data on local RHEL8 / build (push) Successful in 3m52s
Build on local RHEL8 / build (push) Successful in 2m34s
- passing mask to ClusterVector 
- creates a copy of the ClusterVector

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-04-17 17:13:02 +02:00
Erik Fröjdh 4875c31513 bumped pybind version, cmake fixes (#300)
Build on RHEL9 / build (push) Successful in 2m25s
Build on RHEL8 / build (push) Successful in 2m57s
Run tests using data on local RHEL8 / build (push) Successful in 3m37s
Build on local RHEL8 / build (push) Successful in 2m33s
- Bumped pybind11 version
- Bumped libfmt version
- Patch  Minuit to avoid messing around with CMake policy
2026-04-17 15:50:49 +02:00
lunin_l 8f8173feb6 CI/CD: Integrate pre-commit hooks and GitHub Actions workflow (#303)
Build on RHEL8 / build (push) Successful in 2m48s
Build on RHEL9 / build (push) Successful in 3m8s
Run tests using data on local RHEL8 / build (push) Successful in 3m34s
Build on local RHEL8 / build (push) Successful in 2m24s
To improve codebase quality and reduce human error, this PR introduces
the pre-commit framework. This ensures that all code adheres to project
standards before it is even committed, maintaining a consistent style
and catching common mistakes early.

Key Changes:

- Code Formatting: Automated C++ formatting using clang-format (based on
the project's .clang-format file).
- Syntax Validation: Basic checks for file integrity and syntax.
- Spell Check: Automated scanning for typos in source code and comments.
- CMake Formatting: Standardization of CMakeLists.txt and .cmake
configuration files.
- GitHub Workflow: Added a CI action that validates every Pull Request
against the pre-commit configuration to ensure compliance.

The configuration includes a [ci] block to handle automated fixes within
the PR. Currently, this is disabled. If we want the CI to automatically
commit formatting fixes back to the PR branch, this can be toggled to
true in .pre-commit-config.yaml.

```yaml
ci:
  autofix_commit_msg: [pre-commit] auto fixes from pre-commit hooks
  autofix_prs: false
  autoupdate_schedule: monthly
```

The last large commit with the fit functions, for example, was not
formatted according to the clang-format rules. This PR would allow to
avoid similar mistakes in the future.

Python fomat with `ruff` for tests and sanitiser for `.ipynb` notebooks
can be added as well.
2026-04-14 11:52:23 +02:00
mazzol_a 85098d2008 fixed fmt error (#302)
Build on RHEL8 / build (push) Successful in 2m43s
Build on RHEL9 / build (push) Successful in 3m0s
Run tests using data on local RHEL8 / build (push) Successful in 3m43s
Build on local RHEL8 / build (push) Successful in 2m22s
2026-04-10 17:46:01 +02:00
Erik Fröjdh a25f5d2344 Access to parameter names and fast erf approx (#298)
Build on RHEL8 / build (push) Successful in 2m44s
Build on RHEL9 / build (push) Successful in 3m3s
Run tests using data on local RHEL8 / build (push) Successful in 3m39s
Build on local RHEL8 / build (push) Successful in 2m23s
- Set parameter starting values, limits or fix through name as well as
index
- Updated parameter names for the scurve
- Fast approximation to erf function (~10% speedup of fitting)

---------

Co-authored-by: Khalil Ferjaoui <khalilferjaoui@yahoo.fr>
2026-04-02 13:33:37 +02:00
Khalil Ferjaoui a6afa45b3b Feature/minuit2 wrapper (#279)
Build on RHEL8 / build (push) Successful in 3m6s
Build on RHEL9 / build (push) Successful in 3m20s
Run tests using data on local RHEL8 / build (push) Successful in 3m36s
Build on local RHEL8 / build (push) Successful in 2m21s
## Unified Minuit2 fitting framework with FitModel API

### Models (`Models.hpp`)
Consolidate all model structs (Gaussian, RisingScurve, FallingScurve)
into a
single header. Each model provides: `eval`, `eval_and_grad`, `is_valid`,
`estimate_par`, `compute_steps`, and `param_info` metadata. No Minuit2
dependency.

### Chi2 functors (`Chi2.hpp`)
Generic `Chi2Model1DGrad` (analytic gradient) templated on the model
struct.
Replaces the separate Chi2Gaussian, Chi2GaussianGradient,
Chi2Scurves, and Chi2ScurvesGradient headers.

### FitModel (`FitModel.hpp`)
Configuration object wrapping `MnUserParameters`, strategy, tolerance,
and
user-override tracking. User constraints (fixed parameters, start
values, limits)
always take precedence over automatic data-driven estimates.

### Fit functions (`Fit.hpp`)
- `fit_pixel<Model, FCN>(model, x, y, y_err)` -> single-pixel,
self-contained
- `fit_pixel<Model, FCN>(model, upar_local, x, y, y_err)` -> pre-cloned
upar for hot loops
- `fit_3d<Model, FCN>(model, x, y, y_err, ..., n_threads)` ->
row-parallel over pixel grid

### Python bindings
- `Pol1`, `Pol2`, `Gaussian`, `RisingScurve`, `FallingScurve` model
classes with
  `FixParameter`, `SetParLimits`, `SetParameter`, and properties for
  `max_calls`, `tolerance`, `compute_errors`
- Single `fit(model, x, y, y_err, n_threads)` dispatch replacing the old
`fit_gaus_minuit`, `fit_gaus_minuit_grad`, `fit_scurve_minuit_grad`,
etc.

### Benchmarks
- Updated `fit_benchmark.cpp` (Google Benchmark) to use the new FitModel
API
- Jupyter notebooks for 1D and 3D S-curve fitting (lmfit vs Minuit2
analytic)
- ~1.8x speedup over lmfit, near-linear thread scaling up to physical
core count

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-03-30 09:12:23 +02:00
mazzol_a 05e6e69c66 added getter and setter for nSigma (#293)
Build on RHEL9 / build (push) Successful in 2m46s
Build on RHEL8 / build (push) Successful in 2m51s
Run tests using data on local RHEL8 / build (push) Successful in 3m15s
Build on local RHEL8 / build (push) Successful in 1m57s
2026-03-26 14:52:32 +01:00
Erik Fröjdh 7e6c6081dc Updated build pipeline (#290)
Build on RHEL8 / build (push) Successful in 2m19s
Build on RHEL9 / build (push) Successful in 2m34s
Run tests using data on local RHEL8 / build (push) Successful in 3m3s
Build on local RHEL8 / build (push) Successful in 1m57s
- Fixed failing conda builds (numpy >=2.1 and added pytest-check)
- added cibuildwheel settings for osx
- Bumped cibuildwheel to 3.4.0 in pipeline
- build also for macos-latest
- fixed conda workflow which was only on developer branch (now main and
pr to main)
2026-03-24 15:09:57 +01:00
Erik Fröjdh 81acab6091 bumped version number edited RELEASE.md (#288)
Build on RHEL8 / build (push) Successful in 2m26s
Build on RHEL9 / build (push) Successful in 2m53s
Run tests using data on local RHEL8 / build (push) Successful in 3m17s
Build on local RHEL8 / build (push) Successful in 1m58s
Co-authored-by: Alice <alice.mazzoleni@psi.ch>
2026.3.17
2026-03-17 17:22:36 +01:00
mazzol_a d9ff73e8b2 added matterhorn transformation tests (#284)
- added matterhorn transformation tests

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-03-17 16:54:06 +01:00
Erik Fröjdh fca17e65d2 Added conda/pypi buyilds for python 3.14 removed 3.11 (#287)
Build on RHEL8 / build (push) Successful in 2m24s
Build on RHEL9 / build (push) Successful in 2m41s
Run tests using data on local RHEL8 / build (push) Successful in 3m16s
Build on local RHEL8 / build (push) Successful in 1m55s
In line with supporting the 3 latest versions of Python
2026-03-17 10:49:52 +01:00
mazzol_a eee34ba211 fixed matterhorn pixelmap (#283)
Build on RHEL8 / build (push) Successful in 2m19s
Build on RHEL9 / build (push) Successful in 2m44s
Run tests using data on local RHEL8 / build (push) Successful in 3m14s
Build on local RHEL8 / build (push) Successful in 1m57s
Fixed Matterhorn PixelMap 

Example Image can be found on
pc-moench-03/tmp/alicetestdata3_master_3.json
2026-03-09 14:38:26 +01:00
hinger_v c665c0e6c6 Fix #281 std::bad_optional_access in RawMasterFile::roi() (#282)
Build on RHEL8 / build (push) Successful in 2m22s
Build on RHEL9 / build (push) Successful in 2m34s
Run tests using data on local RHEL8 / build (push) Successful in 3m7s
Build on local RHEL8 / build (push) Successful in 2m7s
Fixes #281
2026-02-27 12:17:17 +01:00
mazzol_a bfbb4eab05 Dev/remove rh9 local workflow (#280)
Build on RHEL8 / build (push) Successful in 2m31s
Build on RHEL9 / build (push) Successful in 2m39s
Run tests using data on local RHEL8 / build (push) Successful in 3m10s
Build on local RHEL8 / build (push) Successful in 1m57s
2026-02-26 16:56:58 +01:00
mazzol_a 3ef54cb4b2 fixed workflow (#277)
Build on local RHEL9 / build (push) Successful in 1m11s
Build on RHEL8 / build (push) Successful in 2m29s
Build on RHEL9 / build (push) Successful in 2m33s
Run tests using data on local RHEL8 / build (push) Successful in 3m7s
Build on local RHEL8 / build (push) Successful in 1m56s
2026-02-26 14:47:10 +01:00
mazzol_a 2a3c121574 Fix/test (#278)
Build on RHEL8 / build (push) Successful in 2m29s
Build on RHEL9 / build (push) Successful in 2m40s
Build on local RHEL9 / build (push) Successful in 1m9s
Run tests using data on local RHEL8 / build (push) Has been cancelled
Build on local RHEL8 / build (push) Has been cancelled
2026-02-26 14:23:45 +01:00
mazzol_a 31dd0ca8b7 Dev/automatic nfs server upload (#276)
Build on local RHEL9 / build (push) Successful in 1m10s
Build on RHEL8 / build (push) Successful in 2m17s
Build on RHEL9 / build (push) Successful in 2m37s
Run tests using data on local RHEL8 / build (push) Failing after 3m11s
Build on local RHEL8 / build (push) Successful in 1m55s
- automatically builds aare and uploads to mpc2935 (from there its
eventually uploaded to nfs every day)
2026-02-25 16:40:03 +01:00
mazzol_a 2139e5843c Dev/stuff from pyctbgui (#273)
Build on RHEL8 / build (push) Successful in 2m23s
Build on RHEL9 / build (push) Successful in 2m35s
Run tests using data on local RHEL8 / build (push) Failing after 3m19s
Matterhorn10 Transform 
some other Transformations from pyctbGUI 
added method get_reading_mode for easier error handling in decoders 


## TODO: 

- proper error handling for all other decoders 
- proper documentation for all other decoders 
- refactoring all other decoders to store hard coded values in a Struct
ChipSpecification
2026-02-19 16:12:44 +01:00
mazzol_a 5dbc746462 clang-format
Build on RHEL8 / build (push) Successful in 2m30s
Build on RHEL9 / build (push) Successful in 2m34s
Run tests using data on local RHEL8 / build (push) Failing after 3m10s
2026-02-19 15:35:19 +01:00