Load.mirror#

TransformManager.mirror(var: ndarray, dirs: str | list = 'l', xax: ndarray | None = None, yax: ndarray | None = None) list[ndarray][source]

Mirror the variable in the specified directions.

Multiple directions can be specified.

Parameters:
- dirs: str | list, default ‘l’

The directions to mirror the variable. Can be ‘l’, ‘r’, ‘t’, ‘b’ or a list or combination of them.

- var: np.ndarray

The variable to mirror.

- xax: np.ndarray | None, default None

The x-axis to mirror.

- yax: np.ndarray | None, default None

The y-axis to mirror.

Returns:
  • newvar: np.ndarray

    The mirrored variable.

  • xax: np.ndarray

    The mirrored x-axis.

  • yax: np.ndarray

    The mirrored y-axis.

Examples

  • Example #1: Mirror the variable in the left direction

    >>> mirror(var, dirs="l")
    
  • Example #2: Mirror the variable in the right direction with axis

    >>> mirror(var, dirs="r", xax=xax)
    
  • Example #3: Mirror the variable in the top and left directions

    >>> mirror(var, dirs=["t", "l"])
    
  • Example #4: Mirror the variable in the top and left directions (no

    list)

    >>> mirror(var, dirs="tl")
    
  • Example #5: Mirror the variable in the left direction three times

    >>> mirror(var, dirs="lll")