legume.FourierShape

class legume.FourierShape(eps=1, x_cent=0, y_cent=0, f_as=array([0.]), f_bs=array([], dtype=float64), npts=100)

Fourier coefficinets of the polar coordinates

__init__(eps=1, x_cent=0, y_cent=0, f_as=array([0.]), f_bs=array([], dtype=float64), npts=100)

Create a shape defined by its Fourier coefficients in polar coordinates.

Parameters:
  • eps (float) – Permittivity value
  • x_cent (float) – x-coordinate of shape center
  • y_cent (float) – y-coordinate of shape center
  • f_as (Numpy array) – Fourier coefficients an (see Note)
  • f_bs (Numpy array) – Fourier coefficients bn (see Note)
  • npts (int) – Number of points in the polygonal discretization

Note

We use the discrete Fourier expansion R(phi) = a0/2 + sum(an*cos(n*phi)) + sum(bn*sin(n*phi)) The coefficients f_as are an array containing [a0, a1, ...], while f_bs define [b1, b2, ...].

Note

This is a subclass of Poly because we discretize the shape into a polygon and use that to compute the fourier transform for the mode expansions. For intricate shapes, increase npts to make the discretization smoother.

Methods

__init__([eps, x_cent, y_cent, f_as, f_bs, …]) Create a shape defined by its Fourier coefficients in polar coordinates.
compute_ft(gvec) Compute Fourier transform of the polygon
is_inside(x, y) Elementwise indicator function for the shape
rotate(angle) Rotate the polygon around its center of mass by angle radians