Get started
optodraw is a Python package. Install it, then draw a setup in a few lines: the same scene gives a 2D drawing, a 1D schematic and a 3D view. Run each cell below in your browser; nothing to install.
Install
Section titled “Install”pip install optodraw # the editor, GDS files, 3D and every exportIt needs Python 3.10 or newer. The extras add the editor, GDS import, video and more.
A first setup
Section titled “A first setup”This redraws the Advanced LIGO detector of Abbott et al. (2016), Fig. 3: a laser, a power-recycling mirror,
a beam splitter, two Fabry-Perot arms, signal recycling and the photodetector. Each add places a part;
each Beam runs light through the parts it names. The recycling and input mirrors are PartialMirrors with
the transmissions of Aasi et al. (2015); only the two end mirrors reflect all the light.
# Advanced LIGO, after Abbott et al., Phys. Rev. Lett. 116, 061102 (2016), Fig. 3from optodraw import Beam, BeamSplitter, Laser, Mirror, PartialMirror, Photodiode, Scenefrom optodraw.layout import aim
scene = Scene(title="Advanced LIGO", platform="free_space")scene.set_view_layout({"1d": {"spacing": 1}, "3d": {"spacing": "auto"}}) # 1D as drawn; 3D makes room for postslaser = scene.add(Laser(center=(-43, -10), wavelength=1064, label="Laser source"))# partial mirrors pass their transmission in percent, from Aasi et al., Class. Quantum Grav. 32,# 074001 (2015); only the end mirrors reflect allprm = scene.add(PartialMirror(center=(-17, -10), transmission=3, label="Power recycling"))bs = scene.add(BeamSplitter(center=(-1, -10), angle=-45, label="Beam splitter"))itm_x = scene.add(PartialMirror(center=(17, -10), aperture=10, transmission=1.4, label="Test mass"))etm_x = scene.add(Mirror(center=(47, -10), aperture=10, label="Test mass"))itm_y = scene.add(PartialMirror(center=(-1, 8), angle=90, aperture=10, transmission=1.4, label="Test mass"))etm_y = scene.add(Mirror(center=(-1, 36), angle=90, aperture=10, label="Test mass"))srm = scene.add(PartialMirror(center=(-1, -26), angle=90, transmission=20, label="Signal recycling"))pd = scene.add(Photodiode(center=(-1, -38), angle=-90, label="Photodetector"))# the coated faces of the partial mirrors face into their cavitiesfor mirror, cavity in ((prm, bs), (itm_x, etm_x), (etm_x, itm_x), (itm_y, etm_y), (etm_y, itm_y), (srm, bs)): aim(mirror, cavity, cavity)aim(bs, prm, itm_y)for part, side in ((laser, "top"), (prm, "bottom"), (bs, "top-right"), (itm_x, "bottom"), (etm_x, "top"), (itm_y, "left"), (etm_y, "left"), (srm, "left"), (pd, "right")): part.label_side = side# Beam.through attaches the light at each part's faces: it starts at the laser's edge and bends on mirrorsscene.add(Beam.through(laser, prm, bs, itm_x, etm_x, wavelength=1064, width=0.5))scene.add(Beam.through(bs, itm_y, etm_y, wavelength=1064, width=0.5))scene.add(Beam.through(bs, srm, pd, wavelength=1064, width=0.5))scene.fit_frame(margin=12)sceneOne scene gives all three views: the tabs show the 1D schematic for a paper, the 2D layout and the 3D bench.
The set_view_layout line gives the 3D bench its own spacing, so each part stands on its post with room
around it; the 1D and 2D views stay compact. To save them:
from optodraw.notebook_1d import render_notebook_1d
render_notebook_1d(scene) # the 1D schematic, as SVGscene.render_svg("ligo.svg") # the 2D layoutscene.render_threejs("ligo.html") # the 3D bench, one interactive page-
Examples: more published figures, redrawn.
-
Free-space benches and photonic chips: the two kinds of setup.
-
Figures for papers: SVG, TikZ and 1D at the size of the page.
-
The editor: the same scenes without code.
-
Aasi, J. et al. Advanced LIGO. Class. Quantum Grav. 32, 074001 (2015). doi:10.1088/0264-9381/32/7/074001
-
Abbott, B. P. et al. Observation of gravitational waves from a binary black hole merger. Phys. Rev. Lett. 116, 061102 (2016). doi:10.1103/PhysRevLett.116.061102