PyPO User Manual
 
Loading...
Searching...
No Matches
Visualisation Methods

This section contains a list of public PyPO methods which are used for visualising systems, elements, frames and PO fields/currents. More...

Functions

 PyPO.System.System.plotBeamCut (self, name_field, comp, comp_cross=FieldComponents.NONE, vmin=None, vmax=None, center=True, align=True, mode=Modes.dB, units=Units.DEG, name="", show=True, save=False, ret=False)
 Plot beam pattern cross sections.
 
 PyPO.System.System.plotBeam2D (self, name_obj, comp=FieldComponents.NONE, contour=None, contour_comp=FieldComponents.NONE, vmin=None, vmax=None, levels=None, show=True, amp_only=False, save=False, interpolation=None, norm=True, aperDict=None, mode=Modes.dB, project=Projections.xy, units=Units.MM, name="", titleA="Power", titleP="Phase", unwrap_phase=False, ret=False)
 Generate a 2D plot of a PO (scalar)field or current.
 
 PyPO.System.System.plot3D (self, name_surface, cmap=cm.cool, norm=False, fine=2, show=True, foc1=False, foc2=False, save=False, ret=False)
 Plot a 3D reflector.
 
 PyPO.System.System.plotSystem (self, cmap=cm.cool, norm=False, fine=2, show=True, foc1=False, foc2=False, save=False, ret=False, select=None, RTframes=None, RTcolor="black")
 Plot the current system.
 
 PyPO.System.System.plotGroup (self, name_group, show=True, ret=False)
 Plot a group of reflectors.
 
 PyPO.System.System.plotRTframe (self, name_frame, project=Projections.xy, ret=False, aspect=1, units=Units.MM)
 Create a spot diagram of a ray-trace frame.
 

Detailed Description

This section contains a list of public PyPO methods which are used for visualising systems, elements, frames and PO fields/currents.

Function Documentation

◆ plot3D()

PyPO.System.System.plot3D ( self,
name_surface,
cmap = cm.cool,
norm = False,
fine = 2,
show = True,
foc1 = False,
foc2 = False,
save = False,
ret = False )

Plot a 3D reflector.

Note that matplotlib offers custom control over figures in the matplotlib window. This means that most parameters described for this method can be adjusted in the matplotlib plotting window.

Parameters
name_surfaceName of reflector to plot.
cmapColormap of reflector. Default is cool.
normPlot reflector normals. Default is False.
fineSpacing of normals for plotting. Default is 2.
showShow plot. Default is True.
foc1Plot focus 1. Default is False.
foc2Plot focus 2. Default is False.
saveSave the plot.
retReturn Figure and Axis. Only used in GUI.

◆ plotBeam2D()

PyPO.System.System.plotBeam2D ( self,
name_obj,
comp = FieldComponents.NONE,
contour = None,
contour_comp = FieldComponents.NONE,
vmin = None,
vmax = None,
levels = None,
show = True,
amp_only = False,
save = False,
interpolation = None,
norm = True,
aperDict = None,
mode = Modes.dB,
project = Projections.xy,
units = Units.MM,
name = "",
titleA = "Power",
titleP = "Phase",
unwrap_phase = False,
ret = False )

Generate a 2D plot of a PO (scalar)field or current.

Note that matplotlib offers custom control over figures in the matplotlib window. This means that most parameters described for this method can be adjusted in the matplotlib plotting window.

Parameters
name_objName of field or current to plot.
compComponent of field or current to plot. String of two characters; an uppercase {E, H, J, M} for field followed by a lowercase {x, y, z} for component. (e.g: 'Jz')
contourA PyPO field or current component to plot as contour.
contour_compComponent of contour to plot as contour. If None, assumes the contour is a scalarfield.
vminMinimum amplitude value to display. Default is -30.
vmaxMaximum amplitude value to display. Default is 0.
levelsLevels for contourplot.
showShow plot. Default is True.
amp_onlyOnly plot amplitude pattern. Default is False.
saveSave plot to /images/ folder.
interpolationWhat interpolation to use for displaying amplitude pattern. Default is None.
normNormalise field (only relevant when plotting linear scale). Default is True.
aperDictPlot an aperture defined in an aperDict object along with the field or current patterns. Default is None.
modePlot amplitude in linear or decibel values. Instance of Modes enum object.
projectSet abscissa and ordinate of plot. Should be given as an instance of the Projection enum. Default is Projection.xy.
unitsThe units of the axes. Instance of Units enum object.
nameName of .png file where plot is saved. Only when save=True. Default is "".
titleATitle of the amplitude plot. Default is "Amp".
titlePTitle of the phase plot. Default is "Phase".
unwrap_phaseUnwrap the phase patter. Prevents annular structure in phase pattern. Default is False.
retReturn the Figure and Axis object. Only called by GUI. Default is False.
See also
aperDict

