Commit Graph
117 Commits
Author SHA1 Message Date
hinger_v 319a1a5b6a Merge branch 'main' into dev/strixels/remap_simple
Build on RHEL9 / build (push) Successful in 2m30s
Build on RHEL8 / build (push) Successful in 3m14s
Run tests using data on local RHEL8 / build (push) Failing after 4m17s
2026-09-07 18:06:16 +02:00
hinger_v d8d90b7ba5 Move StrixelPixelRemapping to dedicated directory 2026-09-07 17:40:50 +02:00
mazzol_aandErik Fröjdh 641ef047b5 Dev/filereading for disabled udp (#342)
Build on RHEL9 / build (push) Successful in 2m41s
Build on RHEL8 / build (push) Successful in 3m15s
Run tests using data on local RHEL8 / build (push) Failing after 4m13s
Build on local RHEL8 / build (push) Successful in 2m53s
- handles file reading of disabled udp ports 
- adds members disabled_udp_ports in master file as an optional 
- adds member diasbled_udp_port_types in master file as an optional
- Treats enabled udp ports as ROIs 
- merges/combines consecutive ROis into one 

### To discuss: 

- right now can only handle either ROI or disabled udp ports (disabled
udp ports has higher precedence)
- Should Frames in File be removed from Master File as value is nonsense
for disabled udp ports

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-09-03 14:14:57 +02:00
mazzol_a a3cce166f0 solved merge conflict
Build on RHEL9 / build (push) Successful in 2m51s
Build on RHEL8 / build (push) Successful in 3m19s
Run tests using data on local RHEL8 / build (push) Failing after 4m15s
2026-09-02 23:26:15 +02:00
Erik Fröjdh eddb919328 FastPedestal + optimizations in the cluster finder (#341)
Build on RHEL9 / build (push) Successful in 2m42s
Build on RHEL8 / build (push) Successful in 3m21s
Run tests using data on local RHEL8 / build (push) Failing after 3m56s
Build on local RHEL8 / build (push) Successful in 2m54s
Optimized pedestal tracking with FastPedestal and performance improvements to the cluster finder. 
- ~2x faster hitting 14k FPS on benchmark dataset on 16 core threadripper pro


**Changes**
- No bounds check on interior of frame. (only within half of a cluster)
(~15% improvement)
- Cache threshold (std*n_rms) Biggest improvement comes from not
computing std for each access
- Cache pedestal subtracted frame
- Switched to FastPedestal which assumes we reached steady state

**Things tried but rejected:**
- Always store cluster values, commit on val==max (~15% drop in frame
rate)

**Options**
- using 16 bit clusters and 16 bit pedestal. (slows down the single
threaded case but allow us to reach 12k with multi threading)

**Other notes on performance**
- Passing in memory frames from python and doing nothing: 0.8us/frame
- Passing + pedestal subtraction: 28us/frame
- Passing + pedestal + cluster finding (no store): 652us/frame
- Passing + pedestal + cluster finding: 886 us/frame
2026-09-01 18:41:12 +02:00
hinger_v 7886291895 Add remapping algorithm test (WIP)
Build on RHEL9 / build (push) Successful in 2m29s
Build on RHEL8 / build (push) Successful in 3m16s
Run tests using data on local RHEL8 / build (push) Successful in 3m55s
2026-08-27 21:14:27 +02:00
hinger_v 43f812f459 Add inclusiveROI tests 2026-08-25 16:00:17 +02:00
hinger_v 16bce7df47 Merge branch 'main' into dev/strixels/remap_simple
Build on RHEL9 / build (push) Successful in 2m28s
Build on RHEL8 / build (push) Successful in 3m10s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
2026-08-24 19:07:46 +02:00
hinger_v e6a42bbda7 Update renamed source in CMakeLists.txt
Build on RHEL9 / build (push) Successful in 2m36s
Build on RHEL8 / build (push) Successful in 3m3s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
2026-08-21 14:09:44 +02:00
mazzol_a 4970a92d50 updated clang-format commands (#352)
Build on RHEL9 / build (push) Successful in 2m28s
Build on RHEL8 / build (push) Successful in 3m21s
Run tests using data on local RHEL8 / build (push) Successful in 3m59s
Build on local RHEL8 / build (push) Successful in 2m43s
- updated custom targets clang-format, check-format, clang-tidy 
- find: paths must precede expression: `\' (double \\ not properly
escaped in bash)
2026-08-20 16:14:32 +02:00
mazzol_a e96778909e Merge branch 'main' into dev/strixels/remap_simple
Build on RHEL9 / build (push) Successful in 2m34s
Build on RHEL8 / build (push) Successful in 3m9s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s
2026-08-19 11:47:39 +02:00
Erik Fröjdh 4f6b69fba6 Removing deprecated use of lmfit (#344)
Build on RHEL9 / build (push) Successful in 2m44s
Build on RHEL8 / build (push) Successful in 3m9s
Run tests using data on local RHEL8 / build (push) Successful in 3m58s
Build on local RHEL8 / build (push) Successful in 2m44s
Removed the lmfit based fitting and the old API for calling functions

closes #296
2026-08-14 10:31:07 +02:00
Erik Fröjdh e26db97b5c Prototype multi threaded file reader (#343)
Build on RHEL9 / build (push) Successful in 2m40s
Build on RHEL8 / build (push) Successful in 3m4s
Run tests using data on local RHEL8 / build (push) Successful in 3m51s
Build on local RHEL8 / build (push) Successful in 2m46s
- Reading files from nfs shares tops out at ~1GB/s for single threaded
reads.
- MultiThreadedFileReader uses our File wrapper to read a generic file
in parallel
- Placed in aare::experimental to show that it's not production ready
2026-08-11 15:28:54 +02:00
hinger_v 98385902df Merge branch 'main' into dev/strixels/remap_simple 2026-07-16 11:05:30 +02:00
mazzol_a 533ecb8a4a removed patch for minuit2 CMakeLists.txt (#336)
Build on RHEL9 / build (push) Successful in 2m57s
Build on RHEL8 / build (push) Successful in 3m35s
Run tests using data on local RHEL8 / build (push) Successful in 3m57s
Build on local RHEL8 / build (push) Successful in 2m46s
- patch no longer needed for minuit2 as CMakeLists.txt has been updated:
https://github.com/GooFit/Minuit2/commit/46716e516e34a95e1f4effa95705a9e0c3425839
2026-07-16 10:39:06 +02:00
4aadb6f7f0 refactor: hide Minuit2 from aare's public API (#331)
Build on RHEL9 / build (push) Successful in 3m13s
Build on RHEL8 / build (push) Successful in 3m52s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s
Build on local RHEL8 / build (push) Successful in 2m45s
- Move Chi2.hpp from include/aare/ to src/ (private)
- Pimpl on FitModel<Model>: MnUserParameters/MnStrategy behind opaque
src/FitModelImpl.hpp, no Minuit2 includes in public headers
- Move fit_pixel/fit_3d bodies to Fit.cpp with explicit instantiations
for all 8 models; drop FCN template param from public API
- CMake: aare::Minuit2 wrapped in $<BUILD_INTERFACE:...> (hidden from
exported targets, same pattern as lmfit), MINUIT2_INSTALL OFF, Chi2.hpp
removed from PUBLICHEADERS
- Update python bindings and benchmark callsites accordingly

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
Co-authored-by: Alice <alice.mazzoleni@psi.ch>
2026-07-02 16:04:22 +02:00
mazzol_a ae8744358a cmake format 2026-06-15 11:36:03 +02:00
Erik Fröjdh 2041c7310a Fixed usage of fmt::format and fmt::print for C++20 (#323)
Build on RHEL8 / build (push) Successful in 3m5s
Build on RHEL9 / build (push) Successful in 3m4s
Run tests using data on local RHEL8 / build (push) Successful in 3m57s
Build on local RHEL8 / build (push) Successful in 2m41s
With C++20 `fmt::print(s)` expects a compile time format string and
otherwise fails complaining about consteval. To get runtime formatting
use `fmt::print(fmt::runtime(s))`
2026-06-11 08:01:03 +02:00
hinger_v e70392aafe Merge branch 'main' into dev/strixels/remap_simple
Build on RHEL9 / build (push) Successful in 2m51s
Build on RHEL8 / build (push) Successful in 3m13s
Run tests using data on local RHEL8 / build (push) Successful in 4m2s
2026-06-10 13:33:46 +02:00
Erik Fröjdh b78ea64ea7 Conditional use of Minuit2 (#320)
Build on RHEL9 / build (push) Successful in 2m31s
Build on RHEL8 / build (push) Successful in 3m9s
Run tests using data on local RHEL8 / build (push) Successful in 3m56s
Build on local RHEL8 / build (push) Successful in 2m44s
If AARE_FETCH_MINUIT is set to OFF we first look for a standalone
Minuit2 and if that is not found we try to find Minuit2 as a part of
ROOT.

In both cases we make an alias to allow for simpler use of the target
later.

It still doesn't solve the issue that we install Minuit to when we fetch
it but that can be addressed in a separate PR.

closes #316
2026-06-10 08:30:03 +02:00
Erik FröjdhandLars Erik Fröjd f670ba77a2 PixelHistogram (#317)
Build on RHEL9 / build (push) Successful in 2m31s
Build on RHEL8 / build (push) Successful in 3m6s
Run tests using data on local RHEL8 / build (push) Successful in 3m55s
Build on local RHEL8 / build (push) Successful in 2m42s
Multi threaded filling of per pixel histograms for example for detector calibration

1. PixelHistogram - Generic variant expects already pedestal subtracted
data
2. PedestalTrackingHistogram - Terrible name, useful class. Keeps it's
own pedestal and does conversion and pedestal tracking in the worker
threads.

---------

Co-authored-by: Lars Erik Fröjd <froejdh_e@pc-jungfrau-02.psi.ch>
2026-06-09 09:08:48 +02:00
hinger_v 47ebbd2267 Merge branch 'main' into dev/strixels/remap_simple 2026-05-22 18:12:05 +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
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
Khalil FerjaouiandErik Fröjdh 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
hinger_v 705b525b6a Delete old Remap
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 3m13s
2026-03-10 18:02:42 +01:00
hinger_v 59b423be07 Include in CMake
Build on RHEL8 / build (push) Successful in 2m20s
Build on RHEL9 / build (push) Successful in 2m36s
Run tests using data on local RHEL8 / build (push) Successful in 3m15s
2026-03-09 20:37:28 +01:00
hinger_v bb237ff012 Add first remapping draft 2026-02-24 19:33:28 +01:00
218f31ce60 Dev/multiple rois in aare (#263)
Build on RHEL8 / build (push) Successful in 2m23s
Build on RHEL9 / build (push) Successful in 2m32s
Run tests using data on local RHEL8 / build (push) Failing after 3m14s
Reading multiple ROI's for aare 

- read_frame, read_n etc throws for multiple ROIs
- new functions read_ROIs, read_n_ROIs 
-  read_roi_into (used for python bindings - to not copy) 

all these functions use get_frame or get_frame_into where one passes the
roi_index
## Refactoring:
- each roi keeps track of its subfiles that one has to open e.g.
subfiles can be opened several times
- refactored class DetectorGeometry - keep track of the updated module
geometries in new class ROIGeometry.
- ModuleGeometry updates based on ROI

## ROIGeometry: 
- stores number of modules overlapping with ROI and its indices
- size of ROI 

Note: only tested size of the resulting frames not the actual values

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
2026-02-18 10:57:56 +01:00
froejdh_e 0ce6128b4f added rounding in cluster finder 2026-01-21 09:35:06 +01:00
Erik Fröjdh 7f3123d68f Added parsing of exptime and period from master files (#256)
Build on RHEL9 / build (push) Successful in 3m26s
Build on RHEL8 / build (push) Successful in 3m33s
- New aare:to_string/string_to similar to what we have in
slsDetectorPackage
- Added members period and exptime to RawMasterFile
- Parsing exposure time and period for json and raw master file formats
- Parsing of RawMasterFile from string stream to enable test without
files

Comments:

- to_string is at the moment not a public header. Can make it later if
needed. This gives us full freedom with the API
- FileConfig should probably be deprecated need to look into it.
Meanwhile removed python bindings and string conv
2025-12-18 17:04:12 +01:00
mazzol_a 6f7cb4ae30 Merge branch 'main' into dev/license 2025-11-21 14:52:54 +01:00
267ca87ab0 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>
2025-11-21 14:48:46 +01:00
Erik Fröjdh 53aed8d8c6 added license 2025-11-20 09:01:28 +01:00
mazzol_a 0b74bc25d5 enabled position independant code only for aare_core 2025-09-30 16:29:42 +02:00
mazzol_a 4c1e276e2c compile with POSITION_INDEPENDANT_CODE=On 2025-09-05 14:02:26 +02:00
mazzol_a 1347158235 templated calculate_pedestal with boolean template argument only_gain0, added drop_dimension to NDArray and reference pointer to data 2025-07-24 15:40:05 +02:00
froejdh_e 9a7713e98a added g0 calibration, pedestal and pixel counting 2025-07-22 16:42:09 +02:00
Erik Fröjdh e95326faa1 Fix/remove cpp (#213)
Build on RHEL8 / build (push) Failing after 1m52s
Build on RHEL9 / build (push) Successful in 3m11s
- Removed unused ClusterFile.cpp (code from before it was templated)
- Updated the list of .cpp files in CMakeLists.txt to match alphabetic
listing in the browser
2025-07-16 16:43:08 +02:00
mazzol_a 8e7c9eadff fixed cmake merge 2025-06-24 13:49:05 +02:00
mazzol_a d35b7762b4 Merge branch 'main' into dev/fix/rawfilereader_with_roi 2025-06-24 13:43:26 +02:00
mazzol_a c9fe16b4c2 use target_compile_definitions (#203)
Build on RHEL9 / build (push) Successful in 2m54s
Build on RHEL8 / build (push) Successful in 2m55s
use target_compile_definition instead of add_compile_definition to use
macros across projects
2025-06-23 09:06:25 +02:00
mazzol_a be67bbab6b extended DetectorGeometry class with find_geometry, update_geometry (refactoring) 2025-06-13 16:16:23 +02:00
mazzol_a 75f63607fc friend_test macro 2025-06-12 17:46:10 +02:00
94ac58b09e For 2025.5.22 release (#181)
Build on RHEL9 / build (push) Successful in 2m22s
Build on RHEL8 / build (push) Successful in 2m29s
Co-authored-by: Patrick <patrick.sieberer@psi.ch>
Co-authored-by: JulianHeymes <julian.heymes@psi.ch>
Co-authored-by: Dhanya Thattil <dhanya.thattil@psi.ch>
Co-authored-by: Xiangyu Xie <45243914+xiangyuxie@users.noreply.github.com>
Co-authored-by: xiangyu.xie <xiangyu.xie@psi.ch>
Co-authored-by: AliceMazzoleni99 <alice.mazzoleni@psi.ch>
Co-authored-by: Mazzoleni Alice Francesca <mazzol_a@pc17378.psi.ch>
Co-authored-by: siebsi <sieb.patr@gmail.com>
2025-05-22 11:40:39 +02:00
froejdh_e 9ecf4f4b44 merge
Build on RHEL9 / build (push) Successful in 2m22s
Build on RHEL8 / build (push) Successful in 2m30s
2025-05-22 11:23:57 +02:00
Erik Fröjdh 9e1b8731b0 RawSubFile support multi file access (#173)
This PR is a fix/improvement to a problem that Jonathan had. (#156) The
original implementation opened all subfiles at once witch works for
normal sized datasets but fails at a certain point (thousands of files).

- This solution uses RawSubFile to manage the different file indicies
and only opens the file we need
- Added logger.h from slsDetectorPackage for debug printing (in
production no messages should be visible)
2025-05-22 11:00:03 +02:00
Erik Fröjdh 81588fba3b linking to threads and removed extra ; (#176)
Build on RHEL9 / build (push) Successful in 2m14s
Build on RHEL8 / build (push) Successful in 2m32s
- Fixing broken build of tests on RH8 by linking pthreads
- Removed extra ; causing warnings with -Wpedantic
2025-05-06 17:18:54 +02:00
276283ff14 automated versioning (#175)
Build on RHEL9 / build (push) Successful in 2m20s
Build on RHEL8 / build (push) Failing after 2m24s
Co-authored-by: mazzol_a <mazzol_a@pc17378.psi.ch>
Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2025-05-06 14:48:54 +02:00