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

Allow kwargs to be passed in from_input_file method #1226

Merged
merged 5 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 5 additions & 1 deletion desc/geometry/curve.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,16 @@ def Z_n(self, new):
)

@classmethod
def from_input_file(cls, path):
def from_input_file(cls, path, **kwargs):
"""Create a axis curve from Fourier coefficients in a DESC or VMEC input file.

Parameters
----------
path : Path-like or str
Path to DESC or VMEC input file.
**kwargs : dict, optional
keyword arguments to pass to the constructor of the
FourierRZCurve being created.

Returns
-------
Expand All @@ -227,6 +230,7 @@ def from_input_file(cls, path):
inputs["axis"][:, 0].astype(int),
inputs["NFP"],
inputs["sym"],
**kwargs,
)
return curve

Expand Down
6 changes: 5 additions & 1 deletion desc/geometry/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,16 @@ def set_coeffs(self, m, n=0, R=None, Z=None):
self.Z_lmn = put(self.Z_lmn, idxZ, ZZ)

@classmethod
def from_input_file(cls, path):
def from_input_file(cls, path, **kwargs):
"""Create a surface from Fourier coefficients in a DESC or VMEC input file.

Parameters
----------
path : Path-like or str
Path to DESC or VMEC input file.
**kwargs : dict, optional
keyword arguments to pass to the constructor of the
FourierRZToroidalSurface being created.

Returns
-------
Expand All @@ -328,6 +331,7 @@ def from_input_file(cls, path):
inputs["surface"][:, 1:3].astype(int),
inputs["NFP"],
inputs["sym"],
**kwargs,
)
return surf

Expand Down
Loading