Fork PyRPL on GitHub

What is PyRPL?

PyRPL is an open-source software package providing many instruments on cheap FPGA hardware boards, e.g.:

  • oscilloscopes,
  • network analyzers,
  • lock-in amplifiers,
  • multiple automatic feedback controllers,
  • digital filters of very high order (24),
  • and much more.

PyRPL currently runs exclusively on the Red Pitaya.

The Red Pitaya (a.k.a. STEM Lab) (http://www.redpitaya.com, see full documentation) is an affordable (ca. 260 Euros) FPGA board with fast (125 MHz) analog inputs and outputs.

PyRPL comes with a graphical user interface (GUI).

See our GUI manual or the video tutorial on youtube.

PyRPL has a convenient Python API.

See High-level API example or Low-level API example, and the full API documentation .

PyRPL binary executables for Windows, Linux, or Mac OS X

can be easily downloaded and run without any installation work.

PyRPL’s code is entirely public on github and can be customized,

including the Verilog source code for the FPGA which is based on the official Red Pitaya software version 0.95.

PyRPL is already used in many research groups all over the world.

See for yourself the Feedback by PyRPL users.

PyRPL is free software and comes with the GNU General Public License v3.0.

Read the license for more details!

Low-level API example

# import pyrpl library
import pyrpl

# create an interface to the Red Pitaya
r = pyrpl.Pyrpl().redpitaya

r.hk.led = 0b10101010  # change led pattern

# measure a few signal values
print("Voltage at analog input1: %.3f" % r.sampler.in1)
print("Voltage at analog output2: %.3f" % r.sampler.out2)
print("Voltage at the digital filter's output: %.3f" % r.sampler.iir)

# output a function U(t) = 0.5 V * sin(2 pi * 10 MHz * t) to output2
r.asg0.setup(waveform='sin',
             amplitude=0.5,
             frequency=10e6,
             output_direct='out2')

# demodulate the output signal from the arbitrary signal generator
r.iq0.setup(input='asg0',   # demodulate the signal from asg0
            frequency=10e6,  # demodulaltion at 10 MHz
            bandwidth=1e5)  # demodulation bandwidth of 100 kHz

# set up a PID controller on the demodulated signal and add result to out2
r.pid0.setup(input='iq0',
             output_direct='out2',  # add pid signal to output 2
             setpoint=0.05, # pid setpoint of 50 mV
             p=0.1,  # proportional gain factor of 0.1
             i=100,  # integrator unity-gain-frequency of 100 Hz
             input_filter = [3e3, 10e3])  # add 2 low-passes (3 and 10 kHz)

# modify some parameters in real-time
r.iq0.frequency += 2.3  # add 2.3 Hz to demodulation frequency
r.pid0.i *= 2  # double the integrator unity-gain-frequency

# take oscilloscope traces of the demodulated and pid signal
data = r.scope.curve(input1='iq0', input2='pid0',
                     duration=1.0, trigger_source='immediately')

High-level API example

# import pyrpl library
import pyrpl

# create a Pyrpl object and store the configuration in a file 'filter-cavity.yml'
p = pyrpl.Pyrpl(config='filter-cavity')

# ... connect hardware (a Fabry-Perot cavity in this example) and
#     configure its paramters with the PyRPL GUI that shows up

# sweep the cavity length
p.lockbox.sweep()

# calibrate the cavity parameters
p.lockbox.calibrate()

# lock to the resonance with a predefined sequence
p.lockbox.lock()

# launch two different measurements simultaneously
transfer_function = p.network_analyzer.single_async(
        input='lockbox.reflection', output='out2',
        start=1e3, stop=1e6, points=10000, rbw=1000)
spectrum = p.spectrum_analyzer.single_async(
        input='in2', span=1e5, trace_averages=10)

# wait for measurements to finish
while not transfer_function.done() and not spectrum.done():
    # check whether lock was lost
    if not p.lockbox.is_locked():
        # re-lock the cavity
        p.lockbox.relock()
        # re-start measurements
        transfer_function = p.network_analyzer.single_async()
        spectrum = p.spectrum_analyzer.single_async()

# display a measurement result in the curve browser
p.curve_viewer.curve = transfer_function.result()

Feedback by PyRPL users

PyRPL was developed for and is one of the core components of three ongoing experiments in Quantum Cavity Optomechanics

in the Optomechanics and Quantum Measurement Group at Laboratoire Kastler Brossel in Paris.

“Brilliant toolbox with an impressive number of functionalities. After quickly tuning a few parameters, we were able to lock our Fabry-Perot cavity with almost no effort.”

Dr. Jérôme Degallaix from the Laboratoire des Matériaux Avancés in Lyon.

“IT WORKS! Thanks for your wonderful project :)”

Dr. Kun Huang from the State Key Laboratory of Precision Spectroscopy at East China Normal University.

“Thank you very much for your amazing PyRPL module! I have been using it continuously since last week, and it has saved us a lot of trouble already!”

Ivan Galinsky from the Quantum Membranes Lab, QUANTOP, Niels Bohr Institute, University of Copenhagen.

PyRPL is furthermore used by

If you are using PyRPL and would like to help to promote the project, please send your feedback to pyrpl.readthedocs.io@gmail.com and we will include your voice on this page.

Contributors

Below is partial list of PyRPL contributors. We do our best to keep this list updated. If you’ve been left off, please change this file by yourself or send an email to the maintainer (currently neuhaus@lkb.upmc.fr).

  • Leonhard Neuhaus
  • Samuel Deléglise
  • Jonas Neergard-Nielsen
  • Xueshi Guo
  • Jerome Degallaix
  • Pierre Clade
  • Matthew Winchester
  • Remi Metzdorff
  • Kevin Makles
  • Clement Chardin

About

PyRPL is open source software that allows to use FPGA boards with analog interfaces for measurement and control of real-world devices in physics and engineering, notably experiments in quantum optics. It was started in 2014 by Leonhard Neuhaus for controlling experiments in the field of quantum physics at the Laboratoire Kastler Brossel in Paris, France. Its was initially based on the open-source code for the Red Pitaya and gradually diverged away from it. In 2016, large parts of the graphical user interface were added to the project by Samuel Deleglise. PyRPL was finally published as an open-source project under the GNU General Public License, Version 3 and has been online since July 2017.

Old documentation sections

The old documentation is obsolete and will soon be deleted. Please refer to the more recent documentation in the Manual section.

Current build status

travis status appveyor status code coverage Python versions on PyPI PyRPL version on PyPI

Download pyrpl Documentation Status join chat on gitter License

Releases

Version 0.9.4.0

  • Smoother transitions of output voltages during stage transitions in lockbox.
  • Automatic Red Pitaya device search extended to multiple network adapters and most recent STEMLab OS v0.98.
  • Improved documentation hosted on www.pyrpl.org and video tutorial on youtube.
  • Binaries for Windows, Linux and Mac OSX automatically generated for new releases and available on sourceforge.

Version 0.9.3.X

There are no release notes for PyRPL versions prior to version 0.9.4.