Skip to content

Refactor event building to use DetectorId instead of ChannelId#31

Merged
oschulz merged 3 commits intomainfrom
data-structure-update
Feb 2, 2026
Merged

Refactor event building to use DetectorId instead of ChannelId#31
oschulz merged 3 commits intomainfrom
data-structure-update

Conversation

@jonasschlegel
Copy link
Contributor

Aligns event building with new DSP logic where data is keyed by detector ID.

Changes:

  • Rename flatten_over_channels to flatten_over_detectors
  • Replace channel/chevtno columns with detector/detevtno
  • Store detector as DetectorId type instead of Int
  • Update build_global_events to use DetectorIdLike signatures
  • Refactor calibrate_all.jl to use detector-based access
  • Remove unnecessary only.() wrapper from max_e_det

Aligns event building with new DSP logic where data is keyed by detector ID.

Changes:
- Rename flatten_over_channels to flatten_over_detectors
- Replace channel/chevtno columns with detector/detevtno
- Store detector as DetectorId type instead of Int
- Update build_global_events to use DetectorIdLike signatures
- Refactor calibrate_all.jl to use detector-based access
- Remove unnecessary only.() wrapper from max_e_det
@jonasschlegel jonasschlegel self-assigned this Jan 20, 2026
@jonasschlegel jonasschlegel added the bug Something isn't working label Jan 20, 2026
@jonasschlegel
Copy link
Contributor Author

jonasschlegel commented Jan 20, 2026

There is still a lot of chdata naming in there but this is not necessary to change now. If we want to do this consistent we also have to change the prop fucntions names in LegendDataManagement evt_fucntions.jl and calibration_functions.jl. This is just for the compability with the new DSP tier format. I already tested this version, everything is working.

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 0% with 117 lines in your changes missing coverage. Please review.
✅ Project coverage is 5.77%. Comparing base (1c74db1) to head (efeb643).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/calibrate_all.jl 0.00% 55 Missing ⚠️
src/calibrate_geds.jl 0.00% 14 Missing ⚠️
src/build_global_events.jl 0.00% 13 Missing ⚠️
src/calibrate_pmts.jl 0.00% 10 Missing ⚠️
src/flatten_over_channels.jl 0.00% 10 Missing ⚠️
src/calibrate_smps.jl 0.00% 9 Missing ⚠️
src/calibrate_aux.jl 0.00% 6 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##            main     #31   +/-   ##
=====================================
  Coverage   5.77%   5.77%           
=====================================
  Files          7       7           
  Lines        329     329           
=====================================
  Hits          19      19           
  Misses       310     310           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@theHenks
Copy link
Collaborator

There is still a lot of chdata naming in there but this is not necessary to change now. If we want to do this consistent we also have to change the prop fucntions names in LegendDataManagement evt_fucntions.jl and calibration_functions.jl. This is just for the compability with the new DSP tier format. I already tested this version, everything is working.

I would prefer the naming to be consistent. So if it is not too much of work, let's use det as names everywhere.

Copy link
Collaborator

@theHenks theHenks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest renaming the other funtions too, such as calibrate_geds, calibrate_spms, calibrate_pmts etc.

- Rename calibrate_*_channel_data functions to calibrate_*_detector_data
- Rename chdata/channel_data variables to detdata/detector_data
- Rename prop functions
- (jldataprod and LegendDataManagement changed too)
@jonasschlegel jonasschlegel marked this pull request as ready for review January 22, 2026 14:52
Copilot AI review requested due to automatic review settings January 22, 2026 14:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the event building system to use DetectorId instead of ChannelId as the primary key for data organization, aligning with new DSP logic where data is keyed by detector ID rather than channel ID.

Changes:

  • Renamed flatten_over_channels to flatten_over_detectors with corresponding column name changes (channel/chevtno → detector/detevtno)
  • Updated all calibration functions to use detector-based naming and DetectorId types
  • Modified calibrate_all.jl to access datastores using detector IDs and updated all variable and function references
  • Changed build_global_events to use DetectorIdLike signatures throughout

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/flatten_over_channels.jl Renamed function and updated all references from channel to detector terminology; changed column names and types to use DetectorId
src/calibrate_smps.jl Renamed calibrate_spm_channel_data to calibrate_spm_detector_data; updated parameter names and internal variable references
src/calibrate_pmts.jl Renamed calibrate_pmt_channel_data to calibrate_pmt_detector_data; updated parameter names and internal variable references
src/calibrate_geds.jl Renamed calibrate_ged_channel_data to calibrate_ged_detector_data; updated parameter names and internal variable references
src/calibrate_aux.jl Renamed calibrate_aux_channel_data to calibrate_aux_detector_data; updated parameter names and internal variable references
src/calibrate_all.jl Refactored to use detector-based access patterns throughout; changed datastore access from ChannelId to string(DetectorId); updated variable names and function calls
src/build_global_events.jl Updated function signatures to use DetectorIdLike; renamed columns from channel/chevtno to detector/detevtno; updated documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@DaGeibl DaGeibl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes look good.
Only real change besides renaming is switching from storing channels as Int to DetectorID. If you tested that everything runs, that should be fine.

@jonasschlegel jonasschlegel requested review from theHenks and removed request for oschulz January 27, 2026 10:44
@oschulz oschulz merged commit 734ec0d into main Feb 2, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants