rayoptics.mpl.interactivelayout module

Interactive layout figure with paraxial editing

class InteractiveLayout(opt_model, refresh_gui=None, offset_factor=0.05, do_draw_rays=True, do_draw_beams=True, do_draw_edge_rays=True, do_draw_ray_fans=False, num_rays_in_fan=11, do_paraxial_layout=False, entity_factory_list=None, **kwargs)[source]

Bases: InteractiveFigure

Editable version of optical system layout, aka Live Layout


parent optical model


function to be called on refresh_gui event


how much to draw rays before first surface


if True, draw edge rays


if True, draw editable paraxial axial and chief ray


list of drawable entity factories. Allows new drawables to be added to the layout.

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>, view_bbox=<UNSET>, visible=<UNSET>, zorder=<UNSET>)

Set multiple properties at once.

Supported properties are


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 view_bbox: unknown visible: bool zorder: float

sync_light_or_dark(is_dark, **kwargs)[source]

returns a numpy bounding box that fits the current data