fedoo.DataSet
- class DataSet(mesh: Mesh | None = None, data: dict | None = None, data_type: str = 'node')
Object to store, save, load and plot data associated to a mesh.
DataSet have a multiframe version
fedoo.MultiFrameDataSet
that is a class that encapsulate several DataSet mainly usefull for time dependent data.- mesh
Mesh object associated to the data
- Type:
fd.Mesh
- node_data
Dictionnary of data fields defined at mesh nodes.
- Type:
dict
- element_data
Dictionnary of data fields defined at mesh elements.
- Type:
dict
- gausspoint_data
Dictionnary of data fields defined at gauss points.
- Type:
dict
- res.scalar_data
Dictionnary of scalar data.
- Type:
dict
Notes
Data in the node_data, element_data or gauspoint_data dictionarries should be provided as 1D or 2D NumPy arrays, where the last dimension matches the number of nodes, elements or integration points in the associated mesh, respectively.
For gausspoint_data, the number of Gauss points per element is assumed to be constant and is inferred from the array’s shape.
If 2D NumPy arrays are provided, or 1D for scalar data, the first dimension corresponds to the data components.
To access data, it is recommended to use the
fedoo.DataSet.get_data()
method as it supports automatic conversion between different data types.- Parameters:
mesh (Mesh, optional) – Mesh object associated to the data. The default is None.
data (dict, optional) – dict containing the data. The default is None.
data_type (str in {'node', 'element', 'gausspoint', 'scalar', 'all'}) – type of data. The default is ‘node’.
- __init__(mesh: Mesh | None = None, data: dict | None = None, data_type: str = 'node') None
Methods
DataSet.__getitem__
(items)DataSet.add_data
(data_set)Update the DataSet object including all the node, element and gausspoint data from antoher DataSet object data_set.
DataSet.get_data
(field[, component, ...])Retrieve data from the DataSet for a given field.
DataSet.load
(data[, load_mesh, iteration])Load data from a data object.
DataSet.load_dict
(data)Load data from a dict generated with the to_dict method.
DataSet.plot
([field, component, data_type, ...])Plot a field on the surface of the associated mesh.
DataSet.read
(filename[, file_format])DataSet.save
(filename[, save_mesh, compressed])Save data to a file.
DataSet.save_mesh
(filename)Save the mesh using a vtk file.
DataSet.savez
(filename[, save_mesh])Write a npz file using the numpy savez function.
DataSet.savez_compressed
(filename[, save_mesh])Write a compressed npz file using the numpy savez_compressed function.
DataSet.to_csv
(filename[, save_mesh])Write data in a csv file.
Return a dict with all the node, element and gausspoint data.
DataSet.to_excel
(filename[, save_mesh])Write data in a xlsx file (excel format).
DataSet.to_fdz
(filename[, save_mesh, ...])Write a fdz file from the dataset.
DataSet.to_msh
(filename)Write a msh (gmsh format) file with the mesh and associated data (gausspoint data not included).
DataSet.to_pyvista
([gp_data_to_node])DataSet.to_vtk
(filename[, binary, ...])Write vtk file with the mesh and associated data.