aces.utilities.emsim.coord

Coordinate transformations

Module Contents

Functions

move_main_beam_from_z_to_x(xyz)

Convert cartesian (x,y,z) with main beam at positive z to cartesian (x,y,z) with main beam at positive x. This is

rotate_field_z_to_x(e_field)

Convert pattern with main beam at positive z to pattern with main beam at positive x. This is

rotate_xyz_about_x(xyz, theta)

Rotate coordinate system (x,y,z) about x axis by theta radians

xyz_to_rtp(xyz)

Convert cartesian (x,y,z) coordinates to spherical (r, theta, phi)

cartesian_to_spherical_basis(xyz)

Calculate spherical coordinate basis for given direction in cartesian basis

project_field_slow(e_field, a_1, a_2, a_3)

Project electric field (pattern) onto given basis

project_field(e_field, a_1, a_2, a_3)

Project electric field (pattern) onto given basis

aces.utilities.emsim.coord.move_main_beam_from_z_to_x(xyz)[source]

Convert cartesian (x,y,z) with main beam at positive z to cartesian (x,y,z) with main beam at positive x. This is equivalent to a 90 degree rotation about the y axis.

Args:

xyz (numpy.ndarray): matrix of cartesian coordinates with one row per point (N_POINTS, 3)

Returns:

rotated_xyz (numpy.ndarray): xyz rotated 90 deg about the Y axis so that the main beam is at positive x instead of positive z

aces.utilities.emsim.coord.rotate_field_z_to_x(e_field)[source]

Convert pattern with main beam at positive z to pattern with main beam at positive x. This is equivalent to a 90 degree rotation about the y axis.

Args:
e_field (numpy.ndarray): matrix of e_field components in cartesian coordinates with one row per point

(N_POINTS, 3)

Returns:

rotated_e_field (numpy.ndarray): e_field rotated 90 deg about the Y axis so that the main beam is at positive x instead of positive z

aces.utilities.emsim.coord.rotate_xyz_about_x(xyz, theta)[source]

Rotate coordinate system (x,y,z) about x axis by theta radians

Args:

xyz (numpy.ndarray): matrix of cartesian coordinates with one row per point (N_POINTS, 3) theta (float): angle of rotation in radians

Returns:

rotated_xyz (numpy.ndarray): xyz rotated by theta radians about the x axis

aces.utilities.emsim.coord.xyz_to_rtp(xyz)[source]

Convert cartesian (x,y,z) coordinates to spherical (r, theta, phi)

Args:

xyz (numpy.ndarray): matrix of cartesian coordinates with one row per point (N_POINTS, 3)

Returns:

rtp: spherical coordinates (r,theta,phi) in radians

aces.utilities.emsim.coord.cartesian_to_spherical_basis(xyz)[source]

Calculate spherical coordinate basis for given direction in cartesian basis

Args:

xyz (numpy.ndarray): matrix of cartesian coordinates with one row per point (N, 3)

Returns:
a_r (numpy.ndarray): matrix of a_r (radius) basis vectors in cartesian coordinates (N, 3) corresponding to

each direction (row) in xyz

a_t (numpy.ndarray): matrix of a_t (theta) basis vectors in cartesian coordinates (N, 3) corresponding to each

direction (row) in xyz

a_p (numpy.ndarray): matrix of a_p (phi) basis vectors in cartesian coordinates (N, 3) corresponding to each

direction (row) in xyz

aces.utilities.emsim.coord.project_field_slow(e_field, a_1, a_2, a_3)[source]

Project electric field (pattern) onto given basis

Args:
e_field (numpy.ndarray): (M,N,3) complex valued electric field with 3 vector components (columns) evaluated at

N points (rows) for M ports

a_1 (): (N,3) coordinate system basis vector a_1 for each of N points (directions) a_2 (): (N,3) coordinate system basis vector a_2 for each of N points (directions) a_3 (): (N,3) coordinate system basis vector a_3 for each of N points (directions)

aces.utilities.emsim.coord.project_field(e_field, a_1, a_2, a_3)[source]

Project electric field (pattern) onto given basis

Args:
e_field (numpy.ndarray): (M,N,3) complex valued electric field with 3 vector components (columns) evaluated at

N points (rows) for M ports

a_1 (): (N,3) coordinate system basis vector a_1 for each of N points (directions) a_2 (): (N,3) coordinate system basis vector a_2 for each of N points (directions) a_3 (): (N,3) coordinate system basis vector a_3 for each of N points (directions)