◆ plotBeamCut()

PyPO.System.System.plotBeamCut ( self,
name_field,
comp,
comp_cross = FieldComponents.NONE,
vmin = None,
vmax = None,
center = True,
align = True,
mode = Modes.dB,
units = Units.DEG,
name = "",
show = True,
save = False,
ret = False )

Plot beam pattern cross sections.

Plot the beam cross sections for a PO field. In this case, calcBeamCuts() will try to translate and rotate the supplied beam pattern to lie along the x- and y-axes. Note that using the "center" and "align" arguments sgould not be done when plotting beam cuts of very non-Gaussian beams. For these patterns, it is advised to set the arguments to False and calculate the beam cuts as-is.

Parameters
name_fieldName of field object.
compComponent of field object. Instance of FieldComponents enum object.
comp_crossCross-polar component. If given, is plotted as well. Defaults to None.
vminMinimum amplitude value to display. Default is -30.
vmaxMaximum amplitude value to display. Default is 0.
centerWhether to calculate beam center and center the beam cuts on this point.
alignWhether to find position angle of beam cuts and align cut axes to this.
modePlot in decibels or linear.
unitsThe units of the axes. Instance of Units enum object.
nameName of .png file where plot is saved. Only when save=True. Default is "".
showShow plot. Default is True.
saveSave plot to savePath.
retReturn the Figure and Axis object. Only called by GUI. Default is False.
Returns
fig Figure object.
ax Axes object.

◆ plotGroup()

PyPO.System.System.plotGroup ( self,
name_group,
show = True,
ret = False )

Plot a group of reflectors.

Note that matplotlib offers custom control over figures in the matplotlib window. This means that most parameters described for this method can be adjusted in the matplotlib plotting window.

Parameters
name_groupName of group to be plotted.
showShow the plot.
retWhether to return figure and axis.

◆ plotRTframe()

PyPO.System.System.plotRTframe ( self,
name_frame,
project = Projections.xy,
ret = False,
aspect = 1,
units = Units.MM )

Create a spot diagram of a ray-trace frame.

Note that matplotlib offers custom control over figures in the matplotlib window. This means that most parameters described for this method can be adjusted in the matplotlib plotting window.

Parameters
name_frameName of frame to plot.
projectSet abscissa and ordinate of plot. Should be given as an instance of the Projection enum. Default is Projection.xy.
retReturn Figure and Axis. Default is False.
aspectAspect ratio of plot. Default is 1.
unitsUnits of the axes for the plot. Instance of Units enum object.

◆ plotSystem()

PyPO.System.System.plotSystem ( self,
cmap = cm.cool,
norm = False,
fine = 2,
show = True,
foc1 = False,
foc2 = False,
save = False,
ret = False,
select = None,
RTframes = None,
RTcolor = "black" )

Plot the current system.

Plots the reflectors and optionally ray-trace frames in a 3D plot.

The ray-trace frames to plot are supplied as a list to the "RTframes" parameter. Note that matplotlib offers custom control over figures in the matplotlib window. This means that most parameters described for this method can be adjusted in the matplotlib plotting window.

Parameters
name_surfaceName of reflector to plot.
cmapColormap of reflector. Default is cool.
normPlot reflector normals. Default is False.
fineSpacing of normals for plotting. Default is 2.
showShow plot. Default is True.
foc1Plot focus 1. Default is False.
foc2Plot focus 2. Default is False.
saveSave the plot.
retReturn Figure and Axis. Only used in GUI.
selectA list of names of reflectors to plot. If not given, plot all reflectors.
RTframesA list of names of frame to plot. If not given, plot no ray-trace frames.