openqlab.plots – Plotting of Data

Time-Domain Plots

openqlab.plots.time_domain.scope(traces: Series | DataContainer, title: str = 'Oscilloscope View') Figure

Create plot for oscilloscope data.

This function plots up to four channels from oscilloscope time-voltage data into one plot. Each trace will have its own auto-scaled y axis.

Parameters:
  • traces – A Pandas DataFrame containing the time-domain traces, where the time-base is given by the frame’s index.

  • title – The figure title.

Returns:

A handle to the created matplotlib figure.

Return type:

matplotlib.figure.Figure

openqlab.plots.time_domain.zero_span(traces: DataContainer, normalize: bool = True, title: str | None = 'Zero Span', annotate: bool = True, digits_number: int = 2, x_pos: int = 20, alignment: str = 'left', ax: Axes | None = None) Figure | SubFigure

Create a sensible plot for zero-span squeezing scope measurements.

Parameters:
  • traces – A Pandas DataFrame containing the zero-span traces, where the time-base is given in the frame’s index.

  • normalize (bool, optional) – Normalize the data to the vacuum trace, which requires a column name starting with “vac”.

  • title (str, optional) – The figure title.

  • annotate (bool, optional) – Add noise values to the plot.

  • digits_number (int, optional) – Number of digits for the calculated dB values.

  • x_pos (int, optional) – Distance between graph and labels.

  • alignment (str, optional) – Horizontal alignment of labels. Can be “left”, “center” or “right”.

  • ax (Axes, optional) – Provide an Axes for advanced figures.

Returns:

A handle to the created matplotlib Figure.

Return type:

matplotlib.figure.Figure

Frequency-Domain Plots

Plotting scripts in frequency domain.

openqlab.plots.frequency_domain.amplitude_phase(amplitude: DataFrame | Series, phase: DataFrame | Series, logf: bool = True, bodeplot: bool = True, clamp_phase: bool = True, dbunits: bool = True, title: str | None = 'Transfer Function', **kwargs) Figure

Create an amplitude-phase plot to display transfer function measurements.

Parameters:
  • amplitude (DataFrame) – A Pandas DataFrame containing the frequency-domain amplitude data (in dB).

  • phase (DataFrame) – A Pandas DataFrame containing the frequency-domain phase data (in degrees).

  • logf (bool) – Use logarithmic frequency axis.

  • bodeplot (bool) – Use Bode plot style (magnitude and phase in separate plots).

  • clamp_phase (bool) – Map phase values to +/- 180deg.

  • dbunits (bool) – Use dB units for display. Otherwise convert to linear units.

  • title (str, optional) – The figure title.

  • **kwargs – Parameters are passed to the pandas.DataFrame.plot method

Returns:

A handle to the created matplotlib figure.

Return type:

matplotlib.figure.Figure

openqlab.plots.frequency_domain.power_spectrum(data: DataContainer, normalize_to: Series | None = None, logf: bool = True, title: str = 'Power Spectrum', ax: Axes | None = None, **kwargs) Figure | SubFigure

Create a plot for power spectrum data (in dB units), e.g. squeezing measurements over a frequency range.

Note that this function only does the plotting, it does not calculate the power spectrum by itself.

Parameters:
  • data (DataFrame) – A Pandas DataFrame containing the frequency-domain power spectrum data (in dBm).

  • normalize_to (DataFrame or float, optional) – Normalize all data columns by this value.

  • logf (bool, optional) – Use logarithmic frequency axis.

  • title (str, optional) – The figure title.

  • (Axes (ax) – Provide an Axes for advanced figures.

  • optional) – Provide an Axes for advanced figures.

Returns:

A handle to the created matplotlib figure.

Return type:

matplotlib.figure.Figure

openqlab.plots.frequency_domain.relative_input_noise(data: DataContainer, volt_dc: float, logf: bool = True, logy: bool = True, title: str | None = None, ylabel: str = 'RIN ($1/\\sqrt{\\mathrm{Hz}}$)', **kwargs) Axes | ndarray

Create a plot for relative input noise.

The values of data are devided by the constant voltage volt_dc and plottet using the DataContainer.plot method.

Parameters:
  • data (DataContainer) – input data

  • volt_dc (bool) – dc voltage for reference

  • logf (bool) – frequency log scale

  • logy (bool) – y axis log scale

Returns:

Axes object

Return type:

matplotlib.axes.Axes

Gaussian Beam Plots

openqlab.plots.gaussian_beam.beam_profile(beams: Dict[str, GaussianBeam], data: DataFrame | None = None, title: str = 'Beam Profile', **kwargs) Figure

Create a plot of the (longitudinal) beam profiles for a set of Gaussian beams.

The plotting range is adjusted such that it covers the Rayleigh range of all Gaussian beams, and includes all measurement points.

Parameters:
  • beams (dict) – A dict of GaussianBeam objects, with descriptive labels as keys.

  • data (DataFrame, optional) – Optional measurement data that should be plotted together with the Gaussian beams.

  • title (str, optional) – The figure title.

  • **kwargs – Parameters are passed to the matplotlib.plot method

Returns:

A handle to the created matplotlib figure.

Return type:

matplotlib.figure.Figure