Skip to content

Rename GGCoefs to GGFit and give every documented field its type - #46

Merged
DavidSagan merged 1 commit into
mainfrom
rename-ggcoefs-to-ggfit
Aug 9, 2026
Merged

DavidSagan merged 1 commit into
mainfrom
rename-ggcoefs-to-ggfit

Conversation

@DavidSagan

Copy link
Copy Markdown
Member

Rename

GGCoefs → GGFit, all 55 occurrences.

The struct holds a fit, not a bag of coefficients: alongside the fitted GG
functions it carries the per-plane weighted and unweighted residuals, the field
averages, the (m_max, nd_max) scan table and the pruning record. GGFit says
that, and it matches the gg_fit variable the fit API returns after #45.

No deprecation alias — nothing outside the repository uses the name.

The HDF5 format is unaffected. The type name was never written to a file, so
existing fits still load through read_gg_fit.

The name is two characters shorter, so the continuation lines of the five
multi-line GGFit(; ...) constructor calls (gg_utils.jl, low_level.jl,
gg_fit.jl ×2, runtests.jl) are de-indented to stay aligned with the paren.

Field types

Every struct docstring now gives each field its declared type, in the
- `field::Type` — description form:

struct fields note
GGFit 17
FieldGridTable 10 Fields: → ## Fields for consistency
GGFitScanPoint 8
GGFitInputParams 13 in 12 bullets — prune_ave_limit/prune_max_limit share one, as they already did
GGEvalPlan 7 new list, built from the inline field comments
_CompTerms 4 new list, likewise
_Tower 7 new list, likewise

GGFitInputParams

This one needed the most work. Its field headings already named a type, but
loosely (core_weight = Float, m_max = Int or vector of Int), and nine of the
thirteen were indented two spaces rather than four — so they rendered as running
prose rather than as code. They now carry the declared type and sit in the same
bullet list the other structs use.

The entries here are much longer than in the other structs, several running to
multiple paragraphs with an example block, so the follow-on paragraphs and the
five code blocks are indented two spaces to stay inside their bullet.

The docstring also gains the mutable struct GGFitInputParams signature line and
a ## Fields heading, having had neither.

The prose is otherwise unchanged: I diffed the word multiset before and after,
and the only differences are the 12 added — separators, the merged prune_*
bullet gaining a comma, and one reworded lead-in — n_planes_add began "This
parameter sets the number of z-planes added…", which reads oddly after a bullet
label, and is now "Number of z-planes added…".

Markdown repairs

GGFit.g_ref read [1/m] (`0` for a straight reference frame), which
CommonMark parses as a link; Documenter warned about it. It now reads ", in 1/m
(...)", the way FieldGridTable.g_ref already phrased the same thing.
[x0, y0, z] and [0, 0] in GGFitInputParams were bare square brackets of the
same kind and are now in backticks.

Verification

  • Pkg.test() — 1125/1125 pass, unchanged from main.
  • Documenter API build is free of doc warnings (it was not before: the g_ref
    link warning above).
  • In the rendered HTML, the GGFitInputParams field list is a single <ul> of
    exactly 12 items with all five code blocks nested inside the item they
    document, rather than terminating the list.
  • No added line exceeds 100 characters.

Not addressed here

  • GGTerm and GGTaylor (struct.jl) have no docstrings and nothing in the
    package references them — GGTaylor is used only by its own field. There were
    no field docs to add types to, and they may simply be dead code worth
    deleting. Left alone pending that call.
  • The export/eval side still names this struct fit rather than gg_fit
    (read_gg_fit, write_bmad_gg_fit, gg_to_bmad_curves,
    BeamTracking_example.jl), as noted in Rename the fit API so every entry point leads with its verb #45.
  • examples/gg_fit_result.h5 still does not match what run_gg_fit.jl produces
    today.

🤖 Generated with Claude Code

The struct holds a fit, not a bag of coefficients: it carries the fitted
GG functions together with the per-plane residuals, the field averages,
the scan table and the pruning record. `GGFit` says that, and it matches
the `gg_fit` variable the fit API now returns everywhere.

All 55 occurrences move at once. Nothing outside the repository uses the
name, so there is no deprecation alias. The HDF5 format is untouched --
the type name was never written to a file, so fits on disk still read.

Every struct docstring now gives each field its declared type, in the
`- `field::Type` -- description` form:

  GGFit             17 fields
  FieldGridTable    10 fields, and `Fields:` becomes `## Fields`
  GGFitScanPoint     8 fields
  GGFitInputParams  13 fields, in 12 bullets
  GGEvalPlan         7 fields, a new list built from the inline comments
  _CompTerms         4 fields, likewise
  _Tower             7 fields, likewise

GGFitInputParams needed the most work. Its field headings already named
a type, but loosely (`core_weight = Float`) and nine of the thirteen were
indented two spaces rather than four, so they rendered as running prose
instead of as code. They now carry the declared type and sit in the same
bullet list the other structs use, with the follow-on paragraphs and the
five example blocks indented into their bullet. The docstring also gains
the `mutable struct GGFitInputParams` signature line and a `## Fields`
heading, having had neither.

Two Markdown repairs along the way. `GGFit.g_ref` read `[1/m] (`0` for a
straight reference frame)`, which parses as a link -- Documenter warned
about it. It now reads ", in 1/m (...)", the way FieldGridTable.g_ref
already phrased the same thing. `[x0, y0, z]` and `[0, 0]` in
GGFitInputParams were bare square brackets of the same kind, and are now
in backticks.

Verified: 1125 tests pass; the Documenter API build is free of doc
warnings; and in the rendered HTML the GGFitInputParams field list is a
single <ul> of exactly 12 items with all five code blocks nested inside
the item they document, rather than breaking the list.

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/PR46/

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

@DavidSagan
DavidSagan merged commit 2ebee5d into main Aug 9, 2026
3 checks passed
github-actions Bot added a commit that referenced this pull request Aug 9, 2026
@DavidSagan
DavidSagan deleted the rename-ggcoefs-to-ggfit branch August 9, 2026 04:45
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