pyrokinetics.equilibrium.imas.EquilibriumReaderIMAS#
- class pyrokinetics.equilibrium.imas.EquilibriumReaderIMAS[source]#
Bases:
FileReaderClass that can read IMAS equilibrium h5 files and return
Equilibriumobjects. Users are not recommended to instantiate this class directly, and should instead use the functionsread_equilibriumorEquilibrium.from_file. Keyword arguments passed to those functions will be forwarded to this class.Some IMAS files may not read correctly, as it is not possible to fit a closed contour on the Last Closed Flux Surface (LCFS). In these cases, the user may provide the argument
psi_n_lcfs=0.99(or something similarly close to 1) which adjusts the \(\psi\) grid so that only values in the range \([\psi_\text{axis},\psi_\text{axis}+0.99(\psi_\text{LCFS}-\psi_\text{axis})]\) are included.It is not possible to determine the coordinate system used by an IMAS file from its own data alone. By default, we assume that the toroidal angle \(\phi\) increases in an anti-clockwise direction when the tokamak is viewed from above. If the IMAS file originates from a code that uses the opposite convention, the user should set
clockwise_phitoTrue. Alternatively, if the COCOS convention of the IMAS file is known, this should be supplied to the optionalcocosargument.See also
EquilibriumClass representing a global tokamak equilibrium.
read_equilibriumRead an equilibrium file, return an
Equilibrium.
- __init__()#
Methods
__init__()read_from_file(filename[, time, time_index, ...])Read in IMAS file and populate Equilibrium object.
verify_file_type(filename)Quickly verify that we're looking at a IMAS file without processing
Attributes
- file_type: ClassVar[str] = 'IMAS'#
- read_from_file(filename, time=None, time_index=None, psi_n_lcfs=1.0, clockwise_phi=False, cocos=None)[source]#
Read in IMAS file and populate Equilibrium object. Should not be invoked directly; users should instead use
read_equilibrium.- Parameters:
filename (
PathLike) – Location of the IMAS file on disk.time (
Optional[float]) – The time, in seconds, at which equilibrium data should be taken. Data will be drawn from the time closest to the provided value. Users should only provide one oftimeortime_index. If neither is provided, data is drawn at the last time stamp.time_index (
Optional[int]) – As an alternative to providing the time directly, users may provide the index of the desired time stamp.psi_n_lcfs (
float, default1.0) – Adjust which flux surface we consider to be the last closed flux surface (LCFS). Should take a value between 0.0 and 1.0 inclusive.clockwise_phi (
bool, defaultFalse) – Determines whether the \(\phi\) grid increases clockwise or anti-clockwise when the tokamak is viewed from above.cocos (
Optional[int]) – If set, asserts that the GEQDSK file follows that COCOS convention, and neitherclockwise_phinor the file contents will be used to identify the actual convention in use. The resulting Equilibrium is always converted to COCOS 11.
- Return type:
Equilibrium