In this section, we show how to control the main modules of Pyrpl with the Graphical User Interface (GUI).
Get started by watching the video tutorial below on locking a Michelson interferometer with PyRPL. The video covers:
If you use the windows or linux binary files,
just launch the executable and the GUI should start. Passing the command-line
argument --help
to the executable shows a list of optional
command-line arguments.
If instead you have a source code installation, then you can either launch PyRPL from a terminal with
python -m pyrpl example_filename
or execute the following code block in Python:
# import pyrpl library
import pyrpl
# create a Pyrpl object and store the configuration in a file 'example_filename.yml'
# by default, the parameter 'gui' is set to True
p = pyrpl.Pyrpl(config='example_filename')
If you are using the file ‘example_filename.yml’ for the first time, a screen will pop-up asking you to choose among the different RedPitayas connected to your local network. After that, the main Pyrpl widget should appear:
The main pyrpl widget is initially empty, however, you can use the “modules” menu to populate it with module widgets. The module widgets can be closed or reopened at any time, docked/undocked from the main module window by drag-and-drop on their sidebar, and their position on screen will be saved in the config file for the next startup.
We explain the operation of the most useful module widgets in the following sections.
The image below shows a typical module widget, here for the PID modules.
The basic functionality of all module widgets are inherited from the base
class ModuleWidget
.
A module widget is delimited by a dashed-line (a QGroupBox). The following
menu is available on the top part of each ModuleWidget, directly behind the
name of the module (e.g. pid0
, pid1
, ...). Right click on
the item (e.g. .:Load:.
, .:Save:.
, ...) to access the associated
submenu:
.:Load:.
Loads the state of the module from a list of previously saved states..:Save:.
Saves the current state under a given state name..:Erase:.
Erases one of the previously saved states..:Edit:.
Opens a text window to edit the yml code of a state..:Hide/Show:.
Hides or shows the content of the module widget.Inside the module widget, different attribute values can be manipulated using
the shown sub-widgets (e.g. input
, setpoint
, max_voltage
, ...). The
modifications will take effect immediately. Only the module state
<current state>
is affected by these changes. Saving the state under
a different name only preserves the state at the moment of saving for later
retrieval.
At the next startup with the same config file, the :code:<current state> of all modules is loaded.
If a module-widget is grayed out completely, it has been reserved by another,
higher-level module whose name appears in parentheses after the name of the
module (e.g. pid2 (output1)
means that the module pid2
is
being used by the module output1
, which is actually a submodule of the
lockbox
module). You can right-click anywhere on the grayed out
widget and click on “Free” to override that reservation and use the module
for your own purposes.
Warning
If you override a module reservation, the module in parenthesis might stop to function properly. A better practice is to identify the top-level module responsible for the reservation, remove its name from the list in your configuration file (located at /HOME/pyrpl_user_dir/config/<string_shown_in_top_bar_of_the_gui>.yml) and restart PyRPL with that configuration.
Acquisition modules are the modules used to acquire data from the Red Pitaya.
At the moment, they include the
All the acquisition modules have in common a plot area where the data is
displayed and a control panel BELOW the plot for changing acquisition
settings. Widgets for specialized acquisition modules
(e.g. Scope
) have an additional control
panel ABOVE the plot are for settings that are only available for that module.
The different buttons in the acquisition module control panel below the plot are:
trace_average
chooses the number of successive traces to average together.curve_name
is the name for the next curve that is saved.Run single
starts a single acquisition of trace_average
traces (calls AcquisitionModule.single()
).Run continuous
starts a continuous acquisition with a running
average filter, where trace_average
is the decay constant of the
running average filter (calls AcquisitionModule.continuous()
).Restart average
resets trace averages to zero to start a new
measurement from scratch.Save curve
saves the current measurement data to a new
pyrpl.curvedb.CurveDB
object under the name
curve_name
.The scope widget is represented in the image below.
The control panel above the plotting area allows to manipulate the following
attributes specific to the Scope
:
ch1_active
/ch2_active
: Hide/show the trace
corresponding to ch1/ch2.input1
/input2
: Choose the input among a
list of possible signals. Internal signals can be referenced by their
symbolic name e.g. lockbox.outputs.output1
.threshold
: The voltage threshold for the scope trigger.hysteresis
: Hysteresis for the scope trigger, i.e. the scope
input signal must exceed the threshold
value by more than
the hysteresis value to generate a trigger event.duration
: The full duration of the scope trace to acquire,
in units of seconds.trigger_delay
: The delay beteween trigger event and the
center of the trace.trigger_source
: The channel to use as trigger input.average
: Enables “averaging” a.k.a. “high-resolution” mode,
which averages all data samples acquired at the full sampling rate between
two successive points of the trace. If disabled, only a sample of the
full-rate signal is shown as the trace. The averaging mode corresponds to a
moving-average filter with a cutoff frequency of
sampling_time
\(^{-1} = 2^{14}/\mathrm{duration}\)
in units of Hz.trigger_mode
: Multiple options are available.Normal
is used for triggered acquisition.Untriggered (rolling)
is used for continuous acquisition without
requiring a trigger signal, where the traces “roll” through the plotting
area from right to left in real-time. The rolling mode does not allow for
trace averaging nor durations below 0.1 s.The network analyzer widget is represented in the image below.
The network analyzer records the coherent response of the signal at the port
input
to a sinusoidal excitation of variable frequency sent to the
output selected in output_direct
.
Note
If output_direct='off'
, another module’s input can be set
to networkanalyzer
to test its response to a frequency sweep.
amplitude
sets the amplitude of the sinusoidal excitation in Volts.start_freq
/stop_freq
define the frequency range over which a transfer function is recorded.
Swapping the values of start_freq
and stop_freq
reverses the
direction of the frequency sweep. Setting stop_freq = start_freq
enables the “zero-span” mode, where the coherent response at a constant
frequency is recorded as a function of time.points
defines the number of frequency points in the recorded transfer function.rbw
is
the cutoff frequency of the low-pass filter after demodulation. Furthermore,
the time \(\tau\) spent to record each point is
\(\tau=\texttt{avg_per_point} / \texttt{rbw}\).avg_per_point
:
Each point is averaged inside the FPGA before being retrieved by the
client computer that runs PyRPL. You should increase this parameter or
decrease rbw
if the communication time between the Red Pitaya and
the client computer limits the acquisition speed.acbandwidth
is the cutoff frequency of a high-pass filter applied to the input before
demodulation. A setting of zero disables the high-pass filter.logscale
enables the use of a logarithmic scale for the frequency axis, resulting in
a logarithmic distribution of the frequency points as well.infer_open_loop_tf
applies the transformation \(T \rightarrow \frac{T}{1+T}\) to the displayed
transfer function to correct for the effect of a closed feedback loop
(not implemented at the moment).The spectrum analyzer widget is represented in the image below.
Warning
Because the spectrum analyzer uses the data sampled by the scope to perform measurements, it is not possible to use both instruments simultaneaously. When the spectrum-analyzer is running, the scope-widget appears greyed-out to show that it is not available.
The iq widget is represented in the image below. A schematic of the internal connection of the IQ-module can be shown or hidden with the arrow button.
The IQ-module is a very flexible Digital Signal Processing tool. Different values of the internal registers can be configured to perform various tasks:
The PDH locking technique is widely used to lock a laser beam to a high-finesse optical cavity. The principle is to generate a strong phase modulation of the laser beam (for instance, with an electro-optic modulator) at a frequency exceeding the cavity bandwidth and to detect the amplitude modulation in the beam reflected by the cavity. The amplitude modulation is caused by the abrupt phase response of the cavity affecting independently the sidebands from the carrier, and its sign with respect to the imposed modulation depends on cavity detuning. The high-speed digital signal processing of the redpitaya allows us to perform all the modulation/demodulation steps inside the FPGA, with modulations frequencies up to Nyquist frequecies (62.5 MHz). The correct IQ-module settings for PDH generation are (refer to the IQ signal schematic for explanations):
The network analyzer uses an IQ internally to accumulate the demodulated signal. The Network analyzer module automatically sets the following settings for the IQ module registers:
gain=0
quadrature_factor=0
output_direct=output_direct # use output_signal to excite an internal signal
frequency=frequency # is value is scanned over time
bandwidth=rbw # bandwidth of the frequency analysis
input=input
acbandwidth=acbandwidth
The IQ-module can be used to perform phase/frequency comparison between the internal frequency reference and an input signal. This is done by connecting the output multiplexer to a frequency comparator (not represented in the schematic):
output_signal='pfd'
It is possible to realize very narrow bandpass filters by combining a demodulation and a remodulation stage. The correct settings are:
gain=1. # demod-> modulation gain
amplitude=0. # no internal excitation
frequency=1e6 # filter center frequency
bandwidth=100 # filter bandwidth (use a tuple for high-order filters)
quadrature_factor=0
output_signal='ouptut_direct' # if the signal needs to be used internally
phase=30 # eventually include some dephasing to the filter
The lockbox widget is represented in the image below.
The Lockbox widget is used to produce a control signal to make a system’s output follow a specified setpoint. The system has to behave linearly around the setpoint, which is the case for many systems. The key parts of the widget are:
The lockbox module is completely customizable and allows to implement complex locking logic by inheriting the “Lockbox” class and adding the new class into lockbox/models. For example, below is an end-to-end locking scenario for a Fabry–Pérot interferometer that uses the included “FabryPerot” class:
You should start the lockbox module and first select the model class to FabryPerot. Then continue to configure first the outputs and inputs, filling in the information as good as possible. Critical fields are: