pencil.math.transform

Routines to transform coordinates and fields.

Functions

coordinate_transformation(x, y, z[, xyz_from, xyz_to])

coordinate_transformation(x, y, z, xyz_from='', xyz_to='')

vector_field_transformation(field, x, y, z[, ...])

vector_field_transformation(field, x, y, z, xyz_from='', xyz_to='')

pospolar2cart(r, th)

Transform from polar to cartesian coordinates

velpolar2cart(vr, vth, r, th[, zcoord])

Transform from polar velocities to cartesian velocities

Module Contents

pencil.math.transform.coordinate_transformation(x, y, z, xyz_from='', xyz_to='')

coordinate_transformation(x, y, z, xyz_from=’’, xyz_to=’’)

Tranform coordinates between coordinate systems. Returns a tuple (x, y, z).

Parameters:
  • x (1d ndarray) – Input coordinates.

  • y (1d ndarray) – Input coordinates.

  • z (1d ndarray) – Input coordinates.

  • xyz_from (string) – Origin coordinate system: ‘cartesian’, ‘cylindrical’ and ‘spherical’.

  • xyz_to (string) – Destination coordinate system: ‘cartesian’, ‘cylindrical’ and ‘spherical’.

Return type:

Tuple of 3 ndarrays containing the transformed coordinates.

pencil.math.transform.vector_field_transformation(field, x, y, z, xyz_from='', xyz_to='')

vector_field_transformation(field, x, y, z, xyz_from=’’, xyz_to=’’)

Transform a vector field from one coordinate system to another.

Parameters:
  • field (4d ndarray) – Vector field.

  • x (1d ndarrays) – Input coordinates of the ‘from’ system.

  • y (1d ndarrays) – Input coordinates of the ‘from’ system.

  • z (1d ndarrays) – Input coordinates of the ‘from’ system.

  • xyz_from (string) – Origin coordinate system: ‘cartesian’, ‘cylindrical’ and ‘spherical’.

  • xyz_to (string) – Destination coordinate system: ‘cartesian’, ‘cylindrical’ and ‘spherical’.

Return type:

ndarray with the transformed vector field.

pencil.math.transform.pospolar2cart(r, th)

Transform from polar to cartesian coordinates

pencil.math.transform.velpolar2cart(vr, vth, r, th, zcoord=0)

Transform from polar velocities to cartesian velocities

call signature:

velpolar2cart(vr, vth, r, th, zcoord=0)

Keyword arguments:

vr:

3D array of velocities in radial direction

vth:

3D array of velocities in theta direction

r

coordinates in radial direction

th

coordinates in theta direction

zcoord

plane in z-dir