Skip to content

Conversation

@akaptano
Copy link
Contributor

@akaptano akaptano commented May 28, 2025

Adds in functionality from force_and_torque_overhaul PR #509, including:

  1. jax curves, including JaxCurvePlanarFourier
  2. Adds tests of all the jax functionality, including improving the coverage of JaxCurveXYZFourier
  3. Added make_names and other improvements to JaxCurveXYZFourier, such as faster (vectorized) gamma_pure calculation
  4. Adds in better docstrings and downsample parameter for some of the expensive curve objectives.

@akaptano akaptano self-assigned this May 28, 2025
@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

Attention: Patch coverage is 99.14894% with 2 lines in your changes missing coverage. Please review.

Project coverage is 92.64%. Comparing base (ed66b1d) to head (427bfbf).
Report is 14 commits behind head on master.

Files with missing lines Patch % Lines
src/simsopt/geo/curve.py 98.42% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #528      +/-   ##
==========================================
+ Coverage   92.55%   92.64%   +0.09%     
==========================================
  Files          83       83              
  Lines       16027    16190     +163     
==========================================
+ Hits        14834    15000     +166     
+ Misses       1193     1190       -3     
Flag Coverage Δ
unittests 92.64% <99.14%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@mishapadidar mishapadidar left a comment

Choose a reason for hiding this comment

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

What is the create_planar_curves_between_two_toroidal_surfaces for?

Copy link
Contributor

@mishapadidar mishapadidar left a comment

Choose a reason for hiding this comment

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

just small comments.

TEST_DIR = (Path(__file__).parent / ".." / "test_files").resolve()
filename = TEST_DIR / 'input.LandremanPaul2021_QA'
nphi, ntheta = 8, 8
with ScratchDir("."):
Copy link
Contributor

Choose a reason for hiding this comment

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

should we be using a different directory for scratchdir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to fix this elsewhere too then

@akaptano
Copy link
Contributor Author

@landreman @mishapadidar Last call -- please approve if you don't see anything else. Thanks!

@akaptano
Copy link
Contributor Author

akaptano commented Jul 4, 2025

Reminder to please approve!

@akaptano akaptano requested a review from mbkumar July 7, 2025 13:03
@landreman landreman self-requested a review July 7, 2025 14:04
"""
return self.curve.num_dofs()

def centroid(self):
Copy link
Contributor

@landreman landreman Jul 6, 2025

Choose a reason for hiding this comment

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

The base Curve class already has the same centroid function, and JaxCurve inherits from the base Curve class. So I would guess this function in JaxCurve is superfluous - can it be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at this again, I do not see a JaxCurve version of the function. The lines you highlighted above seem to be for a RotatedCurve object. For this, I think the RotatedCurve should not inherit, since it should call centroid_pure with its own gamma and gammadash, which are wrappers over the inherited curve's gamma and gammadash. Let me know if that is not right though!

Copy link
Contributor

Choose a reason for hiding this comment

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

Im a bit confused here. It seems like the right thing to do is for the Curve class to have a centroid function, and the JaxCurve class to have centroid_pure. Then the RotataedCurve can just inherit from Curve, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is wrong with having centroid_pure for the Curve, and then both JaxCurve and RotatedCurve inheriting that function?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Alan - the present arrangement with centroid() in the base Curve class looks good.

Copy link
Contributor

@mishapadidar mishapadidar left a comment

Choose a reason for hiding this comment

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

code mostly looks good. My main concern is with the downsample parameter in the CurveCurveDistance class. If there is another, cleaner, approach to reducing the computational cost of the CurveCurveDistance, it is welcome.

"""
return self.curve.num_dofs()

def centroid(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Im a bit confused here. It seems like the right thing to do is for the Curve class to have a centroid function, and the JaxCurve class to have centroid_pure. Then the RotataedCurve can just inherit from Curve, right?

@landreman
Copy link
Contributor

Looks good to me now. But ugh the CI is failing now for some reason that's probably unrelated to this PR. Let's see if we can fix the CI in the ml/fix_CI_20250710 branch (derived from master)

@akaptano
Copy link
Contributor Author

akaptano commented Jul 10, 2025

@landreman @mbkumar Suddenly the C++ build seems to be failing here, on code that I have not touched. Any idea why? Oops sorry just saw your comment Matt, thanks.

@mbkumar
Copy link
Collaborator

mbkumar commented Jul 10, 2025 via email

@akaptano
Copy link
Contributor Author

Thanks. Just fixed that and this PR should be ready for approval.

@landreman landreman self-requested a review July 11, 2025 20:26
@akaptano akaptano merged commit 6391891 into master Jul 11, 2025
48 of 50 checks passed
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.

4 participants