Plotting

These functions are also methods: stack.plot_field(...), slab.plot_n(...), mode.plot_field(...). plot() opens an interactive Tk window (for a Section, a Matplotlib figure).

camfr.plot_n(o, r1, r2=0, r3=0, filename=0, colormap=1)

Plot the refractive index profile.

wg.plot_n(r_x) plots a waveguide along x; stack.plot_n(r_x, r_z) a Stack, BlochStack or Cavity in the x-z plane (r_x, r_y, r_z for a 3D stack); plot_n(section, r_x, r_y) a Section. The ranges are arrays such as arange(x0, x1, dx). For stacks and sections, filename saves the picture instead of showing it (format from the suffix: png, gif, jpg, pdf, …).

camfr.plot_field(o, 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.

camfr.animate_field(o, 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.