6.10. plots Submodule

6.10.1. plots.image_plots

optrace.plots.image_plots.image_plot(im, log=False, flip=False, title=None, path=None, sargs={})
Parameters:
  • im (ScalarImage | GrayscaleImage | RGBImage) – Image to plot

  • flip (bool) – if the image should be flipped

  • log (bool) – if logarithmic values are shown

  • title (str) – title of the plot

  • path (str) – if provided, the plot is saved at this location instead of displaying a plot. Specify a path with file ending.

  • sargs (dict) – option dictionary for pyplot.savefig

Return type:

None

optrace.plots.image_plots.image_profile_plot(im, log=False, flip=False, title=None, path=None, sargs={}, **kwargs)
Parameters:
  • im (RGBImage | ScalarImage | GrayscaleImage) – Image to plot

  • log (bool) – if logarithmic values are shown

  • flip (bool) – if the image should be flipped

  • title (str) – title of the plot

  • path (str) – if provided, the plot is saved at this location instead of displaying a plot. Specify a path with file ending.

  • sargs (dict) – option dictionary for pyplot.savefig

  • kwargs – additional keyword arguments for Image.profile

Return type:

None

6.10.2. plots.spectrum_plots

optrace.plots.spectrum_plots.refraction_index_plot(ri, title='Refraction Index', **kwargs)

Plot a single or a list of RefractionIndex

Parameters:
  • ri (RefractionIndex | list[RefractionIndex]) – RefractionIndex or list of RefractionIndex

  • title (str) – title of the plot

  • kwargs – additional plotting arguments, including: legend_off: if the legend should be turned off label_off: if the labels should be turned off color: a single or a list of colors path: if provided, the plot is saved at this location instead of displaying a plot. Specify with file ending. sargs: option dictionary for pyplot.savefig

Return type:

None

optrace.plots.spectrum_plots.spectrum_plot(spectrum, title='Spectrum', **kwargs)

Plot a single or multiple spectra (LightSpectrum, Spectrum, TransmissionSpectrum)

Parameters:
  • spectrum (Spectrum | list[Spectrum]) – spectrum or a list of spectra

  • title (str) – title of the plot

  • kwargs – additional plotting arguments, including: legend_off: if the legend should be turned off label_off: if the labels should be turned off color: a single or a list of colors path: if provided, the plot is saved at this location instead of displaying a plot. Specify with file ending. sargs: option dictionary for pyplot.savefig

Return type:

None

6.10.3. plots.chromaticity_plots

optrace.plots.chromaticity_plots.chromaticities_cie_1931(img=None, title='CIE 1931 Chromaticity Diagram', **kwargs)

Draw a CIE 1931 xy chromaticity diagram and mark spectrum/image colors inside of it.

Parameters:
  • img (RenderImage | RGBImage | LightSpectrum | list[LightSpectrum]) – RenderImage, RGBImage, LightSpectrum or a list of LightSpectrum

  • title (str) – title of the plot

  • kwargs – additional plotting parameters, including: norm: brightness norm for the chromaticity diagram, one of “chromaticity_norms” path: if provided, the plot is saved at this location instead of displaying a plot. Specify with file ending. sargs: option dictionary for pyplot.savefig

Return type:

None

optrace.plots.chromaticity_plots.chromaticities_cie_1976(img=None, title='CIE 1976 UCS Diagram', **kwargs)

Draw a CIE 1976 xy chromaticity diagram and mark spectrum/image colors inside of it.

Parameters:
  • img (RenderImage | RGBImage | LightSpectrum | list[LightSpectrum]) – RenderImage, RGBImage, LightSpectrum or a list of LightSpectrum

  • title (str) – title of the plot

  • kwargs – additional plotting parameters, including: norm: brightness norm for the chromaticity diagram, one of “chromaticity_norms” path: if provided, the plot is saved at this location instead of displaying a plot. Specify with file ending. sargs: option dictionary for pyplot.savefig

Return type:

None

optrace.plots.chromaticity_plots.chromaticity_norms: list[str, str, str] = ['Largest', 'Sum', 'Euclidean']

possible norms for the chromaticity diagrams

6.10.4. plots.misc_plots

optrace.plots.misc_plots.abbe_plot(ri, title='Abbe Diagram', lines=None, path=None, sargs={})

Create an Abbe Plot for different refractive media.

Parameters:
  • ri (list[RefractionIndex]) – list of RefractionIndex

  • title (str) – title of the plot

  • lines (list) – spectral lines to use for the Abbe number calculation

  • path (str) – if provided, the plot is saved at this location instead of displaying a plot. Specify a path with file ending.

  • sargs (dict) – option dictionary for pyplot.savefig

Return type:

None

optrace.plots.misc_plots.block()

show all plots and block application

Return type:

None

optrace.plots.misc_plots.focus_search_cost_plot(res, fsdict, title='Autofocus Cost Function', path=None, sargs={})

Plot a cost function plot for the focus_search results.

Parameters:
  • res (OptimizeResult) – optimize result from Raytracer.focus_search()

  • fsdict (dict) – dictionary from Raytracer.focus_search()

  • title (str) – title of the plot

  • path (str) – if provided, the plot is saved at this location instead of displaying a plot. Specify a path with file ending.

  • sargs (dict) – option dictionary for pyplot.savefig

Return type:

None

optrace.plots.misc_plots.surface_profile_plot(surface, x0=None, xe=None, remove_offset=False, title='Surface Profile', path=None, sargs={})

Plot surface profiles in x direction

if x0 and xe are not provided, it plots each surface over its extent Note that it plots each surface at y=y0, its center position, even if it is different for each surface

Parameters:
  • surface (Surface | list[Surface]) – Surface or List of Surface to plot

  • x0 (float) – x start value for the plot, defaults to the beginning of the surface

  • xe (float) – x end value for the plot, defaults to the end of the surface

  • remove_offset (bool) – remove the height offset for each surface

  • title (str) – title of the plot

  • path (str) – if provided, the plot is saved at this location instead of displaying a plot. Specify a path with file ending.

  • sargs (dict) – option dictionary for pyplot.savefig

Return type:

None