Tabulated wakefields and IMPACT-Z interchange - #154
Open
ChristopherMayes wants to merge 2 commits into
Open
Conversation
ChristopherMayes
marked this pull request as ready for review
August 22, 2026 04:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tabulated wakefields and IMPACT-Z interchange
Summary
This branch makes
TabularWakefieldthe interchange format between the analytic wakefield models and external tracking codes, and adds IMPACT-Z support on top of it.TabularWakefield.from_wakefieldresamples anyWakefieldBaseonto a uniform grid.ResistiveWallWakefieldBase.to_tabulartabulates either resistive wall model over a default range of100 * s0.create_impact_z_wakefield_rfdatareturns the uniform four-column table consumed by the IMPACT-Z zero-length-41element, andwrite_impact_z_wakefieldwrites it.parse_impact_z_wakefieldandTabularWakefield.from_impact_zread such a table back into thez <= 0convention, from either a path or an array.Impact
A resistive wall model can now be handed to IMPACT-Z without hand-written glue code, and a table produced elsewhere can be read back for comparison against the analytic models.
The round trip through the writer and reader is exact, and a re-imported table agrees with its parent model to 2.6e-08 of
W0for a copper pipe of 2.5 mm radius.Both entry points work on arrays as well as paths, because a driver such as lume-impact holds its input as
dict[str, NDArray]and decides where the file belongs only at run time.The sign convention, the mirror from
ztosand the 5000-row limit ofNdatainitherefore live in one place rather than being reimplemented downstream.Notes on three decisions
The default tabulation range is
100 * s0rather than a smaller multiple, because the pseudomode decay length is governed byk_r / 2 Q_rrather than bys0and still holds up to 24 % ofW0at20 * s0.from_wakefieldenlarges the transform length when it resamples anImpedanceWakefield.The default grid reaches only about 2.6 mm, so a 10 mm aluminium pipe wrapped around and returned 0.70 of
W0in the tail.This is a pre-existing limitation of
ImpedanceWakefield.wake, which is otherwise unchanged.The writer emits 17 significant digits.
At 12 digits the rounded first abscissa fell outside the range of the re-read table, and the interpolant returned its fill value there.
The same fill value motivates a guard in
from_wakefield.Resampling a
TabularWakefieldover a range wider than the source covers used to produce a silently zero-padded table, and now raises, naming both the requested range and the range available.Testing
tests/test_wakefields.pyadds 27 tests, including a round trip through the IMPACT-Z writer and reader and a check that the written file agrees with the array the builder returns.The fixture
tests/data/rfdata41.inholds the first 200 rows of the IMPACT-Zexamples/Example3table, unmodified, so that the parser is exercised against Fortran-formatted columns that this package did not write.The full suite passes,
ruffreports no new findings, and both wakefield notebooks execute.Acknowledgement
This work was carried out with Claude Opus 5 running as GitHub Copilot in Visual Studio Code.
The model wrote the implementation, the tests and the documentation, and ran every measurement quoted above on the local machine against the working tree.
The author reviewed the change before submitting it.