Skip to content
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
11 changes: 6 additions & 5 deletions process/core/caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def __init__(self, models: Models, data: DataStructure):
variables are fully initialised with consistent values, the models are
called with the initial optimisation parameters, x.

:param models: physics and engineering model objects
:type models: Models
:param data: data structure object to be passed on to the constraint
evaluators
:type data: DataStructure
Parameters
----------
models :
physics and engineering model objects
data :
Comment on lines +38 to +42
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This conversion to Numpy-style docstring removed the parameter types (even though other docstrings in this file include them, e.g. previous : float | np.ndarray). Consider using models : Models and data : DataStructure for consistency and better doc rendering.

Copilot uses AI. Check for mistakes.
data structure object to be passed on to the constraint evaluators
"""
self.models = models
self.data = data
Expand Down
8 changes: 5 additions & 3 deletions process/core/io/in_dat/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,14 +1708,16 @@ class StructuredInputData:
self.data["parameters"]["physics_variables"]["i_plasma_geometry"]["value"] = 0
"""

def __init__(self, filename="IN.DAT"):
def __init__(self, filename: str = "IN.DAT"):
"""Use InDat to create the data dict.

Use InDat to read in an input file and store the data, then construct a
structured input data dict from it.

:param filename: input data filename, defaults to "IN.DAT"
:type filename: str, optional
Parameters
----------
filename :
Input data filename, defaults to "IN.DAT"
"""
self.data = {}
# Structured input data dict
Expand Down
10 changes: 6 additions & 4 deletions process/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ class ProcessLogHandler(Handler):
the handler or using the methods start_capturing/stop_capturing.
"""

def __init__(self, capturing=True):
"""Instantiates a ProcessLogHandler.
def __init__(self, capturing: bool = True):
"""Instantiate a ProcessLogHandler.

:param capturing: capture and store emitted logs?
:type capturning: bool
Parameters
----------
capturing :
Whether to capture and store emitted logs, by default True
"""
super().__init__()
self._logs = []
Expand Down
22 changes: 15 additions & 7 deletions process/core/scan.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import annotations

import logging
import time
from dataclasses import astuple, dataclass
from enum import Enum
from typing import TYPE_CHECKING

import numpy as np
from tabulate import tabulate
Expand Down Expand Up @@ -30,6 +33,9 @@
tfcoil_variables,
)

if TYPE_CHECKING:
from process.core.model import DataStructure, Model

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -194,15 +200,17 @@ def _missing_(cls, var):
class Scan:
"""Perform a parameter scan using the Fortran scan module."""

def __init__(self, models, solver, data):
def __init__(self, models: Model, solver: str, data: DataStructure):
"""Immediately run the run_scan() method.

:param models: physics and engineering model objects
:type models: process.main.Models
:param solver: which solver to use, as specified in solver.py
:type solver: str
:param data: data structure object
:type data: DataStructure
Parameters
----------
models :
Physics and engineering model objects
solver :
Which solver to use, as specified in solver.py
data :
Data structure object
"""
self.models = models
self.solver = solver
Expand Down
18 changes: 10 additions & 8 deletions process/core/solver/evaluators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy as np

from process.core.caller import Caller
from process.core.model import DataStructure
from process.data_structure import cost_variables as cv
from process.data_structure import global_variables as gv
from process.data_structure import numerics
Expand All @@ -16,16 +17,17 @@
class Evaluators:
"""Calls models to evaluate function and gradient functions."""

def __init__(self, models, data, _x):
def __init__(self, models, data: DataStructure, _x: np.ndarray):
"""Instantiate Caller with model objects.

:param models: physics and engineering model objects
:type models: process.main.Models
:param data: data structure object for providing constraint
data to the Caller
:type data: DataStructure
:param x: optimisation parameters
:type x: np.ndarray
Parameters
----------
models :
Physics and engineering model objects
data :
Data structure object for providing constraint data to the Caller
_x :
Optimisation parameters
"""
self.caller = Caller(models, data)

