finesse.plotting.plot.Plotter.plot

Plotter.plot(*detectors, log=False, logx=None, logy=None, degrees=True, cmap=None, show=True, separate=True, _test_fig_handles=None)[source]

Plots the outputs from the specified detectors of a given solution out, or all detectors in the executed model if detectors is None.

Detectors are sorted by their type and the outputs of each are plotted on their own figure accordingly - i.e. all amplitude detector outputs are plotted on one figure, all power detector outputs on another figure etc.

Note

It is recommended to use this function with finesse.plotting.tools.init(). This then means that all figures produced by this function will use matplotlib rcParams corresponding to the style selected.

For example:

import finesse
finesse.plotting.init()

model = finesse.parse(\"""
l L0 P=1

s s0 L0.p1 ITM.p1

m ITM R=0.99 T=0.01 Rc=inf
s CAV ITM.p2 ETM.p1 L=1
m ETM R=0.99 T=0.01 Rc=10

modes maxtem=4

gauss L0.p1.o q=(-0.4+2j)
cav FP ITM.p2.o ITM.p2.i

ad ad00 ETM.p1.i f=L0.f n=0 m=0
ad ad02 ETM.p1.i f=L0.f n=0 m=2

pd C ETM.p1.i
\""")
model.run("xaxis(L0.f, (-100M), 100M, 1000, lin)").plot(logy=True, figsize_scale=2)

will produce two figures (one for the power-detector output and another for the amplitude detectors) which use rcParams from the default style-sheet. Using figsize_scale here then scales these figures whilst keeping the proportions defined in this style-sheet constant.

Multi-dimensional scan plotting behaviour

If multiple parameters have been scanned in the underlying model associated with this solution object, then the form of the resulting plots produced here will depend on a number of options:

  • If two parameters have been scanned then all non-CCD detector ouputs will be plotted

    on separate image plot figures. All CCD plots will be ignored.

  • If a single parameter has been scanned and index is not specified then all CCD detector

    outputs will be plotted on separate animated figures. Or if index is specified, then all CCD detector outputs will be plotted on separate image plot figures at the specified index of the scanned axis.

Parameters
detectorssequence or str or type or Detector, optional

An iterable (or singular) of strings (corresponding to detector names), Detector instances or detector types. Defaults to None so that all detector outputs are plotted.

logbool, optional

Use log-log scale. Also applies to image plots so that colours are normalised on a log-scale between limits of image data. Defaults to False.

logxbool, optional

Use log-scale on x-axis if appropriate, defaults to the value of log.

logybool, optional

Use log-scale on y-axis if appropriate, defaults to the value of log.

degreesbool, optional

Plots angle and phase outputs in degrees, defaults to True.

showbool, optional

Shows all the produced figures if true, defaults to True.

separatebool, optional

Plots the output of different detector types on different axes if true, defaults to True.

Returns
figuresdict

A dictionary mapping type(detector) and detector names to corresponding Figure objects. Note that some keys, i.e. those of each type(detector) and the names of the detectors of that type, share the same values.

animationsdict

A dictionary of detector.name : animation mappings.