Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

from_values method for FourierRZCoil and FourierPlanarCoil #1116

Merged
merged 34 commits into from
Jul 25, 2024
Merged
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5274d22
add from_values to FourierRZCoil
dpanici Jul 9, 2024
4a870a4
add missing attrs
dpanici Jul 9, 2024
daf8ec4
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 9, 2024
0189243
fix docstring and reorder args to match init
dpanici Jul 9, 2024
9094c1a
Merge branch 'dp/hotfix-fourierrzcoil-from-values' of github.com:Plas…
dpanici Jul 9, 2024
1217503
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
ddudt Jul 15, 2024
ae2997e
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 17, 2024
4ecae78
add from_values for FourierPlanarCurve
daniel-dudt Jul 17, 2024
638baf3
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 18, 2024
fa98655
more robus planar curve fitting
daniel-dudt Jul 18, 2024
bf30b82
undo debugging change
daniel-dudt Jul 18, 2024
9c849de
be explicit about class
daniel-dudt Jul 19, 2024
14f5793
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
ddudt Jul 19, 2024
35beb2c
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
ddudt Jul 19, 2024
2b6b41b
use SVD to compute normal vector
daniel-dudt Jul 22, 2024
21dba61
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
ddudt Jul 22, 2024
2fdf509
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 22, 2024
efff9d1
add tests, allow normals that are parallel to Zaxis
dpanici Jul 23, 2024
0037d50
avoid error if no resolution is passed to to_XXX methods
dpanici Jul 23, 2024
29b35aa
undo unneeded changes in _curve compute
dpanici Jul 23, 2024
7ba36b7
remove white space
dpanici Jul 23, 2024
801832d
modify test to test a non-centered coil
dpanici Jul 23, 2024
f354986
modify test to test a non-centered coil
dpanici Jul 23, 2024
2a1ba00
Merge branch 'dp/hotfix-fourierrzcoil-from-values' of github.com:Plas…
dpanici Jul 23, 2024
6f6ea23
update changelog
dpanici Jul 24, 2024
cbb6543
remove NFP from grid of to_FourierRZ calls
dpanici Jul 24, 2024
d0eb4e0
add basis option for to_FourierPlanar
daniel-dudt Jul 24, 2024
448d239
ocd formatting
daniel-dudt Jul 24, 2024
9614631
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 24, 2024
57688ef
add basis to coil to_planar method, make sure input coordinates match…
dpanici Jul 24, 2024
6147e7f
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 24, 2024
7d2eeae
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
f0uriest Jul 25, 2024
663894b
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
f0uriest Jul 25, 2024
40f355a
Merge branch 'master' into dp/hotfix-fourierrzcoil-from-values
dpanici Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions desc/coils.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,43 @@ def __init__(
):
super().__init__(current, R_n, Z_n, modes_R, modes_Z, NFP, sym, name)

@classmethod
def from_values(cls, current, coords, N=10, NFP=1, basis="rpz", name="", sym=False):
"""Fit coordinates to FourierRZCoil representation.

Parameters
----------
current : float
Current through the coil, in Amps.
coords: ndarray, shape (num_coords,3)
coordinates to fit a FourierRZCurve object with each column
corresponding to xyz or rpz depending on the basis argument.
N : int
Fourier resolution of the new R,Z representation.
NFP : int
Number of field periods, the curve will have a discrete toroidal symmetry
according to NFP.
basis : {"rpz", "xyz"}
basis for input coordinates. Defaults to "rpz"

Returns
-------
coili : FourierRZCoil
New representation of the coil parameterized by Fourier series for R,Z.

"""
curve = super().from_values(coords, N=N, NFP=NFP, basis=basis, sym=sym)
return cls(
current,
R_n=curve.R_n,
Z_n=curve.Z_n,
modes_R=curve.R_basis.modes[:, 2],
modes_Z=curve.Z_basis.modes[:, 2],
NFP=NFP,
sym=curve.sym,
name=name,
)


class FourierXYZCoil(_Coil, FourierXYZCurve):
"""Coil parameterized by fourier series for X,Y,Z in terms of arbitrary angle s.
Expand Down
Loading