Repository navigation
Rename GGCoefs to GGFit and give every documented field its type - #46
Merged
Merged
Conversation
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>
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. |
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.
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.GGFitsaysthat, and it matches the
gg_fitvariable 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` — descriptionform:GGFitFieldGridTableFields:→## Fieldsfor consistencyGGFitScanPointGGFitInputParamsprune_ave_limit/prune_max_limitshare one, as they already didGGEvalPlan_CompTerms_TowerGGFitInputParams
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 thethirteen 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 GGFitInputParamssignature line anda
## Fieldsheading, 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 mergedprune_*bullet gaining a comma, and one reworded lead-in —
n_planes_addbegan "Thisparameter 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_refread[1/m] (`0` for a straight reference frame), whichCommonMark parses as a link; Documenter warned about it. It now reads ", in 1/m
(...)", the way
FieldGridTable.g_refalready phrased the same thing.[x0, y0, z]and[0, 0]inGGFitInputParamswere bare square brackets of thesame kind and are now in backticks.
Verification
Pkg.test()— 1125/1125 pass, unchanged frommain.g_reflink warning above).
GGFitInputParamsfield list is a single<ul>ofexactly 12 items with all five code blocks nested inside the item they
document, rather than terminating the list.
Not addressed here
GGTermandGGTaylor(struct.jl) have no docstrings and nothing in thepackage references them —
GGTayloris used only by its own field. There wereno field docs to add types to, and they may simply be dead code worth
deleting. Left alone pending that call.
fitrather thangg_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.h5still does not match whatrun_gg_fit.jlproducestoday.
🤖 Generated with Claude Code