CADETProcess.solution.slice_solution

Contents

CADETProcess.solution.slice_solution#

CADETProcess.solution.slice_solution(solution_original: SolutionBase, components: str | list[str] | None = None, use_total_concentration: bool | None = False, use_total_concentration_components: bool | None = False, coordinates: dict[str, tuple[int | None, int | None] | None] | None = None) SolutionBase[source]#

Slice a Solution object along specified dimensions, components or both.

Parameters:
solution_originalSolutionBase

The Solution object to slice.

componentsOptional[str | list[str]]

The names of the components to keep in the sliced Solution. If None, all components are kept. The default is None.

use_total_concentrationOptional[bool], default=False

If True, only the total concentration data is kept in the sliced Solution.

use_total_concentration_componentsOptional[bool], default=False

If True, the total concentration data is kept for each individual species of each component in the sliced Solution.

coordinatesOptional[dict[str, Optional[tuple[Optional[int], Optional[int]]]]]

A dictionary mapping dimensions to slice coordinates. Each dimension in the solution object is represented by a key in the dictionary, and the corresponding value is a tuple of two elements specifying the start and end coordinates of the slice along that dimension. If a value is None, the corresponding coordinate is not sliced.

Returns:
SolutionBase

A new solution object representing the sliced data.

Raises:
ValueError

If any of the slice coordinates exceeds the bounds of its corresponding dimension.

CADETProcessError

If any of the specified components or dimensions does not exist in the original solution.