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:

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
update_data(build='rebuild', **kwargs)[source]
plot()[source]
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>, linewidth=<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: bool or dict or None constrained_layout_pads: float, default: :rc:`figure.constrained_layout.w_pad` dpi: float edgecolor: color facecolor: color figheight: float figure: .Figure figwidth: float frameon: bool gid: str in_layout: bool label: object linewidth: number 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: bool or dict with keys “pad”, “w_pad”, “h_pad”, “rect” or None 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

init_axis(ax)[source]
refresh(build='rebuild')[source]
update_data(build='rebuild')[source]
plot(ax)[source]
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

init_axis(ax)[source]
refresh(build='rebuild')[source]
update_data(build='rebuild')[source]
ray_data_bounds()[source]
plot(ax)[source]
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

init_axis(ax)[source]
refresh(build='rebuild')[source]
update_data(build='rebuild')[source]
plot(ax)[source]
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

init_axis(ax)[source]
refresh(build='rebuild')[source]
update_data(build='rebuild')[source]
plot(ax)[source]