Skip to content

Support LegendHDF5IO 0.2 - #654

Merged
fhagemann merged 1 commit into
mainfrom
lh5-update
Nov 12, 2026
Merged

fhagemann merged 1 commit into
mainfrom
lh5-update

Conversation

@oschulz

@oschulz oschulz commented Nov 9, 2026 •

Copy link
Copy Markdown
Member
  • I have reviewed all the code in this pull request and deem it of the standard expected for this project.

Written by Claude (Anthropic) in Claude Code, a Fable 5.1 session at xhigh effort, under the guidance of @oschulz, who asked for this draft. Opened as a draft until LegendHDF5IO 0.2.0 is in the LEGEND registry.

LegendHDF5IO 0.2 registers the LH5 datatype names of custom types with register_datatype! instead of writing into its datatype dictionary and extending datatype_to_string. The extension now registers CartesianPoint and CylindricalPoint that way when the function exists and keeps the old route for LegendHDF5IO 0.1, so both versions work without a compat change in Project.toml. The test environment allows LegendHDF5IO 0.1 and 0.2.

Verified: the IO, CSG IO and Geant4 test groups pass with LegendHDF5IO 0.1.19 and with 0.2.0.

LegendHDF5IO 0.2 registers the LH5 datatype names of custom types with
`register_datatype!` instead of writing into its datatype dictionary and
extending `datatype_to_string`. The extension registers CartesianPoint
and CylindricalPoint that way when the function exists and keeps the old
route for LegendHDF5IO 0.1, so both versions work. The IO, CSG IO and
Geant4 tests pass with LegendHDF5IO 0.1.19 and 0.2.0.

Assisted-By: generative AI
@oschulz
oschulz marked this pull request as ready for review November 12, 2026 10:42
@oschulz
oschulz requested a review from fhagemann November 12, 2026 10:42

@fhagemann fhagemann left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I had a quick look if this is backwards compatible and that seems to be the case:

With LegendHDF5IO@0.1.19:

using SolidStateDetectors
using Geant4
using Unitful

sim = Simulation{Float32}(SSD_examples[:InvertedCoax])
source = MonoenergeticSource("gamma", 661.66u"keV", CartesianPoint(0,0,0.11))
app = G4JLApplication(sim, source)
t = run_geant4_simulation(app, 1_000)

using LegendHDF5IO

lh5open("LegendHDF5IO_v0.1.h5", "w") do h
    LegendHDF5IO.writedata(h, "G4Table", t)
end

With LegendHDF5IO@0.2.0:

using SolidStateDetectors
using LegendHDF5IO

t_in = lh5open("LegendHDF5IO_v0.1.h5", "r") do h
    LegendHDF5IO.readdata(h, "G4Table")
end

And I can read back (at least the CartesianPoint, I would not see why this should not work with CartesianPoint).

@fhagemann
fhagemann merged commit 29c6738 into main Nov 12, 2026
11 checks passed
@fhagemann
fhagemann deleted the lh5-update branch November 12, 2026 17:01
@fhagemann

Copy link
Copy Markdown
Collaborator

--> JuliaRegistries/General#175930

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants