Skip to content

4 consider moving data files into header files#89

Merged
nbassler merged 15 commits into
mainfrom
4-consider-moving-data-files-into-header-files
Apr 1, 2026
Merged

4 consider moving data files into header files#89
nbassler merged 15 commits into
mainfrom
4-consider-moving-data-files-into-header-files

Conversation

@nbassler
Copy link
Copy Markdown
Member

@nbassler nbassler commented Apr 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 1, 2026 11:21
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 70.67568% with 217 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.33%. Comparing base (dd367e7) to head (4718ad1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
examples/dedx_bench_lookup.c 0.00% 78 Missing ⚠️
tests/test_interpolation.c 62.96% 44 Missing and 26 partials ⚠️
tests/test_core_api.c 30.30% 12 Missing and 11 partials ⚠️
src/dedx.c 60.00% 16 Missing ⚠️
src/dedx_data_access.c 84.61% 10 Missing ⚠️
src/dedx_embedded_data.c 94.95% 6 Missing ⚠️
src/dedx_embedded_metadata.c 90.32% 6 Missing ⚠️
tests/test_tools.c 0.00% 3 Missing and 1 partial ⚠️
src/dedx_spline.c 96.84% 3 Missing ⚠️
src/dedx_mstar.c 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
- Coverage   73.98%   72.33%   -1.66%     
==========================================
  Files          37       38       +1     
  Lines        2856     3148     +292     
  Branches      387      452      +65     
==========================================
+ Hits         2113     2277     +164     
- Misses        693      784      +91     
- Partials       50       87      +37     

☔ 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.

Comment thread tools/dat2c.py Fixed
nbassler and others added 3 commits April 1, 2026 13:25
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

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 migrates libdedx from runtime file-based table loading to compile-time embedded datasets (generated C headers), while also introducing configurable interpolation modes for stopping-power splines and updating tests/build plumbing accordingly.

Changes:

  • Replace file I/O data loading with embedded table/metadata access (dedx_data_access.*, src/data/embedded/*), and remove legacy data-path/binary-table build steps.
  • Add interpolation-mode support (log-log vs linear) including validation and updated spline coefficient/evaluation logic.
  • Update CMake, CI, tests, and examples to match the new embedded-data layout and updated numeric expectations.

Reviewed changes

Copilot reviewed 109 out of 177 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Windows/libdedx.dll Binary artifact included/updated in PR.
Windows/dedx_ws.h Removed legacy Windows header.
Windows/dedx_tools.h Removed legacy Windows header.
Windows/data/short_names Removed legacy Windows data file.
Windows/data/pstarEng.bin Binary data artifact included/updated in PR.
Windows/data/PSTAR.bin Binary data artifact included/updated in PR.
Windows/data/mstarEng.bin Binary data artifact included/updated in PR.
Windows/data/MSTAR.bin Binary data artifact included/updated in PR.
Windows/data/mstar_gas_states.dat Removed legacy Windows metadata file.
Windows/data/icru73Eng.bin Binary data artifact included/updated in PR.
Windows/data/ICRU73.bin Binary data artifact included/updated in PR.
Windows/data/icru73_newEng.bin Binary data artifact included/updated in PR.
Windows/data/ICRU73_NEW.bin Binary data artifact included/updated in PR.
Windows/data/icru_pstarEng.bin Binary data artifact included/updated in PR.
Windows/data/ICRU_PSTAR.bin Binary data artifact included/updated in PR.
Windows/data/icru_astarEng.bin Binary data artifact included/updated in PR.
Windows/data/ICRU_ASTAR.bin Binary data artifact included/updated in PR.
Windows/data/astarEng.bin Binary data artifact included/updated in PR.
Windows/data/ASTAR.bin Binary data artifact included/updated in PR.
tests/test_icru90.c New regression test asserting ICRU90 carbon data usage where available.
tests/test_icru.c Updated expected ICRU stopping-power values to match embedded data/interpolation.
tests/test_error_codes.c Adds config-validation test for invalid interpolation mode error.
tests/test_core_api.c Adds min/max energy checks for ICRU carbon ranges.
tests/install_smoke_test.cmake Removes install-smoke configuration forcing installed data path (no longer needed).
tests/CMakeLists.txt Adds ${PROJECT_SOURCE_DIR}/src include path for tests using internal headers.
src/dedx_validate.h New internal validation API header split out for tests/internal usage.
src/dedx_validate.c Switches to embedded data access and adds interpolation-mode validation.
src/dedx_tools.c Switches to embedded data access include.
src/dedx_stopping_data.h New internal struct describing one stopping-power table row.
src/dedx_spline.h New spline API header (now supports log-log vs linear interpolation).
src/dedx_spline.c New spline implementation with log-log support and linear fallback.
src/dedx_spline_base.h Renames spline struct and adds cached log_* fields.
src/dedx_periodic_table.h New periodic-table header (atomic masses/nucleons).
src/dedx_periodic_table.c New periodic-table implementation.
src/dedx_mstar.h New internal MSTAR helpers header.
src/dedx_mstar.c Switches to embedded data access include.
src/dedx_mpaul.h Switches to embedded data access include.
src/dedx_lookup_data.h Renames internal lookup type and adds stored interpolation mode.
src/dedx_lookup_accelerator.h Renames lookup accelerator struct to internal naming scheme.
src/dedx_embedded_metadata.h New API for reading embedded metadata (density, gas state, I-values, composition).
src/dedx_embedded_metadata.c Implements embedded metadata lookups from generated headers.
src/dedx_embedded_data.h New API describing embedded program datasets and table lookup helpers.
src/dedx_data_access.h Renames file-access API to embedded data-access API (docs updated).
src/dedx_data_access.c Implements data access from embedded tables/metadata.
src/dedx_const.h New internal constants header for legacy physics constants.
src/dedx_bethe.h Updates Bethe API to use renamed internal workspace type.
src/dedx_bethe.c Renames internal Bethe structs/types and updates allocations.
src/dedx_bethe_struct.h Renames Bethe model/gold/workspace struct types.
src/data/embedded/dedx_icru90_pos.h Adds generated embedded ICRU90 positron tables.
src/data/embedded/dedx_icru90_p.h Adds generated embedded ICRU90 proton tables.
src/data/embedded/dedx_icru90_e.h Adds generated embedded ICRU90 electron tables.
src/data/embedded/dedx_icru90_C.h Adds generated embedded ICRU90 carbon tables.
src/data/embedded/dedx_icru90_a.h Adds generated embedded ICRU90 alpha tables.
src/data/embedded/dedx_composition.h Reworks embedded composition header with include guards and renamed symbols.
src/data/embedded/dedx_bethe.h Adds generated embedded Bethe energy grid header.
src/CMakeLists.txt Switches build to src/ target layout, embedded data objects, and installs headers from include/.
python/tests/conftest.py Adds build output candidate path under build/src/ for the shared library.
libdedx/tools/dedx_math.h Removes legacy math helpers header.
libdedx/tools/dedx_math.c Removes legacy math helpers implementation.
libdedx/dedx_split.h Removes legacy token-splitting helper header.
libdedx/dedx_split.c Removes legacy token-splitting helper implementation.
libdedx/dedx_spline.h Removes legacy spline header (replaced by src/dedx_spline.h).
libdedx/dedx_spline.c Removes legacy spline implementation (replaced by src/dedx_spline.c).
libdedx/dedx_file.h Removes legacy file-name mapping header.
libdedx/dedx_file.c Removes legacy file-name mapping implementation.
libdedx/dedx_config.h.in Removes configured data-path header template (no longer used).
libdedx/data/short_names Removes legacy data file.
libdedx/data/pstarEng.dat Removes legacy raw energy grid file.
libdedx/data/mstarEng.dat Removes legacy raw energy grid file.
libdedx/data/icru73Eng.dat Removes legacy raw energy grid file.
libdedx/data/icru73_newEng.dat Removes legacy raw energy grid file.
libdedx/data/icru_pstarEng.dat Removes legacy raw energy grid file.
libdedx/data/icru_astarEng.dat Removes legacy raw energy grid file.
libdedx/data/estarEng.dat Removes legacy raw energy grid file.
libdedx/data/effective_charge.dat Removes legacy metadata file (replaced by embedded metadata).
libdedx/data/dedx_bethe.h Removes legacy generated Bethe header.
libdedx/data/dat2c.py Removes legacy generator script from old location.
libdedx/data/betheEng.dat Removes legacy raw energy grid file.
libdedx/data/astarEng.dat Removes legacy raw energy grid file.
include/dedx.h Adds interpolation modes, updates workspace internal type forward decl, adds config field.
include/dedx_wrappers.h New installed wrappers header under include/.
include/dedx_tools.h New installed tools header under include/.
include/dedx_error.h Updates error-code docs and adds invalid interpolation mode error.
examples/scripting/makefile Removes legacy scripting example build file.
examples/scripting/main.c Removes legacy scripting example source.
examples/scripting/libConf Removes legacy scripting example input file.
examples/scripting/invoke_func.h Removes legacy scripting helper header.
examples/dedx2trip/README Removes legacy TRiP conversion example docs.
examples/dedx2trip/range.h Removes legacy TRiP conversion helper header.
examples/dedx2trip/range.c Removes legacy TRiP conversion helper source.
examples/dedx2trip/makefile Removes legacy TRiP conversion makefile.
examples/dedx2trip/dedx2trip_new.h Removes legacy TRiP conversion header.
examples/dedx2trip/dedx2trip_new.c Removes legacy TRiP conversion source.
examples/dedx2trip/adapt.h Removes legacy adapt integration header.
examples/dedx2trip/adapt.c Removes legacy adapt integration source.
examples/dedx_bench_lookup.c Adds a benchmark example comparing lookup performance across interpolation modes.
examples/CMakeLists.txt Builds/links the new benchmark example; removes old data-copy prebuild step.
docs/doxygen/Doxyfile Points Doxygen input to new installed headers under include/.
data/README.md Documents new data layout, regeneration flow, and energy conventions.
data/raw/pstarEng.dat Adds raw regeneration input file (currently CRLF line endings).
data/raw/mstarEng.dat Adds raw regeneration input file (mixed CRLF/LF line endings).
data/raw/icru90_posEng.dat Adds raw ICRU90 positron energy grid input.
data/raw/ICRU90_pos.dat Adds raw ICRU90 positron stopping data input.
data/raw/icru90_pEng.dat Adds raw ICRU90 proton energy grid input.
data/raw/ICRU90_p.dat Adds raw ICRU90 proton stopping data input.
data/raw/icru90_eEng.dat Adds raw ICRU90 electron energy grid input.
data/raw/ICRU90_e.dat Adds raw ICRU90 electron stopping data input.
data/raw/icru90_CEng.dat Adds raw ICRU90 carbon energy grid input.
data/raw/ICRU90_C.dat Adds raw ICRU90 carbon stopping data input.
data/raw/icru90_aEng.dat Adds raw ICRU90 alpha energy grid input.
data/raw/ICRU90_a.dat Adds raw ICRU90 alpha stopping data input.
data/raw/icru73Eng.dat Adds raw ICRU73 energy grid input (new location).
data/raw/icru73_newEng.dat Adds raw ICRU73_NEW energy grid input (new location).
data/raw/icru_pstarEng.dat Adds raw ICRU_PSTAR energy grid input (new location).
data/raw/icru_astarEng.dat Adds raw ICRU_ASTAR energy grid input (new location).
data/raw/gas_states.dat Adds raw gas-state metadata input (new location).
data/raw/estarEng.dat Adds raw ESTAR energy grid input (new location).
data/raw/effective_charge.dat Adds raw effective-charge metadata input (new location).
data/raw/betheEng.dat Adds raw Bethe energy grid input (new location).
data/raw/astarEng.dat Adds raw ASTAR energy grid input (new location).
CONTRIBUTING.md Updates internal type naming example and removes outdated thread-safety note about file-path cache.
CMakeLists.txt Removes data-path configuration and binary-table build; switches build to src/.
buildbins/dedx_build_bin.c Removes binary table build tool source.
buildbins/CMakeLists.txt Removes binary table build tool CMake.
.vscode/settings.json Updates Python test configuration (currently points pytest at a likely-wrong path).
.github/workflows/ci.yml Updates Python test env var to new build output location (build/src/libdedx.so).

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

Comment thread src/dedx_spline.c
Comment thread src/dedx_spline.c Outdated
Comment thread src/dedx_spline.h
Comment thread src/dedx_data_access.c
Comment thread src/dedx_data_access.c
Comment thread src/dedx_data_access.c
Comment thread src/dedx_data_access.c
Comment thread .vscode/settings.json
@nbassler nbassler merged commit c62da12 into main Apr 1, 2026
22 checks passed
@nbassler nbassler deleted the 4-consider-moving-data-files-into-header-files branch April 1, 2026 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants