class documentation

class API:

View In Hierarchy

API class.

Static Method export_hdf5 Exports data to an HDF5 container.
Static Method export_wire Exports wire points to a TXT file.
Static Method import_hdf5 Imports data from an HDF5 container.
Static Method import_wire Imports wire points from a TXT file.
Static Method _dict_to_hdf5_group Recursively transforms a dictionary into an HDF5 group (in-place).
Static Method _hdf5_group_to_dict Recursively transforms an HDF5 group into a dictionary (in-place).
@staticmethod
def export_hdf5(filename: str, data: dict | MagnetiCalc_Data):

Exports data to an HDF5 container.

Takes a dictionary and writes an HDF5 file using keys as keys, and items as groups if they are dictionaries or as datasets otherwise.

Parameters
filename:strFilename
data:dict | MagnetiCalc_DataDictionary or MagnetiCalc_Data object
@staticmethod
def export_wire(filename: str, data: list | np.ndarray):

Exports wire points to a TXT file.

Parameters
filename:strFilename
data:list | np.ndarrayNumPy array of 3D points
@staticmethod
def import_hdf5(filename: str) -> MagnetiCalc_Data:

Imports data from an HDF5 container.

Opens an HDF5 file and converts every group and subgroup into a dictionary where the keys are the group keys and the items are the datasets.

Parameters
filename:strFilename
Returns
MagnetiCalc_DataMagnetiCalc_Data object (can be accessed like a dictionary)
@staticmethod
def import_wire(filename: str) -> np.ndarray:

Imports wire points from a TXT file.

Parameters
filename:strFilename
Returns
np.ndarrayNumPy array of 3D points
@staticmethod
def _dict_to_hdf5_group(hdf5_group: h5py.Group, dictionary: dict):

Recursively transforms a dictionary into an HDF5 group (in-place).

Parameters
hdf5_group:h5py.GroupHDF5 group
dictionary:dictDictionary
@staticmethod
def _hdf5_group_to_dict(hdf5_group: h5py.Group, dictionary: dict):

Recursively transforms an HDF5 group into a dictionary (in-place).

Parameters
hdf5_group:h5py.GroupHDF5 group
dictionary:dictDictionary