Skip to content

Add CombinedField - #64

Open
joshuabourassa wants to merge 1 commit into
mainfrom
test/combined-field
Open

Add CombinedField#64
joshuabourassa wants to merge 1 commit into
mainfrom
test/combined-field

Conversation

@joshuabourassa

Copy link
Copy Markdown

combined field class for field line tracing

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
essos/fields.py 0.00% 22 Missing ⚠️
Files with missing lines Coverage Δ
essos/fields.py 0.00% <0.00%> (-38.12%) ⬇️

... and 13 files with indirect coverage changes

@rogeriojorge

Copy link
Copy Markdown
Member

Thanks @joshuabourassa I added Eduardo and Estêvão to review this before merging

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CombinedField in essos/fields.py with B, B_contravariant, to_xyz, and JAX pytree registration.
  • Adds an examples/test_combined_field.py script that exercises CombinedField against BiotSavart.

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 thread essos/fields.py
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 thread essos/fields.py
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

@rogeriojorge

Copy link
Copy Markdown
Member

@joshuabourassa copilot actually mentioned a few good points, the sqrtg issue and the fact that there is a file called test in examples

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.

3 participants