Expand Down
151 changes: 79 additions & 72 deletions process/models/blankets/blanket_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -1461,16 +1461,19 @@ def thermo_hydraulic_model_pressure_drop_calculations(self, output: bool):
def calculate_dshaped_inboard_blkt_segment_poloidal(
dz_blkt_half: float, n_blkt_inboard_modules_poloidal: int
) -> float:
"""Calculations for D-shaped inboard blanket module poloidal segment length
"""Calculate D-shaped inboard blanket module poloidal segment length.

:param dz_blkt_half: Half-height of the blanket module (m)
:type dz_blkt_half: float
:param n_blkt_inboard_modules_poloidal: Number of inboard blanket modules in poloidal direction
:type n_blkt_inboard_modules_poloidal: int

:return: Segment length of inboard blanket module in poloidal direction (m)
:rtype: float
Parameters
----------
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction

Returns
-------
:
Comment on lines +1468 to +1475
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this file, other Numpy-style docstrings use param : type (e.g. z_plasma_xpoint_lower : float). These new parameter entries omit the type, which is inconsistent and can reduce doc rendering quality. Consider adding the types after the colon.

Suggested change
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
Returns
-------
:
dz_blkt_half : float
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal : int
Number of inboard blanket modules in poloidal direction
Returns
-------
float

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder rather than a return type. Numpydoc expects a type here (e.g. float) so the generated documentation is correct.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwscook Is saying to not put types in the docstring

Segment length of inboard blanket module in poloidal direction (m)
"""
# D-shaped machine
# Segment vertical inboard surface (m)
Expand All @@ -1486,28 +1489,29 @@ def calculate_dshaped_outboard_blkt_segment_poloidal(
n_divertors: int,
f_ster_div_single: float,
) -> float:
"""
Calculations for D-shaped outboard blanket module poloidal segment length

:param n_blkt_outboard_modules_poloidal: Number of outboard blanket modules in poloidal direction
:type n_blkt_outboard_modules_poloidal: int
:param dr_fw_plasma_gap_inboard: Radial gap between inboard first wall and plasma (m)
:type dr_fw_plasma_gap_inboard: float
:param rminor: Minor radius of the plasma (m)
:type rminor: float
:param dr_fw_plasma_gap_outboard: Radial gap between outboard first wall and plasma (m)
:type dr_fw_plasma_gap_outboard: float
:param dz_blkt_half: Half-height of the blanket module (m)
:type dz_blkt_half: float
:param n_divertors: Number of divertors (1 for single null, 2 for double null)
:type n_divertors: int
:param f_ster_div_single: Fractional poloidal length of the divertor in single null configuration
:type f_ster_div_single: float

:return: Segment length of outboard blanket module in poloidal direction (m)
:rtype: float
"""Calculate D-shaped outboard blanket module poloidal segment length.

Parameters
----------
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
rminor :
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration

Returns
-------
:
Comment on lines +1496 to +1513
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameters entries omit the types after the colon (contrast with other functions in this module that use name : float/int). Adding the types will keep docstrings consistent and more reliably parsed by Numpydoc/Sphinx.

Suggested change
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
rminor :
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration
Returns
-------
:
n_blkt_outboard_modules_poloidal : int
Number of outboard blanket modules in poloidal direction
dr_fw_plasma_gap_inboard : float
Radial gap between inboard first wall and plasma (m)
rminor : float
Minor radius of the plasma (m)
dr_fw_plasma_gap_outboard : float
Radial gap between outboard first wall and plasma (m)
dz_blkt_half : float
Half-height of the blanket module (m)
n_divertors : int
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single : float
Fractional poloidal length of the divertor in single null configuration
Returns
-------
float

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder instead of a return type. Please use an explicit type (likely float) so Numpydoc renders the return value correctly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Segment length of outboard blanket module in poloidal direction (m)
"""
# Calculate perimeter of ellipse that defines the internal
# surface of the outboard first wall / blanket
Expand Down Expand Up @@ -1550,29 +1554,31 @@ def calculate_elliptical_inboard_blkt_segment_poloidal(
n_divertors: int,
f_ster_div_single: float,
) -> float:
"""
Calculations for elliptical inboard blanket module poloidal segment length

:param rmajor: Major radius of the plasma (m)
:type rmajor: float
:param rminor: Minor radius of the plasma (m)
:type rminor: float
:param triang: Triangularity of the plasma
:type triang: float
:param dr_fw_plasma_gap_inboard: Radial gap between inboard first wall and plasma (m)
:type dr_fw_plasma_gap_inboard: float
:param dz_blkt_half: Half-height of the blanket module (m)
:type dz_blkt_half: float
:param n_blkt_inboard_modules_poloidal: Number of inboard blanket modules in poloidal direction
:type n_blkt_inboard_modules_poloidal: int
:param n_divertors: Number of divertors (1 for single null, 2 for double null)
:type n_divertors: int
:param f_ster_div_single: Fractional poloidal length of the divertor in single null configuration
:type f_ster_div_single: float

:return: Segment length of inboard blanket module in poloidal direction (m)
:rtype: float
"""Calculate elliptical inboard blanket module poloidal segment length.

