Skip to content

Commit

Permalink
fix cc vs cs signs
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-dudt committed Jul 18, 2024
1 parent faec654 commit fff94cd
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions desc/input_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1335,44 +1335,44 @@ def parse_vmec_inputs(vmec_fname, threshold=0): # noqa: C901 - FIXME: simplify
)
inputs["axis"][-1, :] = np.array([n, -numbers[k], 0.0])
match = re.search(
r"ZAXIS_CC\s*=(\s*" + num_form + r"\s*,?)*", command, re.IGNORECASE
r"ZAXIS(_CS)?\s*=(\s*" + num_form + r"\s*,?)*", command, re.IGNORECASE
)
if match:
numbers = [
float(x)
for x in re.findall(num_form, match.group(0))
if re.search(r"\d", x)
]
for k in range(len(numbers)):
n = k
# ignore the n=0 since it should always be zero for sin terms
for k in range(1, len(numbers)):
n = -k
idx = np.where(inputs["axis"][:, 0] == n)[0]
if np.size(idx):
inputs["axis"][idx[0], 2] = numbers[k]
inputs["axis"][idx[0], 2] = -numbers[k]
else:
inputs["axis"] = np.pad(
inputs["axis"], ((0, 1), (0, 0)), mode="constant"
)
inputs["axis"][-1, :] = np.array([n, 0.0, numbers[k]])
inputs["axis"][-1, :] = np.array([n, 0.0, -numbers[k]])

Check warning on line 1356 in desc/input_reader.py

View check run for this annotation

Codecov / codecov/patch

desc/input_reader.py#L1356

Added line #L1356 was not covered by tests
match = re.search(
r"ZAXIS_(CS)?\s*=(\s*" + num_form + r"\s*,?)*", command, re.IGNORECASE
r"ZAXIS_CC\s*=(\s*" + num_form + r"\s*,?)*", command, re.IGNORECASE
)
if match:
numbers = [
float(x)
for x in re.findall(num_form, match.group(0))
if re.search(r"\d", x)
]
# ignore the n=0 since it should always be zero for sin terms
for k in range(1, len(numbers)):
n = -k
for k in range(len(numbers)):
n = k
idx = np.where(inputs["axis"][:, 0] == n)[0]
if np.size(idx):
inputs["axis"][idx[0], 2] = -numbers[k]
inputs["axis"][idx[0], 2] = numbers[k]
else:
inputs["axis"] = np.pad(
inputs["axis"], ((0, 1), (0, 0)), mode="constant"
)
inputs["axis"][-1, :] = np.array([n, 0.0, -numbers[k]])
inputs["axis"][-1, :] = np.array([n, 0.0, numbers[k]])

Check warning on line 1375 in desc/input_reader.py

View check run for this annotation

Codecov / codecov/patch

desc/input_reader.py#L1375

Added line #L1375 was not covered by tests

# boundary shape
# RBS*sin(m*t-n*p) = RBS*sin(m*t)*cos(n*p) - RBS*cos(m*t)*sin(n*p)
Expand Down

0 comments on commit fff94cd

Please sign in to comment.