Load.slices#
- pyPLUTO.Load.slices(self, var: ndarray[tuple[Any, ...], dtype[_ScalarT]], check: bool = True, diag: bool | None = None, x1: int | list | None = None, x2: int | list | None = None, x3: int | list | None = None, **kwargs: Any) ndarray[source]#
Function that slices the variable in the 3 directions. Also, it can slice the diagonal of the variable.
- Parameters:
- - axis1: int | None, default None
Axis to be used as the first axis of the 2-D sub-arrays from which the diagonals should be taken. Defaults to first axis (0).
- - axis2: int | None, default None
Axis to be used as the second axis of the 2-D sub-arrays from which the diagonals should be taken. Defaults to second axis (1).
- - diag: bool | None, default None
If not None (or ‘min’), slice the main diagonal of the variable. If ‘min’, slice the opposite diagonal.
- - offset: int | None, default None
Offset of the diagonal from the main diagonal. Can be positive or negative. Defaults to main diagonal (0).
- - var: np.ndarray
The variable to slice.
- - x1: int | list | None, default None
The slice in the 1st direction.
- - x2: int | list | None, default None
The slice in the 2nd direction.
- - x3: int | list | None, default None
The slice in the 3rd direction.
- —-
- Returns:
- newvar: NDArray
The sliced variable.
Examples
Example #1: Slice the variable in the 3 directions
>>> slices(var, x1=0, x2=0, x3=0)
Example #2: Slice the variable in the diagonal
>>> slices(var, diag=True)
Example #3: Slice the variable in the opposite diagonal
>>> slices(var, diag="min")