Code-to-CAD Optical Engineering
Design optical systems in Python and automatically generate modular CAD models of optical hardware.
PyOpticL (Python Optics Layout) is a Python library for code-to-CAD design of optical systems using modular baseplates. It places optics along simulated beam paths, including branched beam paths, so routing is automatic and dynamic as optics are added or modified. Baseplates are designed to be easily machined or 3D printed and mounted on an optical table. Baseplates are easy to set up as aligning optics on the baseplate is like 'paint by numbers', with each optic having a pre-aligned mount. Baseplates are reusable building blocks that can be combined into modular subsystems. Subsystems are also reusable at various wavelengths such that they can be easily combined into many different experimental apparatuses.
If you use PyOpticL in your research, please cite our paper published in Quantum. The paper introduces PyOpticL and demonstrates its use in a trapped-ion quantum computing experiment, including laser cooling, state detection, and high-fidelity qubit operations.
What can I build with PyOpticL?
- Extended-Cavity Diode Lasers (ECDLs)
- Double-Pass AOM Systems
- Saturation Absorption Spectroscopy
- Qubit Laser Systems
- Trapped Ion Quantum Computer
Why PyOpticL?
Traditional optical design:
- Draw optics manually in CAD
- Update CAD manually
- Re-align hardware manually during development
PyOpticL:
- Define layouts in Python
- Automatic beam routing during development
- Automatic CAD generation
- Modular reusable subsystems
Key Features
- Automatic beam-path routing and dynamic optical layouts
- Code-to-CAD workflow
- Modular baseplates and subsystems
- Gaussian beam simulation
- Manufacturable mechanical designs (CNC)
- FreeCAD integration
- Demonstrated in trapped-ion quantum computing experiments
Code Structure
baseplate = Component(...) beam = baseplate.add(BeamPath(...)) beam.add(mirror()) beam.add(waveplate()) beam.add(beamsplitter_cube())
Used by researchers at
MIT • Stanford • UC Berkeley • UW Madison • UConn • NUS • Quera
Readme contents:
- Installation
- Quick start
- Publication
- Wiki
- Baseplate Examples
- Subsystem Examples
- Apparatus Examples
- PyOpticL Community
Publication – High-Fidelity Trapped-Ion Qubit Operations with PyOpticL
We use PyOpticL in our trapped ion laboratory at UMass Amherst to design modular optical systems for trapped-ion quantum computing. In this paper we demonstrate laser cooling, state detection, and >99% fidelity single-qubit gates in our trapped-ion system using PyOpticL baseplates and lasers.
Read the paper
-
Quantum (2026):
Qubit operations using a modular optical system engineered with PyOpticL: a code-to-CAD optical layout tool -
arXiv preprint:
arXiv:2501.14957
Citation
Please cite our paper if you use PyOpticL. Thank you!
Myers, J., Caron, C., Helaly, N., Wei, Z., Oh, J., Gotobed, Z., Yabe, K., & Niffenegger, R. J.
Qubit operations using a modular optical system engineered with PyOpticL: a code-to-CAD optical layout tool.
Quantum 10, 2135 (2026).
UMass Amherst Trapped Ion system built with PyOpticL:
Modular abstraction: Optics → Baseplates → Subsystems → Apparatus:
Getting Setup
-
Install FreeCAD, Python, and Git
-
Add PyOpticL as a custom addon repository in FreeCAD
Under Edit>Preferences>Addon Manager>Custom Repositories, click the plus icon and enter the following information:
Repository URL: https://github.com/UMassIonTrappers/PyOpticL.git
Branch: main
Press OK to save settings -
Install the PyOpticL library In the Addon Manager (Tools>Addon Manager), search for "PyOpticL" and click install.
Note: if you get an error related to git, try disabling it - Edit>Preferences>Addon Manager>Disable git -
Check everything is setup correctly
You should now be able to re-launch FreeCAD and see the "PyOpticL" workbench in the workbench dropdown -
Check out the wiki for guides on how to get started and examples
PyOpticL v2.0 🚀 released! It is a complete rewrite of the PyOpticL library!
- Migrate from 1.0 to 2.0
- v2.0-Highlights
- Including Improved Optics Simulation (Gaussian beam simulation)
Wiki
Modular baseplate examples:
- Laser - Extended Cavity Diode Laser (with optical isolator)
- Doublepass AOM Baseplate
- Singlepass AOM Baseplate
- Saturation Absorption Spectroscopy Baseplate
- Periscope
- CoverBox
Modular Subsystems based on baseplates:
Apparatus based on modular subsystems:
Baseplate Examples and Designs
Pre-made Layouts
Macro files for pre-made layouts can be found in the PyOpticL directory. This can be found in:
<FreeCAD User Data Directory>/Mod/PyOpticL/Design
On windows this is:
%APPDATA%\FreeCAD\Mod\PyOpticL\Design
PyOpticL v1/v2 Migration
The main branch of this project has been updated to PyOpticL v2.0! This is a breaking change for existing designs. Unless you manually update PyOpticL within FreeCAD, existing installs should be unaffected.
If you need to install v1:
- Use Branch: v1-legacy when following the install instructions
To update to v2.0:
- Backup all locally changed files (optomech.py, stls, etc.)
- Uninstall PyOpticL from addon manager (This will delete all PyOpticL source files, backup your changes)
- Restart FreeCAD
- Re-install PyOpticL
PyOpticL Community:
Join the discussion on our Discord server: https://discord.gg/vV4NP6rXmp
Experimental Labs using PyOpticL:
- MIT QUANTA LAB (Prof. Isaac Chuang created the initial C4PO library which inspired this project)
- MIT Quantum Photonics & AI Group (Prof. Dirk Englund)
- UCONN - Prof. Simone Colombo
- Montana St. - Prof. Matt Jaffe
- UC Berkeley - Prof. Aziza Suleymanzade
- UW Madison - Prof. Josiah Sinclair
- NUS - Prof. Dzmitry Matsukevich
- Stanford - Prof. Jonathan Simon
- Quera
- Durham University
We thank Ike and the MIT QUANTA LAB for sharing their C4PO ('CAD for Precision Optics') based on OpenSCAD which inspired this library.
