Coverage for python/gsfit/database_readers/mock_st40_mdsplus/setup_wall.py: 0%
19 statements
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-14 15:25 +0000
« prev ^ index » next coverage.py v7.16.2, created at 2026-10-14 15:25 +0000
1import typing
2from typing import TYPE_CHECKING
4import numpy as np
5import numpy.typing as npt
6from gsfit_rs import Wall
8from .mock_get_data import MockGetData
10if TYPE_CHECKING:
11 from . import DatabaseReader
14# Merging-compression tiles. These protrude inside the vacuum vessel contour, so the plasma
15# can be limited on them. `MCT` is the top tile and `MCB` the bottom, named after the
16# merging-compression coils they sit in front of
17MCT_TILES_R = np.array([0.7103]) # [metre]
18MCT_TILES_Z = np.array([0.3031]) # [metre]
19MCB_TILES_R = np.array([0.7103]) # [metre]
20MCB_TILES_Z = np.array([-0.3131]) # [metre]
23def setup_wall(
24 self: "DatabaseReader",
25 pulseNo: int,
26 settings: dict[str, typing.Any],
27) -> Wall:
28 """
29 This method initialises the Rust `Wall` class.
31 :param pulseNo: Pulse number, used to read from the database
32 :param settings: Dictionary containing the JSON settings read from the `settings` directory
34 **This method is specific to a mock of ST40's experimental MDSplus database.**
36 See `python/gsfit/database_readers/interface.py` for more details on how a new database_reader should be implemented.
37 """
39 # Vacuum vessel contour, which bounds the region the plasma is allowed to occupy
40 elmag = MockGetData.from_workflow(settings, pulseNo, "elmag")
41 vacuum_vessel_r = typing.cast(npt.NDArray[np.float64], elmag.get("LIMITER.LIMIT_PTS.R"))
42 vacuum_vessel_z = typing.cast(npt.NDArray[np.float64], elmag.get("LIMITER.LIMIT_PTS.Z"))
44 # Initialise the Wall Rust class
45 wall = Wall()
47 # `unit(0)` must be the vacuum vessel contour: the solver reads the limiter units by
48 # position, and uses the first one, and only the first one, as the region the plasma is
49 # allowed to occupy. Every unit contributes candidate limit points
50 wall.add_limiter_unit(name="vacuum_vessel", r=vacuum_vessel_r, z=vacuum_vessel_z)
51 wall.add_limiter_unit(name="mct_tiles", r=MCT_TILES_R, z=MCT_TILES_Z)
52 wall.add_limiter_unit(name="mcb_tiles", r=MCB_TILES_R, z=MCB_TILES_Z)
54 return wall