Improve Julia tools packaging and add tests#95
Conversation
tdixon97
commented
Feb 7, 2026
- setup basic infrastructure (real julia package)
- add CI hooks
- actually write tests
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #95 +/- ##
=======================================
Coverage 67.13% 67.13%
=======================================
Files 23 23
Lines 2054 2054
=======================================
Hits 1379 1379
Misses 675 675 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR starts setting up a proper Julia package (LegendSimflow) and CI to run Julia tests, and begins moving previously-included helper code into a reusable module.
Changes:
- Added a Julia package skeleton (
LegendSimflow) withProject.toml, module entrypoint, and aPkg.test()harness. - Added a GitHub Actions job to run Julia tests in CI.
- Refactored the HPGe drift time map script to use the new package instead of including the helper file directly.
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| workflow/src/legendsimflow/scripts/Project.toml | Adds a Julia project name to the scripts environment. |
| workflow/julia/LegendSimflow/test/test_lib.jl | Introduces a placeholder test file (currently empty). |
| workflow/julia/LegendSimflow/test/runtests.jl | Adds the Julia test entrypoint calling into test_lib.jl. |
| workflow/julia/LegendSimflow/src/make_hpge_drift_time_maps.jl | Switches from include(...)-based helpers to using LegendSimflow. |
| workflow/julia/LegendSimflow/src/libjl/drift_time_helpers.jl | Adds the drift-time helper library code into the package. |
| workflow/julia/LegendSimflow/src/init-julia-env.jl | Adds a Julia environment bootstrap/registry installation helper. |
| workflow/julia/LegendSimflow/src/LegendSimflow.jl | Adds the Julia module entrypoint including the helper library. |
| workflow/julia/LegendSimflow/Project.toml | Defines the new Julia package and dependencies/compat. |
| .github/workflows/main.yml | Adds a CI job to run Pkg.test() for the Julia package. |
Comments suppressed due to low confidence (1)
workflow/julia/LegendSimflow/src/make_hpge_drift_time_maps.jl:30
using LegendSimflowdoes not bringcompute_drift_time_map(and other helper functions) into scope unless they are exported, and it also no longer implicitly loads dependencies likeSolidStateDetectorsthat this script uses later (e.g.,SSD = SolidStateDetectors,Simulation{T}(...)). As written, this script will error withUndefVarErrorfor those names. Either qualify calls (LegendSimflow.compute_drift_time_map, etc.) and add explicitusing SolidStateDetectors, or export the intended API fromLegendSimflowand import the external deps explicitly here.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
workflow/julia/LegendSimflow/src/make_hpge_drift_time_maps.jl:30
using LegendSimflowdoesn’t make the helper functions (e.g.,compute_drift_time_map) or external deps (e.g.,SolidStateDetectors) available unqualified. The script later callscompute_drift_time_map(...)and referencesSolidStateDetectorswithout a module prefix, which will error now that theinclude("libjl/drift_time_helpers.jl")was removed. Either import the specific names (using LegendSimflow: compute_drift_time_map, ...andusing SolidStateDetectors) or update call sites to useLegendSimflow.compute_drift_time_map/LegendSimflow.SolidStateDetectors.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
workflow/julia/LegendSimflow/src/make_hpge_drift_time_maps.jl:32
make_hpge_drift_time_maps.jlnow relies onusing LegendSimflow, but this file referencesSolidStateDetectors(and its types likeSimulation,ADLChargeDriftModel, etc.) without importing it anywhere after removing the directinclude(...). Also,compute_drift_time_mapis called unqualified; that will only work if it’s exported fromLegendSimflow(it currently isn’t). Add the missingusing SolidStateDetectors(and any other needed deps) here, and either qualify the helper call asLegendSimflow.compute_drift_time_map(...)or export/import that symbol from the package.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
also missing: update snakemake rules |
|
Yes there is still quite a lot to do. |
|
Please also add some constraints to the julia package versions in the Project.toml file. |
|
@gipert I think we should finish and merge this structural change (tomorrow?) and then add more tests and details later. I am not so sure what changes you want to Project.toml |
|
It's very easy and also important to do asap |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (4)
workflow/julia/LegendSimflow/src/make_hpge_drift_time_maps.jl:35
SolidStateDetectorsis referenced later in this script (e.g.,Simulation{T},SolidStateDetector,ADLChargeDriftModel), but after switching frominclude(...)tousing LegendSimflowit is no longer imported into this file scope. Add an explicitusing SolidStateDetectors(or fully-qualify usages) so the script doesn’t fail withUndefVarError: SolidStateDetectors not defined.
workflow/julia/LegendSimflow/src/libjl/drift_time_helpers.jl:268- The
compute_drift_time_mapdocstring still documents the old signature/order (compute_drift_time_map(sim, meta, T, angle_deg, grid_step)) and argument list, but the function now takes(sim, meta, angle_deg, grid_step, padding, T). Update the docstring signature and the# Argumentssection so callers don’t use the wrong parameter order.
workflow/julia/LegendSimflow/src/libjl/drift_time_helpers.jl:268 - Changing
compute_drift_time_map’s positional argument order is a breaking API change and currently conflicts with the existing call site inmake_hpge_drift_time_maps.jl(which passesTas the 3rd argument). Consider restoring the original signature (or adding a compatibility wrapper method) so existing scripts keep working.
workflow/julia/LegendSimflow/src/libjl/drift_time_helpers.jl:278 build_simulation_grid_axisrequiresboundary::T, grid_step::TwhereT<:AbstractFloat, but hereradius/heightare computed as defaultFloat64andgrid_stepis only constrained toReal. This will throw aMethodErrorifgrid_stepis anIntor a different float type thanradius/height. Convertradius,height, andgrid_steptoTbefore calling, or tighten thecompute_drift_time_mapsignature to acceptgrid_step::T/boundary::T.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Promotes the ad-hoc Julia scripts in legendsimflow/scripts/ to a proper Julia package at workflow/src/LegendSimflow.jl, with a Project.toml, versioned source code and tests. Updates Snakemake rules to reference the new package location and adds a CI job to run the Julia tests. Co-Authored-By: Toby Dixon <toby.dixon.23@ucl.ac.uk> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Toby Dixon <toby.dixon.23@ucl.ac.uk> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>