PyPO User Manual
Plotter.py File Reference

Functions

def PyPO.Plotter.plotBeam2D (reflGrid, field, gmode=GridModes.xy, contour=None, contour_comp=FieldComponents.Ex, levels=None, aperDict=None, norm=True, vmin=None, vmax=None, scale=Scales.dB, amp_only=False, unwrap_phase=False, correct_phase=False, k=None, project=Projections.xy, units=Units.MM, figax=None, figsize=None, title=None, titleA="Amplitude", titleP="Phase", **kwargs)
 Generate a 2D plot of a field or current. More...
 
def PyPO.Plotter.plot3D (plotObject, ax, fine, cmap, norm, foc1, foc2, units=Units.MM, plotSystem_f=False)
 Plot a 3D reflector. More...
 
def PyPO.Plotter.plotSystem (systemDict, ax, fine, cmap, norm, foc1, foc2, RTframes, RTcolor, units=Units.MM, title=None)
 Plot the system. More...
 
def PyPO.Plotter.plotBeamCut (strip, cut, units=Units.DEG, vmin=None, vmax=None, scale=Scales.dB, norm=False, amp_only=True, figax=None, title=None, **kwargs)
 Plot a beam cut. More...
 
def PyPO.Plotter.plotRTframe (frame, project, savePath, returns, aspect, units)
 Plot a ray-trace frame spot diagram. More...
 

Detailed Description

File containing functions for generating plots.

Function Documentation

◆ plot3D()

def PyPO.Plotter.plot3D (   plotObject,
  ax,
  fine,
  cmap,
  norm,
  foc1,
  foc2,
  units = Units.MM,
  plotSystem_f = False 
)

Plot a 3D reflector.

Parameters
plotObjectA reflDict containing surface on which to plot beam.
axAxis to use for plotting.
fineSpacing of normals for plotting.
cmapColormap of reflector.
normPlot reflector normals.
foc1Plot focus 1.
foc2Plot focus 2.
unitsUnits to plot in.
plotSystem_fWhether or not plot3D is called from plotSystem.

◆ plotBeam2D()

def PyPO.Plotter.plotBeam2D (   reflGrid,
  field,
  gmode = GridModes.xy,
  contour = None,
  contour_comp = FieldComponents.Ex,
  levels = None,
  aperDict = None,
  norm = True,
  vmin = None,
  vmax = None,
  scale = Scales.dB,
  amp_only = False,
  unwrap_phase = False,
  correct_phase = False,
  k = None,
  project = Projections.xy,
  units = Units.MM,
  figax = None,
  figsize = None,
  title = None,
  titleA = "Amplitude",
  titleP = "Phase",
**  kwargs 
)

Generate a 2D plot of a field or current.

Parameters
reflGridA reflGrid containing the surface grid which to plot beam.
fieldPyPO field or current component to plot.
contourA fields or currents object to plot as contour.
contour_compThe component of the contour fields or currents object to plot as contours
levelsLevels for contourplot.
aperDictPlot an aperture defined in an aperDict object along with the field or current patterns. Default is None.
normNormalise field.
vminMinimum amplitude value to display. Default is -30.
vmaxMaximum amplitude value to display. Default is 0.
scalePlot amplitude in decibels, logarithmic or linear scale. Instance of Scales enum object.
amp_onlyOnly plot amplitude pattern. Default is False.
unwrap_phaseUnwrap the phase pattern. Prevents annular structure in phase pattern. Default is False.
correct_phaseBoolean or 3 element numpy array. Applies a phase factor to the field equal to k*displacement of the grid along the Z-axis (True) or direction of the 3-vector.
kWavenumber to use for phase correction. Only used if correct_phase is not False.
projectSet abscissa and ordinate of plot. Should be given as an instance of the Projection enum.
unitsThe units of the axes. Instance of Units enum object.
figaxTuple of Matplotlib Figure and Axes object or np.array of Axes objects to use for the plots. If none, create new figure.
figsizeTuple with Matplotlib Figure size. Defaults to (10,5) or (5,5). Has no effect if figax is given.
titleAn overall title for the plot. Defaults to the field name and component.
titleATitle of the amplitude plot. Default is "Amp".
titlePTitle of the phase plot. Default is "Phase".
**kwargsAdditional keywords to pass to Axes.pcolormesh Matplotlib methods.
Returns
fig Figure object containing plot.
ax Axes containing the axes of the plot.
See also
aperDict

◆ plotBeamCut()

def PyPO.Plotter.plotBeamCut (   strip,
  cut,
  units = Units.DEG,
  vmin = None,
  vmax = None,
  scale = Scales.dB,
  norm = False,
  amp_only = True,
  figax = None,
  title = None,
**  kwargs 
)

Plot a beam cut.

Parameters
stripCoordinates for plotting the cut.
cutField values to plot
unitsUnit for x-axis. Instance of Units enum object.
vminMinimum for plot range.
vmaxMaximum for plot range.
scaleThe units of the y axis. Instance of Scales Enum object.
normNormalise field.
amp_onlyOnly plot amplitude pattern. Default is True.
figaxTuple of Matplotlib Figure and Axes object or np.array of Axes objects to use for the plots. If none, create new figure.
titleAn overall title for the plot. Defaults to the field name and component.
**kwargsAdditional keyword arguments to pass to the Matplotlib Axes.plot method
Returns
fig Plot figure.
ax Plot axis.

◆ plotRTframe()

def PyPO.Plotter.plotRTframe (   frame,
  project,
  savePath,
  returns,
  aspect,
  units 
)

Plot a ray-trace frame spot diagram.

Parameters
frameA PyPO frame object.
projectSet abscissa and ordinate of plot. Should be given as an instance of the Projection enum.
savePathPath to save plot to.
returnsWhether to return figure object.
aspectAspect ratio of plot.
unitsUnits of the axes for the plot. Instance of Units enum object.

◆ plotSystem()

def PyPO.Plotter.plotSystem (   systemDict,
  ax,
  fine,
  cmap,
  norm,
  foc1,
  foc2,
  RTframes,
  RTcolor,
  units = Units.MM,
  title = None 
)

Plot the system.

Parameters
systemDictDictionary containing the reflectors to be plotted.
axAxis of plot.
fineSpacing of normals for plotting.
cmapColormap of reflector.
normPlot reflector normals.
foc1Plot focus 1.
foc2Plot focus 2.
RTframesList containing frames to be plotted.
unitsUnits to plot system in.