Skip to content

Commit

Permalink
Add coil names and types
Browse files Browse the repository at this point in the history
  • Loading branch information
je-cook committed Jul 3, 2024
1 parent 3a9c8c7 commit a445a7b
Show file tree
Hide file tree
Showing 5 changed files with 1,894 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repos:
exclude: test_data

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.8
rev: v0.5.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
2 changes: 1 addition & 1 deletion eqdsk/cocos.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def identify_cocos(
raise ValueError(
"The sign of qpsi is not consistent across the flux surfaces.",
)
sign_q = Sign(sign_q.max())
sign_q = Sign(int(sign_q.max()) or 1)

sign_Bp = sign_Ip * sign_psi_inc_towards_boundary
sign_rho_theta_phi = sign_Ip * sign_B0 * sign_q
Expand Down
6 changes: 5 additions & 1 deletion eqdsk/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ class EQDSKInterface:
"""Safety factor values on the 1-D flux grid [dimensionless]."""
file_name: str | None = None
"""The EQDSK file the data originates from."""
coil_names: list[str] | None = None
"""Name of the coils"""
coil_types: list[str] | None = None
"""Type of the coils"""

def __post_init__(self):
"""Calculate derived parameters if they're not given."""
Expand Down Expand Up @@ -332,7 +336,7 @@ def _read_json(file_path: Path) -> dict[str, Any]:
data = json.load(file)

for k, value in data.items():
if isinstance(value, list):
if isinstance(value, list) and k not in {"coil_type", "coil_names"}:
data[k] = np.asarray(value)

# For backward compatibility where 'psinorm' was sometimes 'pnorm'
Expand Down
Loading

0 comments on commit a445a7b

Please sign in to comment.