Commit Graph

439 Commits

Author SHA1 Message Date
Khalil Daniel Ferjaoui a43814801a Add CUDA cluster finder kernel with host launcher
Implements a GPU version of the sequential ClusterFinder for
single-frame cluster reconstrcution.

Kernel (ClusterFinderCUDA.cuh):
- Shared memory tiling with generalized halo loading for arbitrary
  cluster sizes (3x3, 5x5, ...)
- Zero-initialization of shared memory to handle image boundary
  and partial edge-block cases.
- Pedestal subtraction during shared memory loading.
- Compile-time cluster geometry enabling full loop unrolling
  of the stencil reduction
- Atomic global counter for lock-free cluster output across blocks.
- RAII host wrapper; `ClusterFinderCUDA` struct.
2026-04-08 16:20:43 +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
mazzol_a 1f7a87cc30 updated Documentation and README (#274)
Build on RHEL8 / build (push) Successful in 2m38s
Build on RHEL9 / build (push) Successful in 2m58s
Run tests using data on local RHEL8 / build (push) Failing after 3m16s
2026-02-19 11:22:35 +01:00
mazzol_a 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
mazzol_a 7f64b9a616 Read Xilinx CTB files (#271)
Build on RHEL8 / build (push) Successful in 2m14s
Build on RHEL9 / build (push) Successful in 2m37s
Run tests using data on local RHEL8 / build (push) Successful in 3m16s
File content is the same as the normal ctb files so no changes needed
for reading.

- Accept DetectorType::Xilinx_ChipTestBoard in the CtbRawFile class
- Check if file is open in constructor
2026-01-27 09:49:17 +01:00
Erik Fröjdh 0bc0165c11 Merge branch 'main' into fix/xctb 2026-01-27 09:06:21 +01:00
mazzol_a f6e48182d1 Fix offset in ClusterFinding (#269)
Build on RHEL8 / build (push) Successful in 2m20s
Build on RHEL9 / build (push) Successful in 2m31s
Run tests using data on local RHEL8 / build (push) Successful in 3m17s
Directly casting the values in the cluster finder would truncate the
resulting ADU value and create an offset when summing the cluster.

1. do pedestal subtraction and then round
2. static cast to result type only after rounding
3. if constexpr to avoid unnecessary rounding
2026-01-26 14:10:25 +01:00
Erik Fröjdh 8ac633dc75 open xilinx ctb 2026-01-26 10:44:09 +01:00
froejdh_e 9d6798b9c5 removed comment 2026-01-21 09:36:17 +01:00
froejdh_e 0ce6128b4f added rounding in cluster finder 2026-01-21 09:35:06 +01:00
mazzol_a b77a576f72 Dev/automate tests using data (#267)
Build on RHEL8 / build (push) Successful in 2m13s
Build on RHEL9 / build (push) Successful in 2m37s
Run tests using data on local RHEL8 / build (push) Successful in 3m12s
- automatically run python tests 
- automatically run test using data files on local runner from gitea
- fixed some of the workflows

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-01-20 17:20:48 +01:00
mazzol_a cbefbc43e9 Fix/mt cluster finder dropping frames (#265)
Build on RHEL8 / build (push) Successful in 3m9s
Build on RHEL9 / build (push) Successful in 3m36s
Issue from Jonathan. 

- writing to output queue did not check if queue is full - such that
frames were dropped.

## Dataset to recreata issue: 

data overf 10G interface can be accessed on pc: pc-highz-02
raw frames:
/mnt/sls_det_storage_10G/highZ_data/JMulvey/Calibration_From_HZ02/2025Jan_m343/Zr15800eV/250129_CZTsolo_Xray_Tp_15C_tint_100_master_0.json

pedestal frames:
/mnt/sls_det_storage_10G/highZ_data/JMulvey/Calibration_From_HZ02/2025Jan_m343/Zr15800eV/250129_CZTsolo_Pedestal_Tp_15C_tint_100_master_0.json

---------

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-01-20 17:02:27 +01:00
siebsi 31f3a60cd3 added correct decoder for ADC-SAR-05-06-07-08 ASIC (#266)
Adding function to correctly decode the ADC-SAR-05-06-07-08 Chip. 

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2026-01-20 16:38:06 +01:00
mazzol_a f79ee55430 fixed parsing of dynamic range (#268)
Build on RHEL8 / build (push) Successful in 3m3s
Build on RHEL9 / build (push) Successful in 3m17s
1. fixed parsing of dynamic range (bug which I added during refactoring)
2. added tests for bitdepth!
3. updated path for test file
2026-01-19 16:54:19 +01:00
froejdh_e dceda21496 fixed parsing of dynamic range 2026-01-19 15:20:37 +01:00
Erik Fröjdh c0357e2020 Improvements to NDArray (#258)
Build on RHEL9 / build (push) Successful in 3m11s
Build on RHEL8 / build (push) Successful in 3m25s
- Removed redundant arr.value(ix,iy...) on NDArray use arr(ix,iy...)
- Removed Print/Print_some/Print_all form NDArray (operator << still
works)
- Added const* version of .data()
- Comment for documentation
- Some extra tests
2025-12-19 14:49:41 +01:00
mazzol_a dfb29b719f fixed out of bounds in test (#259)
- fixed test (out of bounds access)
2025-12-19 13:15:49 +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 fb95e518b4 Dev/interpolation documentation (#255)
Build on RHEL8 / build (push) Successful in 3m5s
Build on RHEL9 / build (push) Successful in 3m21s
- added transform_eta_values for easier debugging more control for the
user
- updated Documentation
2025-12-16 13:06:28 +01:00
Erik Fröjdh 80a2b02345 Dev/decode my302 (#254)
Build on RHEL8 / build (push) Failing after 0s
Build on RHEL9 / build (push) Failing after 0s
This PR adds support for decoding digital data from the my320 test chip.
- Added BitOffset (strong type)
- Expand 24 to 32 bit 
- Python bindings for decoding my302
- Improved docs
2025-12-09 18:27:02 +01:00
mazzol_a e795310b16 fixed tests (#252)
Build on RHEL8 / build (push) Successful in 3m11s
Build on RHEL9 / build (push) Successful in 3m46s
- fixed failed tests 
- removed import of pickle, scipy 
- still requires boost_histogram, pytest_check

Co-authored-by: Erik Fröjdh <erik.frojdh@psi.ch>
2025-11-28 11:28:13 +01:00
mazzol_a 1d8b68bf75 Run catch2 tests in CI (#253)
Build on RHEL9 / build (push) Failing after 0s
Build on RHEL8 / build (push) Successful in 3m28s
- Build and run tests in CI
- Added macOS builds (and tests)
- Renamed workflow to build_with_docs.yml
2025-11-27 08:58:24 +01:00
Erik Fröjdh cf53922bd3 restrict upload artifact 2025-11-26 20:21:57 +01:00
Erik Fröjdh 13cffb1ea8 WIP 2025-11-26 20:11:38 +01:00
Erik Fröjdh bea373a112 with file 2025-11-26 20:09:05 +01:00
Erik Fröjdh a66ce15a6c renamed workflow and added macos-latest 2025-11-26 20:07:32 +01:00
Erik Fröjdh 44fd015cfe added catch2 to dev env 2025-11-26 20:00:03 +01:00
Erik Fröjdh 6fe822d5dd WIP 2025-11-26 19:56:53 +01:00
Erik Fröjdh 8ed874a679 using tests 2025-11-26 19:54:43 +01:00
mazzol_a dd5ed138cf Dev/print filepath in error (#251)
Build on RHEL8 / build (push) Failing after 0s
Build on RHEL9 / build (push) Successful in 3m15s
2025-11-25 11:25:44 +01:00
mazzol_a 8201c5e999 Fix/mythenfilereading (#250)
Build on RHEL8 / build (push) Failing after 0s
Build on RHEL9 / build (push) Successful in 3m23s
Add counter mask as member of RawFile
BugFix: temporarily handle -1 for ROI in mythenfile
2025-11-24 12:29:08 +01:00
mazzol_a 03af5927ad Release 2025.11.21 (#249)
Build on RHEL9 / build (push) Successful in 3m19s
Build on RHEL8 / build (push) Successful in 3m27s
- Updated VERSION and script 
- Updated release notes
2025.11.21
2025-11-21 16:34:57 +01:00
Erik Fröjdh 452cfcb60f updated release notes 2025-11-21 16:17:04 +01:00
Erik Fröjdh e8402d9d36 updated version and version script 2025-11-21 16:14:05 +01:00
mazzol_a a9de336817 added license (#247)
- Added LICENSE file
- Added SPX identifier to source files
2025-11-21 15:11:30 +01:00
mazzol_a 6f7cb4ae30 Merge branch 'main' into dev/license 2025-11-21 14:52:54 +01:00
mazzol_a 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