Add CombinedField - #64
Open
joshuabourassa wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
|
rogeriojorge
requested review from
EstevaoMGomes and
eduardolneto
and
a lite review from Copilot
August 26, 2026 13:55
Member
|
Thanks @joshuabourassa I added Eduardo and Estêvão to review this before merging |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a CombinedField magnetic field wrapper intended to superpose multiple field objects (useful for field-line tracing) and includes an example script demonstrating expected behavior.
Changes:
- Introduces
CombinedFieldinessos/fields.pywithB,B_contravariant,to_xyz, and JAX pytree registration. - Adds an
examples/test_combined_field.pyscript that exercisesCombinedFieldagainstBiotSavart.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| essos/fields.py | Adds CombinedField implementation and registers it as a JAX pytree node. |
| examples/test_combined_field.py | Adds a runnable demonstration script for CombinedField behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+407
to
+410
| @jit | ||
| def B(self, points): | ||
| return sum(f.B(points) for f in self.fields) | ||
|
|
Comment on lines
+1
to
+5
| import jax.numpy as jnp | ||
| from essos.coils import Coils, CreateEquallySpacedCurves | ||
| from essos.fields import CombinedField, BiotSavart | ||
|
|
||
| number_of_field_periods = 2 |
Comment on lines
+401
to
+406
| class CombinedField(MagneticField): | ||
| def __init__(self, *fields): | ||
| if len(fields) < 1: | ||
| raise ValueError("CombinedField needs at least one field") | ||
| self.fields = fields | ||
|
|
Member
|
@joshuabourassa copilot actually mentioned a few good points, the sqrtg issue and the fact that there is a file called test in examples |
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.
combined field class for field line tracing