report.Grouper#

class Grouper#

Bases: Flow360BaseModel

Class for objects responsible for grouping data into series in Chart2D.

Example

  • Data will be grouped by each turbulence model and then by the first tag,

    if the first tag is “a” or “b” the data point will be assigned to group “bucket0”, if the first tag is “c” the data point will be assigned to “bucket1”

>>> Grouper(
...     group_by=["params/models/Fluid/turbulence_model_solver/type_name", "info/tags/0"],
...     buckets=[None, {"bucket0": ["a", "b"], "bucket1": ["c"]}],
... )

Attributes

group_by: str | list[str] | list[None], optional#

The path to the data attribute (or paths to attributes in case of multi-level grouping) by which the grouping should be done.

buckets: Union[dict[str, List], List[Optional[dict[str, List]]], NoneType]#

Dictionaries where key represents the name of the group and value is the list of values, that belong to the group. If all the values should be unique, enter None for the corresponding bucket.

Default:

None

Additional Constructors

classmethod from_file(filename)#

Loads a Flow360BaseModel from .json, or .yaml file.

Parameters:

filename (str) – Full path to the .yaml or .json file to load the Flow360BaseModel from.

Returns:

An instance of the component class calling load.

Return type:

Flow360BaseModel

Example

>>> params = Flow360BaseModel.from_file(filename='folder/sim.json') 

Methods

initialize_arrays(cases, y_variables)#

Initializes data structures for x_data and y_data.

arrange_data(case, x_data, y_data, x_data_point, y_data_point, y_variable)#

Sorts the data into appropriate series based on the case.

arrange_legend()#

Creates the legend for the defined grouping.

help(methods=False)#

Prints message describing the fields and methods of a Flow360BaseModel.

Parameters:

methods (bool = False) – Whether to also print out information about object’s methods.

Return type:

None

Example

>>> params.help(methods=True) 
to_file(filename, **kwargs)#

Exports Flow360BaseModel instance to .json or .yaml file

Parameters:

filename (str) – Full path to the .json or .yaml or file to save the Flow360BaseModel to.

Return type:

None

Example

>>> params.to_file(filename='folder/flow360.json')