Skip to content

Rename the fit API so every entry point leads with its verb - #45

Merged
DavidSagan merged 1 commit into
mainfrom
rename-fit-api
Aug 9, 2026
Merged

DavidSagan merged 1 commit into
mainfrom
rename-fit-api

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

Pure rename. No behaviour changes anywhere.

Functions

old new
gg_fit gg_calc_fit
gg_fit_show_results gg_show_fit_results
gg_fit_residual_map gg_make_fit_residual_table
gg_fit_show_residuals gg_show_fit_residuals

All four exported entry points now read verb-first — calc, show, make, show — rather than putting the action last behind a gg_fit prefix, which the residual table never really fit under anyway.

Variable

The GGCoefs a fit returns is called gg_fit instead of results, in the four public signatures, the two private helpers that take one (_gg_taylor_getters, _gg_field_contributions), and every docstring, example and guide code block. results said nothing about what the object was; the qualified name keeps the package identifiable in a script that mixes this fit with other code.

Four occurrences of "results" that were ordinary English rather than the variable were left alone (README.md, examples/README.md, low_level.jl:238, one test comment).

What was deliberately not renamed

Names that merely contain gg_fit as a substring: read_gg_fit, write_gg_fit, write_bmad_gg_fit, _interp_gg_fit, the gg_fit_result.h5 data files, and the file src/gg_fit.jl itself. The rename was word-boundary anchored so none of these moved.

There are no deprecation aliases — nothing outside this repository uses the old names.

Known inconsistency, not addressed here

The export/evaluation half of the package still names the same struct fit: read_gg_fit returns (fit::GGCoefs, meta), and write_bmad_gg_fit(fit; …), gg_to_bmad_curves(fit) and examples/BeamTracking_example.jl follow it. So you get the qualified name when you produce a fit and the bare one when you load one back. Unifying that is ~25 more occurrences and a separate decision.

Verification

  • Pkg.test() — 1125 pass, unchanged from before the rename.
  • examples/run_gg_fit.jl runs to completion.
  • gg_show_fit_residuals and gg_make_fit_residual_table exercised on the real field map.
  • No remaining reference to any of the four old names outside old/.

🤖 Generated with Claude Code

`gg_fit` becomes `gg_calc_fit`, `gg_fit_show_results` becomes
`gg_show_fit_results`, `gg_fit_residual_map` becomes
`gg_make_fit_residual_table`, and `gg_fit_show_residuals` becomes
`gg_show_fit_residuals`. The four exported entry points now read
verb-first -- calc, show, make, show -- instead of burying the action
behind a `gg_fit` prefix that a residual map never had much claim to.

The `GGCoefs` a fit returns is named `gg_fit` in place of `results`,
in the four public signatures, the two private helpers that take one,
and every docstring and example. `results` said nothing about what the
object was; the qualified name keeps the package visible in scripts
that mix this fit with other code. Note that the export and evaluation
side (`read_gg_fit`, `write_bmad_gg_fit`, `gg_to_bmad_curves`) still
calls the same struct `fit`.

Names that merely contain `gg_fit` are untouched: `read_gg_fit`,
`write_gg_fit`, `write_bmad_gg_fit`, `_interp_gg_fit`, the
`gg_fit_result.h5` files, and `src/gg_fit.jl` itself. There are no
deprecation shims -- nothing outside the repository uses these names.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

📖 Documentation preview for this PR: https://bmad-sim.github.io/GeneralizedGradients.jl/previews/PR45/

Rebuilt on every push; removed automatically when the PR closes.

@DavidSagan
DavidSagan merged commit 061ed71 into main Aug 9, 2026
3 checks passed
@DavidSagan
DavidSagan deleted the rename-fit-api branch August 9, 2026 02:34
github-actions Bot added a commit that referenced this pull request Aug 9, 2026
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.

1 participant