Parameters
----------
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Comment on lines +1561 to +1575
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameters entries omit types after the colon, which is inconsistent with other Numpy-style docstrings in this module (e.g. ... : float). Please add the parameter types to match the established format.

Suggested change
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dr_fw_plasma_gap_inboard :
Radial gap between inboard first wall and plasma (m)
dz_blkt_half :
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal :
Number of inboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
rmajor : float
Major radius of the plasma (m)
rminor : float
Minor radius of the plasma (m)
triang : float
Triangularity of the plasma
dr_fw_plasma_gap_inboard : float
Radial gap between inboard first wall and plasma (m)
dz_blkt_half : float
Half-height of the blanket module (m)
n_blkt_inboard_modules_poloidal : int
Number of inboard blanket modules in poloidal direction
n_divertors : int
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single : float

Copilot uses AI. Check for mistakes.
Fractional poloidal length of the divertor in single null configuration

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder instead of a type. For Numpydoc-style docstrings, provide the return type (likely float) so documentation builds cleanly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Segment length of inboard blanket module in poloidal direction (m)
"""
# Major radius where half-ellipses 'meet' (m)
r1 = rmajor - rminor * triang
Expand Down Expand Up @@ -1617,30 +1623,31 @@ def calculate_elliptical_outboard_blkt_segment_poloidal(
n_divertors: int,
f_ster_div_single: float,
) -> float:
"""
Calculations for elliptical outboard blanket module poloidal segment length

:param rmajor: Major radius of the plasma (m)
:type rmajor: float
:param rminor: Minor radius of the plasma (m)
:type rminor: float
:param triang: Triangularity of the plasma
:type triang: float
:param dz_blkt_half: Half-height of the blanket module (m)
:type dz_blkt_half: float
:param dr_fw_plasma_gap_outboard: Radial gap between outboard first wall and plasma (m)
:type dr_fw_plasma_gap_outboard: float
:param n_blkt_outboard_modules_poloidal: Number of outboard blanket modules in poloidal direction
:type n_blkt_outboard_modules_poloidal: int
:param n_divertors: Number of divertors (1 for single null, 2 for double null)
:type n_divertors: int
:param f_ster_div_single: Fractional poloidal length of the divertor in single null configuration
:type f_ster_div_single: float

