From 71eeefde4ef9f1ee01fcb79b02bb84ac5b4c6423 Mon Sep 17 00:00:00 2001 From: Dario Panici Date: Mon, 26 Aug 2024 23:40:41 -0400 Subject: [PATCH] allow kwargs in from_input_file --- desc/geometry/curve.py | 6 +++++- desc/geometry/surface.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/desc/geometry/curve.py b/desc/geometry/curve.py index e2c583ea6f..2e141710fb 100644 --- a/desc/geometry/curve.py +++ b/desc/geometry/curve.py @@ -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 ------- @@ -227,6 +230,7 @@ def from_input_file(cls, path): inputs["axis"][:, 0].astype(int), inputs["NFP"], inputs["sym"], + **kwargs, ) return curve diff --git a/desc/geometry/surface.py b/desc/geometry/surface.py index 79f1b871a9..2f74200aaa 100644 --- a/desc/geometry/surface.py +++ b/desc/geometry/surface.py @@ -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 ------- @@ -328,6 +331,7 @@ def from_input_file(cls, path): inputs["surface"][:, 1:3].astype(int), inputs["NFP"], inputs["sym"], + **kwargs, ) return surf