bamboost.core.simulation.series
Module for handling time series data in HDF5 files. The notion of time is used to describe Series, but it can be used for any data that changes with a single parameter.
The default time series is stored at /data in the HDF5 file. You can create additional
series' with Simulation.create_series.
This module provides classes for managing time series data stored in HDF5 files:
- Series: Main class for managing a series, including fields and global values
- FieldData: Handles a particular field (e.g., nodal or element data) and its timesteps
- GlobalData: Manages the global data that varies with time. This refers to data that is not tied to a mesh.
- StepWriter: Helper class for writing data at specific timesteps
The data is organized hierarchically in the HDF5 file with separate sections for field data and global/scalar data. Fields typically represent spatial data like displacements or stresses, while globals are used for scalar quantities like energy or convergence metrics.
Attributes
- log=
BAMBOOST_LOGGER.getChild(__name__)
Classes
Series
(self, simulation, path=PATH_DATA)Arguments:
- simulation:
_Simulation[bamboost._typing._MT] - path:
str=bamboost.constants.PATH_DATA
Attributes:
- _obj:
h5py.h5py.Group - last_step:
typing.Union[int, None] - globals:
GlobalData[bamboost._typing._MT] - values:
numpy.numpy.ndarrayReturn the values of the series. In the default time series, this returns the time values of the steps.
Bases
(self, key)Arguments:
- key
(self) -> int(self) -> list[HDF5Path]Return all the name of the fields in the series.
(self, name) -> FieldData[_MT]Get a field by name.
Arguments:
- name:
strThe name of the field.
(self, *glob) -> list[FieldData[_MT]]Get multiple fields by name or glob pattern. If no arguments are given, all fields are returned.
Arguments:
- glob:
str=()A list of glob patterns to filter the field names.
(self, value=np.nan, step=None) -> StepWriterCreate a new step in the series. If the step is not given, we append one.
Arguments:
- value:
float=numpy.numpy.nanThe value of the step. This is typically the time value.
- step:
typing.Optional[int]=NoneThe step number. If not given, a step is appended after the last one.
(self) -> list[HDF5Path](self)Repr showing the content of the group.
(self) -> Dataset[_MT](self, step, time) -> NoneArguments:
- step:
int - time:
float
StepWriter
(self, series, step)A class to write data for a specific step in a series.
Arguments:
- series:
Series[bamboost._typing.Mutable] - step:
int
Attributes:
- _series=
bamboost.core.simulation.series.StepWriter(series)The series to which the step belongs.
- _step=
bamboost.core.simulation.series.StepWriter(step)The step number.
Bases
(self, name, data, *, mesh_name=DEFAULT_MESH_NAME, field_type=FieldType.NODE) -> NoneAdd a field to the step.
Arguments:
- name:
strThe name of the field.
- data:
ArrayLikeThe data for the field.
- mesh_name:
str=bamboost.constants.DEFAULT_MESH_NAMEThe name of the mesh to which the field belongs.
The type of the field (default: FieldType.NODE). This is only relevant for XDMF writing.
(self, fields, mesh_name=DEFAULT_MESH_NAME, field_type=FieldType.NODE) -> NoneAdd multiple fields to the step.
Arguments:
- mesh_name:
str=bamboost.constants.DEFAULT_MESH_NAMEThe name of the mesh to which the fields belong.
The type of the fields (default: FieldType.NODE). This is only relevant for XDMF writing.
(self, name, data) -> NoneAdd a scalar to the step. Scalar data is typically a single value or a small array. The shape must be consistent across all steps.
Arguments:
- name:
strThe name of the scalar.
- data:
typing.Union[int, float, typing.Iterable]The data for the scalar.
(self, scalars) -> NoneFieldData
(self, series, name)Arguments:
- series:
Series[bamboost._typing._MT] - name:
str
Attributes:
- name:
str=bamboost.core.simulation.series.FieldData(name)
Bases
Group._statusGroup._objGroup._is_valid()Group._group_mapGroup.__setitem__()Group.__delitem__()Group.__contains__()Group._ipython_key_completions_()Group.__iter__()Group._assert_file_map_is_valid()Group.keys()Group.groups()Group.datasets()Group.items()Group._repr_html_()Group.require_self()Group.require_group()Group.require_dataset()Group.add_numerical_dataset()Group.add_dataset()
(self, key) -> np.ndarrayGet data of the field for a specific step or steps using standard slice notation. First index is the step number.
Arguments:
- key:
typing.Union[int, slice, tuple[slice | int, ...]]
(self, step) -> Dataset[_MT]Get the dataset for a specific step without reading the data itself.
Arguments:
- step:
intThe step number.
(self, index) -> intArguments:
- index:
int
(self, step) -> list[str]Arguments:
- step:
slice
GlobalData
(self, series)Arguments:
- series:
Series[bamboost._typing._MT]
Attributes:
- _series=
bamboost.core.simulation.series.GlobalData(series) - df:
pandas.pandas.DataFrame
Bases
Group._statusGroup._objGroup._is_valid()Group._group_mapGroup.__setitem__()Group.__delitem__()Group.__contains__()Group._ipython_key_completions_()Group.__iter__()Group._assert_file_map_is_valid()Group.keys()Group.groups()Group.datasets()Group.items()Group._repr_html_()Group.require_self()Group.require_group()Group.require_dataset()Group.add_numerical_dataset()Group.add_dataset()
(self, key) -> Dataset[_MT]Arguments:
- key:
str
(self, *glob) -> tuple[tuple[np.ndarray, ...], tuple[str, ...]]Get the data for many scalars by name or glob pattern. If no arguments are given, all scalars are read and returned.
Arguments:
- glob:
str=()A list of glob patterns to filter the scalar names.
Bamboost