pyrokinetics.kinetics.iterdb.KineticsReaderITERDB#
- class pyrokinetics.kinetics.iterdb.KineticsReaderITERDB[source]#
Bases:
FileReader- __init__()#
Methods
__init__()read_from_file(filename[, eq, time_index, ...])Reads an ITERDB/UFILE-style profile file.
verify_file_type(filename)Perform a series of checks on the file to ensure it is valid.
Attributes
- file_type: ClassVar[str] = 'ITERDB'#
- read_from_file(filename, eq=None, time_index=-1, time=None, main_ion='deuterium', main_ion_charge=1.0, main_ion_mass=None, rotation_sign=1.0, use_rhotor_as_rho=False)[source]#
Reads an ITERDB/UFILE-style profile file.
The reader expects profile blocks with
RHOTORas the independent radial coordinate and at leastTE,TI,NEandNM1.VROTis used when present, otherwise the angular rotation is set to zero.
- verify_file_type(filename)[source]#
Perform a series of checks on the file to ensure it is valid. Raises an exception if the file is of the wrong type. Exits normally if the file is valid.
The default implementation simply reads the file, performs the usual processing, and discards the results. This is rarely the best way to verify a file type, so this should be overridden is most cases. In particular, the default implementation should not be used if:
Reading and processing the whole file is computationally expensive.
The read function depends upon keyword arguments.
The read function can read multiple related file types and further information is needed to differentiate between them. For example, multiple gyrokinetics codes use Fortran namelists as input files, so a specialised verify method is needed to check the names stored within to determine which code the input file belongs to.
An exception raised when reading from file should halt the program.
- Parameters:
filename (
PathLike) – The file to be read.- Return type: