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_zfor a 3D stack);plot_n(section, r_x, r_y)a Section. The ranges are arrays such asarange(x0, x1, dx). For stacks and sections,filenamesaves 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.
componentmaps 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_zfor a 3D stack); a SectionMode takesr_x, r_y.overlay_noverlays the index profile, drawn as contours ifcontour; except for waveguide modes,filenamesaves 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, butcomponentreturns a complex number, e.g.lambda f: f.E2().filenamewrites the animation to a GIF file.