Modes and fields

class camfr.Coord

A point in space.

c1 and c2 are x and y in Cartesian structures, rho and phi in cylindrical ones. The optional Limits (Plus or Min) choose the side of an index discontinuity at which a field is evaluated.

__init__(c1: float, c2: float, z: float) -> None

__init__(c1: float, c2: float, z: float, c1_limit: Limit) -> None

__init__(c1: float, c2: float, z: float, c1_limit: Limit, c2_limit: Limit) -> None

__init__(c1: float, c2: float, z: float, c1_limit: Limit, c2_limit: Limit, z_limit: Limit) -> None

class camfr.Field

The electromagnetic field at a point. Components 1 and 2 are x and y (Cartesian) or rho and phi (cylindrical).

E1() → complex

First transverse component of E.

E2() → complex

Second transverse component of E.

Ez() → complex

z component of E.

H1() → complex

First transverse component of H.

H2() → complex

Second transverse component of H.

Hz() → complex

z component of H.

S1() → complex

First transverse component of the Poynting vector E x H*.

S2() → complex

Second transverse component of the Poynting vector E x H*.

Sz() → complex

z component of the Poynting vector E x H*.

abs_E() → float

Magnitude of E.

abs_H() → float

Magnitude of H.

abs_S() → float

Magnitude of the Poynting vector.

class camfr.FieldExpansion

A field given by its mode expansion in a waveguide.

field(coord: Coord) → Field

Return the Field at a Coord.

class camfr.Mode

An eigenmode of a waveguide.

field(coord: Coord) → Field

Return the mode’s Field at a Coord (z is ignored).

kz() → complex

Propagation constant.

n_eff() → complex

Effective index.

plot_field(component, r1, r2=0, r3=0, filename=0, colormap=0, overlay_n=1, contour=1, arrow=0)

Plot a field component.

component maps a Field to a real number, e.g. lambda f: f.E2().real. mode.plot_field(component, r_x) plots a waveguide mode along x; stack.plot_field(component, r_x, r_z) the field in a Stack, Cavity or BlochMode, after an incident field or source has been set (r_x, r_y, r_z for a 3D stack); a SectionMode takes r_x, r_y. overlay_n overlays the index profile, drawn as contours if contour; except for waveguide modes, filename saves the picture instead of showing it.

pol() → Polarisation

Polarisation.

class camfr.SectionMode

A mode of a Section.

n(coord: Coord) → complex

Refractive index at a Coord.

class camfr.BlochMode

A mode of a BlochStack.

S_flux(c1_start: float, c1_stop: float, eps: float) → float

Power flux along z at z = 0 between c1_start and c1_stop, relative precision eps.

animate_field(component, r1, r2, r3=0, filename=0, overlay_n=1, contour=1, ln=0)

Animate the time evolution of a complex field component.

As plot_field, but component returns a complex number, e.g. lambda f: f.E2(). filename writes the animation to a GIF file.

bw_field() → ndarray

Backward mode amplitudes at the start of the period.

fw_bw()

fw_bw(z: float) -> tuple

Forward and backward mode amplitudes at z, as a tuple.

fw_bw(z: float, limit: Limit) -> tuple

As fw_bw(z), on the given side (Plus or Min) of an interface at z.

fw_field() → ndarray

Forward mode amplitudes at the start of the period.

n(coord: Coord) → complex

Refractive index at a Coord.

plot_field(component, r1, r2=0, r3=0, filename=0, colormap=0, overlay_n=1, contour=1, arrow=0)

Plot a field component.

component maps a Field to a real number, e.g. lambda f: f.E2().real. mode.plot_field(component, r_x) plots a waveguide mode along x; stack.plot_field(component, r_x, r_z) the field in a Stack, Cavity or BlochMode, after an incident field or source has been set (r_x, r_y, r_z for a 3D stack); a SectionMode takes r_x, r_y. overlay_n overlays the index profile, drawn as contours if contour; except for waveguide modes, filename saves the picture instead of showing it.

class camfr.BlochSectionMode

A mode (diffraction order) of a BlochSection.

get_Mx() → int

Diffraction order in x.

get_My() → int

Diffraction order in y.

get_kx() → complex

Wavenumber kx.

get_ky() → complex

Wavenumber ky.