As plasma physics research for fusion energy transitions to an increasing emphasis on cross-machine collaboration and numerical simulation, it becomes increasingly important that portable tools be developed to enable data from diverse sources to be analyzed in a consistent manner. This paper presents eqtools, a modular, extensible, open-source toolkit implemented in the Python programming language for handling magnetic equilibria and associated data from tokamaks. eqtools provides a single interface for working with magnetic equilibrium data, both for handling derived quantities and mapping between coordinate systems, extensible to function with data from different experiments, data formats, and magnetic reconstruction codes, replacing the diverse, non-portable solutions currently in use. Moreover, while the open-source Python programming language offers a number of advantages as a scripting language for research purposes, the lack of basic tokamak-specific functionality has impeded the adoption of the language for regular use. Implementing equilibrium-mapping tools in Python removes a substantial barrier to new development in and porting legacy code into Python. In this paper, we introduce the design of the eqtools package and detail the workflow for usage and expansion to additional devices. The implementation of a novel three-dimensional spline solution (in two spatial dimensions and in time) is also detailed. Finally, verification and benchmarking for accuracy and speed against existing tools are detailed. Wider deployment of these tools will enable efficient sharing of data and software between institutions and machines as well as self-consistent analysis of the shared data. Program summaryProgram title: eqtoolsCatalogue identifier: AFBK_v1_0Program summary URL:http://cpc.cs.qub.ac.uk/summaries/AFBK_v1_0.htmlProgram obtainable from: CPC Program Library, Queen’s University, Belfast, N. IrelandLicensing provisions: GNU GPL v3No. of lines in distributed program, including test data, etc.: 27204No. of bytes in distributed program, including test data, etc.: 1217844Distribution format: tar.gzProgramming language: Python, C.Computer: PCs.Operating system: Linux, Macintosh OS X, Microsoft Windows.RAM: Several megabytes, depends on resolution of dataClassification: 19.4.External routines: F2PY [1], matplotlib [2], MDSplus [3], NumPy [4], SciPy [5]Nature of problem:Access to results from magnetic equilibrium reconstruction code, conversion between various coordinate systems tied to the magnetic equilibrium.Solution method:Data are stored in an object-oriented data structure with human-readable getter methods. Coordinates are converted using bivariate or trivariate splines.Running time:Coordinate transformations on a 66x66 point spatial grid take between 1 and 5 ms per time slice, depending on the transformation used and how many intermediate results have been stored.
Read full abstract