visualization.analysis.surface_sag#

SurgaceSagViewer

This module provides a viewer for visualizing the sag of an optical surface. It generates a 2D sag map and 1D sag profiles along user-specified cross-sections.

Manuel Fragata Mendes, june 2025

Classes

CustomScalarFormatter(*args, **kwargs)

Custom formatter to handle both small and large numbers automatically.

SurfaceSagViewer(optic)

A viewer for visualizing the sag of an optical surface.

class CustomScalarFormatter(*args: Any, **kwargs: Any)[source]#

Custom formatter to handle both small and large numbers automatically.

class SurfaceSagViewer(optic)[source]#

A viewer for visualizing the sag of an optical surface.

view(surface_index: int, y_cross_section: float = 0.0, x_cross_section: float = 0.0, fig_to_plot_on: matplotlib.pyplot.Figure = None, max_extent: float = None, num_points_grid: int = 50, buffer_factor: float = 1.1)[source]#

Analyzes and visualizes the sag of a given lens surface.

This method generates a 2D sag map and 1D sag profiles along user-specified x and y cross-sections.

Parameters:
  • surface_index (int) – The index of the surface to analyze.

  • y_cross_section (float, optional) – The y-coordinate for the horizontal (X-axis) profile. Defaults to 0.0.

  • x_cross_section (float, optional) – The x-coordinate for the vertical (Y-axis) profile. Defaults to 0.0.

  • fig_to_plot_on (plt.Figure, optional) – Figure to plot on. If None, creates a new figure.

  • max_extent (float, optional) – Maximum extent of the plot in mm. If None, uses the surface’s aperture with a buffer. This controls the viewing area size.

  • num_points_grid (int, optional) – Number of points in each dimension of the grid. Defaults to 50.

  • buffer_factor (float, optional) – Factor to multiply the aperture by to add a buffer around the plot. Defaults to 1.1.