Skip to content

Major refactoring for JAX-style classes.#29

Open
EstevaoMGomes wants to merge 135 commits into
mainfrom
eg/analysis
Open

Major refactoring for JAX-style classes.#29
EstevaoMGomes wants to merge 135 commits into
mainfrom
eg/analysis

Conversation

@EstevaoMGomes

Copy link
Copy Markdown
Collaborator

Refactor of coils & surfaces to be proper PyTrees;
Added a loss wrapper to differentiate with respect to the dogs (PyTree leaves);
Added analysis & validation of the code

- Implemented `fo_integrators.py` for full orbit tracing with various methods and parameters.
- Implemented `gc_integrators.py` for guiding center dynamics with adaptative and constant step sizes.
- Enhanced `Tracing` class in `dynamics.py` to support multiple methods and step sizes.
…ance plots, and improve layout for better visualization
eduardolneto and others added 25 commits July 5, 2026 16:54
En/review eg/augmented lagrangian : Modifying constraints and augmented_lagrange formalismo to fit the custom_losses machinery added in eg/analysis PR #29
En/review eg/coil perturbations fix : This PR changes coils.py and coil_pertubation.py in order to allow for the stochastic optimization and coil perturbation machinery to work with the custom_losses machinery addeed in PR #29. Coils and surfaces scaling was also adjusted so that the scaling is properly treated by the custom_losses, by correctly evaluating losses(unscalled_dofs(scaled_dofs)).
En/review eg/dynamics fix : This PR fixes dynamics.py in order to work properly with PR #29 changes. A function to initialize particles around a given axis is also added.
En/review eg/losse val grad : This adds some small features to the custom_losses implementation of PR #29, with the most relevant being the ability to call val_and_grad method for this custom loss class. This allows for more efficieny in optimizers that require both quantities at the same time like LBFGSB.
…ective_functions_mod

En/review eg/fields surfaces objective functions mod : This PR checks objective_function.py so that the loss functions there now follow the custom_losses dependencies added in PR #29.
…Tree traversal, fixing 'None is not a valid value for jnp.array' crash in tracing (from_simsopt and from_json paths)
Guard Coils.dofs_currents against None/bool sentinels (fixes tracing crash on #42)
The requested changes have been addressed so I am going to merge into  eg/analysis.
@EstevaoMGomes EstevaoMGomes added the refactoring Major changes to the code implementation label Jul 17, 2026
…ive and correct simsopt tracing comparison (adaptive models, Dopri5, matched output points). Verified: 12 examples FAIL->PASS, zero regressions.
…mocks, near-axis shapes matched to pyqsc_jax), fix grad_pytree tracer leak in losses.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Major changes to the code implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants