freegs.dump.OutputFile#
- class freegs.dump.OutputFile(name, mode=None, **kwds)[source]#
Bases:
objectRead/write freegs Equilibrium objects to file
Currently supports HDF5 format only
Given an Equilibrium object, eq, write to file like:
>>> with freegs.OutputFile("test_readwrite.h5", 'w') as f: ... f.write_equilibrium(eq)
Read back into an Equilibrium like so:
>>> with freegs.OutputFile("test_readwrite.h5", 'r') as f: ... eq = f.read_equilibrium()
- Parameters:
name (
str) – Name of file to openmode (
str) –- Mode string to pass to h5py.File, one of:
r - Read-only, file must exist r+ - Read-write, file must exist w - Create file, truncate if exists w- - Create file, fail if exists a - Read-write if exists, create otherwise
**kwds – Other keyword arguments to pass to h5py.File
Methods
__init__(name[, mode])close()Close the file
Read an equilibrium from the file
write_equilibrium(equilibrium)Write
equilbriumto fileAttributes
- COILS_GROUP_NAME = 'coils'#
- EQUILIBRIUM_GROUP_NAME = 'equilbrium'#
- MACHINE_GROUP_NAME = 'tokamak'#