:return: Segment length of outboard blanket module in poloidal direction (m)
:rtype: float
"""Calculate elliptical outboard blanket module poloidal segment length.

Parameters
----------
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dz_blkt_half :
Half-height of the blanket module (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration

Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section uses : as a placeholder rather than an explicit return type. Please change this to the appropriate type (likely float) for correct Numpydoc rendering.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Comment on lines +1630 to +1649
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These Parameters entries omit types after the colon. This module otherwise uses name : type in Numpy-style docstrings, so add the missing types to keep docs consistent and parsable.

Suggested change
rmajor :
Major radius of the plasma (m)
rminor :
Minor radius of the plasma (m)
triang :
Triangularity of the plasma
dz_blkt_half :
Half-height of the blanket module (m)
dr_fw_plasma_gap_outboard :
Radial gap between outboard first wall and plasma (m)
n_blkt_outboard_modules_poloidal :
Number of outboard blanket modules in poloidal direction
n_divertors :
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single :
Fractional poloidal length of the divertor in single null configuration
Returns
-------
:
rmajor : float
Major radius of the plasma (m)
rminor : float
Minor radius of the plasma (m)
triang : float
Triangularity of the plasma
dz_blkt_half : float
Half-height of the blanket module (m)
dr_fw_plasma_gap_outboard : float
Radial gap between outboard first wall and plasma (m)
n_blkt_outboard_modules_poloidal : int
Number of outboard blanket modules in poloidal direction
n_divertors : int
Number of divertors (1 for single null, 2 for double null)
f_ster_div_single : float
Fractional poloidal length of the divertor in single null configuration
Returns
-------
float

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

Segment length of outboard blanket module in poloidal direction (m)
"""
# Major radius where half-ellipses 'meet' (m)
r1 = rmajor - rminor * triang
Expand Down
12 changes: 8 additions & 4 deletions process/models/ife.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ class IFE(Model):
def __init__(self, availability, costs):
"""Initialises the IFE module's variables

:param availability: a pointer to the availability model, allowing use of availability's variables/methods
:type availability: process.availability.Availability
:param costs: a pointer to the costs model, allowing the use of costs' variables/methods
:type costs: process.costs.Costs
Parameters
----------
availability :
A pointer to the availability model, allowing use of availability's
variables/methods
costs :
A pointer to the costs model, allowing the use of costs'
variables/methods
"""
self.outfile: int = constants.NOUT
self.availability = availability
Expand Down
12 changes: 8 additions & 4 deletions process/models/physics/impurity_radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from process.core import constants
from process.core.exceptions import ProcessError, ProcessValueError
from process.data_structure import impurity_radiation_module
from process.models.physics.plasma_profiles import PlasmaProfile

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -530,10 +531,13 @@ class ImpurityRadiation:
element to find the total impurity radiation loss.
"""

def __init__(self, plasma_profile):
"""
:param plasma_profile: Plasma profile class, parameterises the density and temperature profiles.
:type plasma_profile: Plasma profile class
def __init__(self, plasma_profile: PlasmaProfile):
"""Initialize the ImpurityRadiation class.

Parameters
----------
plasma_profile :
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring was converted to Numpy style but the parameter line omits the type after the colon. Consider using plasma_profile : PlasmaProfile (or a broader protocol/interface type) to match Numpydoc expectations and improve rendered docs.

Suggested change
plasma_profile :
plasma_profile : PlasmaProfile

Copilot uses AI. Check for mistakes.
Parameterises the density and temperature profiles.
"""
self.plasma_profile = plasma_profile
self.rho = plasma_profile.neprofile.profile_x
Expand Down
24 changes: 15 additions & 9 deletions process/models/physics/plasma_current.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,17 +569,23 @@ def calculate_current_coefficient_peng(
"""
Calculate the plasma current scaling coefficient for the Peng scaling from the STAR code.

:param eps: Plasma inverse aspect ratio.
:type eps: float
:param len_plasma_poloidal: Plasma poloidal perimeter length [m].
:type len_plasma_poloidal: float
:param rminor: Plasma minor radius [m].
:type rminor: float
Parameters
----------
eps:
Plasma inverse aspect ratio.
len_plasma_poloidal:
Plasma poloidal perimeter length (m).
rminor:
Comment on lines +574 to +578
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Numpy-style Parameters entries use eps: / len_plasma_poloidal: / rminor: (no space and no type). Numpydoc expects name : type (e.g. eps : float), and this file already uses that format in other docstrings, so this is likely to render poorly or trigger doc build warnings.

Suggested change
eps:
Plasma inverse aspect ratio.
len_plasma_poloidal:
Plasma poloidal perimeter length (m).
rminor:
eps : float
Plasma inverse aspect ratio.
len_plasma_poloidal : float
Plasma poloidal perimeter length (m).
rminor : float

Copilot uses AI. Check for mistakes.
Plasma minor radius (m).

:return: The plasma current scaling coefficient.
:rtype: float
Returns
-------
:
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Returns section is using : as the return type/name placeholder. In Numpydoc this should be a concrete type (e.g. float) so that Sphinx/numpydoc can render it correctly.

Suggested change
:
float

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:
float

The plasma current scaling coefficient.

:references: None
References
----------
None
"""
return (
(1.22 - 0.68 * eps)
Expand Down
Loading