rayoptics.mpl.analysisfigure module¶
Single panel, multiplot MPL figure, with support for line and surface plots
This package is designed to work with data sources in the
analyses
package. This package provides a MPL Figure subclass,AnalysisFigure
, that is a container for one or more plots. The plots are managed by the other classes in this package:
RayFanPlot
: transverse ray aberreations and OPDRayGeoPSF
: spot diagrams and 2D histogramsWavefront
: wavefront mapDiffractionPSF
: diffraction Point Spread Function
-
class
AnalysisFigure
(data_objs=None, subplots=None, grid=None, **kwargs)[source]¶ Bases:
rayoptics.mpl.styledfigure.StyledFigure
Containing Figure for single panel plots, supports update_data.
-
subplots
¶ list of plots for this figure
-
data_objs
¶ the data sources for the plots. If not specified, the subplots will be queried for the data sources.
-
grid
¶ tuple of the # rows and # columns in the figure, defaults to (1, 1)
-
gs
¶ GridSpec instance, created from grid.
-
gridspecs
¶ optional, list of subplotspecs, one for each subplot. These are used for detailed control of subplot positions.
-
kwargs
¶ passed to Figure base class
-
refresh
(**kwargs)[source]¶ Call update_data() followed by plot(), return self.
Parameters: kwargs – keyword arguments are passed to update_data Returns: self (class Figure) so scripting envs will auto display results
-
set
(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, canvas=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, constrained_layout=<UNSET>, constrained_layout_pads=<UNSET>, dpi=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, figheight=<UNSET>, figwidth=<UNSET>, frameon=<UNSET>, gid=<UNSET>, in_layout=<UNSET>, label=<UNSET>, layout_engine=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, size_inches=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, tight_layout=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)¶ Set multiple properties at once.
Supported properties are
- Properties:
- agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image alpha: scalar or None animated: bool canvas: FigureCanvas clip_box: .Bbox clip_on: bool clip_path: Patch or (Path, Transform) or None constrained_layout: unknown constrained_layout_pads: unknown dpi: float edgecolor: color facecolor: color figheight: float figure: .Figure figwidth: float frameon: bool gid: str in_layout: bool label: object layout_engine: unknown linewidth: number mouseover: bool path_effects: .AbstractPathEffect picker: None or bool or float or callable rasterized: bool size_inches: (float, float) or float sketch_params: (scale: float, length: float, randomness: float) snap: bool or None tight_layout: unknown transform: .Transform url: str visible: bool zorder: float
-
-
class
RayFanPlot
(fan_list, user_scale_value=0.1, scale_type='fit', yaxis_ticks_position='left', **kwargs)[source]¶ Bases:
object
Single axis line plot, supporting data display from multiple RayFans.
-
fan_list
¶ list of (fan, data_type, kwargs)
- fan: a RayFan instance
- data_type: ‘x’, ‘y’, ‘opd’ to be extracted from fan
- kwargs: passed to axis.plot() call
-
scale_type
¶ if ‘fit’, set scale to encompass largest data value
-
user_scale_value
¶ max scale to apply if scale_type is ‘user’
-
title
¶ title, if desired, of this plot panel
-
yaxis_ticks_position
¶ ‘left’ or ‘right’, default is ‘left’
-
kwargs
¶ passed to plot call
-
-
class
RayGeoPSF
(ray_list, user_scale_value=0.1, scale_type='fit', yaxis_ticks_position='left', dsp_typ='hist2d', num_img_samples=100, **kwargs)[source]¶ Bases:
object
Single axis spot diagram or 2d histogram.
-
ray_list
¶ a RayList instance
-
dsp_type
¶ display type, either ‘spot’ or ‘hist2d’
-
scale_type
¶ if ‘fit’, set scale to encompass largest data value
-
user_scale_value
¶ max scale to apply if scale_type is ‘user’
-
title
¶ title, if desired, of this plot panel
-
yaxis_ticks_position
¶ ‘left’ or ‘right’, default is ‘left’
-
kwargs
¶ passed to plot call
-
-
class
Wavefront
(ray_grid, do_contours=False, user_scale_value=None, **kwargs)[source]¶ Bases:
object
Single axis wavefront map.
-
ray_grid
¶ a RayGrid instance
-
do_contours
¶ if True, display contour plot, else plot data grid as an
-
image
¶
-
scale_type
¶ if ‘fit’, set scale to encompass largest data value
-
user_scale_value
¶ max scale to apply if scale_type is ‘user’
-
title
¶ title, if desired, of this plot panel
-
yaxis_ticks_position
¶ ‘left’ or ‘right’, default is ‘left’
-
cmap
¶ color map for plot, defaults to ‘RdBu_r’
-
kwargs
¶ passed to plot call
-
-
class
DiffractionPSF
(pupil_grid, maxdim, yaxis_ticks_position='left', **kwargs)[source]¶ Bases:
object
Point Spread Function (PSF) calculation and display.
-
pupil_grid
¶ a RayGrid instance
-
maxdim
¶ the size of the sampling array
-
title
¶ title, if desired, of this plot panel
-
yaxis_ticks_position
¶ ‘left’ or ‘right’, default is ‘left’
-
cmap
¶ color map for plot, defaults to ‘RdBu_r’
-
kwargs
¶ passed to plot call
-