Diagnostic modelling

The tokamesh.diagnostics module contains tools for generating lines-of-sight used as part of diagnostic models.

tokamesh.diagnostics.radial_fan(n_lines: int, poloidal_position: tuple[float, float], phi: float, angle_range: tuple[float, float]) tuple[numpy.ndarray, numpy.ndarray]

Generate a fan of lines-of-sight which are purely radial (i.e. have a constant toroidal angle).

Parameters
  • n_lines – The number of lines-of-sight in the fan.

  • poloidal_position – The (R, z) position of the origin point of the fan as a tuple of two floats.

  • phi – The toroidal angle of the fan.

  • angle_range – The range of angles in the poloidal plane over which the fan is spread as a tuple of two floats.

Returns

The ray origins and the ray directions as a pair of numpy arrays.

tokamesh.diagnostics.find_ray_boundary_intersections(R_boundary: ndarray, z_boundary: ndarray, ray_origins: ndarray, ray_directions: ndarray, min_distance: float = 0.0) ndarray

Calculate the end-points of a series of lines-of-sight based on the first position along each line which intersects with a polygon representing the machine boundary.

Parameters
  • R_boundary – The major radius values of the boundary polygon as a 1D numpy array.

  • z_boundary – The z-height values of the boundary polygon as a 1D numpy array.

  • ray_origins – The (x,y,z) position vectors of the origin of each ray (i.e. line-of-sight) as a 2D numpy array. The array must have shape (M,3) where M is the total number of rays.

  • ray_directions – The (x,y,z) direction unit-vectors of each ray (i.e. line-of-sight) as a 2D numpy array. The array must have shape (M,3) where M is the total number of rays.

  • min_distance – The minimum allowed distance of an intersection point from the ray origin. Any intersections with the boundary at a distance less than this value are ignored.