mammos_entity.operations#
Entities operations.
Functions
|
Concatenate objects into a unique flat Entity. |
- mammos_entity.operations.concat_flat(*elements, unit=None, description=None)[source]#
Concatenate objects into a unique flat Entity.
At least one of the inputs must be an Entity with a ontology_label. The unit of the first Entity is accepted unless the optional argument unit is defined.
Arrays are flattened according to
numpy.flatten()inorder="C".- Parameters:
*elements (Entity | Quantity | ArrayLike) – object arguments to be concatenated.
unit (Unit | str | None) – If specified, all values are converted to this unit.
description (str | None) – If specified, this description string is assigned to the resulting entity. If not specified, all unique descriptions from the input entities are collected and concatenated (separated by |). The order of the collected descriptions might change.
- Return type:
Examples
>>> import mammos_entity as me >>> import mammos_units as u >>> Ms = me.Ms([500, 600], "kA/m") >>> me.operations.concat_flat(Ms, 0.3, 700000 * u.A / u.m, unit="MA/m", description="Merge XRD and literature values") Entity(ontology_label='SpontaneousMagnetization', value=array([0.5, 0.6, 0.3, 0.7]), unit='MA / m', description='Merge XRD and literature values')