# Plotting radially and azimuthally polarized field components

#1

We can obtain the Cartesian field components from frequency domain power or profile monitors Ex, Ey and Ez, and Hx, Hy, Hz. But if we want to plot the radially-polarized or azimuthally-polarized field distributions (cylindrical coordinates), we need to first convert the data (eg. from Ex, Ey, Ez to E_radial, E_theta).

An example of a case where you may want to plot E_radial and E_theta is the whispering gallery mode profile from a disk resonator on the following page:
https://kb.lumerical.com/en/index.html?diffractive_optics_cavity_whispering_gallery_modes.html

This script takes the electric field data from the profile monitor named “418nm_profile”, and uses it to calculate the radial and azimuthal field components, then plots the results:

# collect E field and position data from monitor
E_dataset = getresult("418nm_profile","E");
Ex = pinch(E_dataset.Ex); # pinch is used here to remove extra singleton dimensions
Ey = pinch(E_dataset.Ey);
x = E_dataset.x;
y = E_dataset.y;

# define a matrix of theta values over x and y positions
X = meshgridx(x,y);
Y = meshgridy(x,y);
theta = atan2(Y,X);

E_theta = -Ex*sin(theta) + Ey*cos(theta);

# create plots