SkillAgentSearch skills...

PyOpticL

PyOpticL: a code-to-CAD optical layout tool for modular optics systems engineering

Install / Use

/learn @UMassIonTrappers/PyOpticL
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<img height="100" alt="PyOpticL_logo" src="https://github.com/user-attachments/assets/6abdeee1-0d27-4417-b13f-469ae00388c7" />

PyOpticL - Code-to-CAD optical system engineering

<img width="2483" height="1172" alt="image" src="https://github.com/user-attachments/assets/2b61827e-5624-4590-b8a4-2e94640a9535" /> <img width="3341" height="1411" alt="image" src="https://github.com/user-attachments/assets/1b857ff6-a425-4261-a6f4-b00795de6f05" />

Discord Server: https://discord.gg/vV4NP6rXmp

<!-- Trapped Ion quantum computer at UMass Amherst engineered with PyOpticL: --> <!-- <img src="https://github.com/user-attachments/assets/1dbe2986-20e2-4f4e-9b4c-00dd31a4b656" width=50%> -->

ReadMe

Wiki

Modular baseplate examples:

Modular Subsystems based on baseplates:

AMO Apparatus based on modular subsystems:

3D Models and Technical Drawings

<img src="https://github.com/user-attachments/assets/b24b1d63-7b17-4de1-95dd-dcf176b8d9d6" width=500>

About PyOpticL (Python Optics Layout)

PyOpticL is a Python library for optics layout which uses beam-path simulation and dynamic beam-path routing for quick and easy optical layout by placing optical elements along the beam path without a priori specification, enabling dynamic layouts with automatic routing and connectivity. The beam paths are automatically calculated as components are placed in the layout. Component placement can be defined "along beam" to remove the need for hard-coded coordinates. Beam calculations include reflection, transmission, refraction, and diffraction (limited). This library enables a new paradigm of optical engineering using modular sub-systems of modular baseplates with commerical optical elements (see abstraction layers below).

Demonstration with Trapped Ion Qubits:

See our recent preprint for more details about our results using these laser sources and baseplates in our lab: </br> <a href="https://arxiv.org/abs/2501.14957"> arXiv:2501.14957 - Qubit operations using a modular optical system engineered with PyOpticL: a code-to-CAD optical layout tool</a>

Getting Setup

  1. Install FreeCAD, Python, and Git

  2. 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

  3. 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

  4. Check everything is setup correctly
    You should now be able to re-launch FreeCAD and see the "PyOpticL" workbench in the workbench dropdown

    <!-- <img width="250" alt="Screenshot 2023-10-27 225345" src="https://github.com/user-attachments/assets/7a43cac3-7d3b-4a3b-8e5f-189f39729251"> -->
  5. Check out the wiki for guides on how to get started and examples

  6. Read the docs library documentation

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


Example - Laser cooling and detection:

from PyOpticL import layout, optomech
from ECDL import ECDL
from Rb_SAS_V2 import Rb_SAS
from modular_doublepass import doublepass
from modular_singlepass import singlepass

def laser_cooling_subsystem():
    layout.table_grid(dx=36, dy=22)
    ECDL(x=27, y=20, angle=180)
    Rb_SAS(x=20, y=1, angle=90)
    singlepass(x=14, y=12, angle=90)
    doublepass(x=1, y=21, angle=270)

full_setup

Dynamic layouts:

Rb_SAS(0, 16, optic_type=one_inch_mounted)
Rb_SAS(0, 8, optic_type=half_inch_mounted)
Rb_SAS(0, 3, optic_type=half_inch_unmounted)
Rb_SAS(0, 0, optic_type=mini_optics)

Same code compiled with different optical elements at different scales: image

Design abstraction layers applied to a strontium trapped ion quantum computer:

from PyOpticL import layout, optomech
from SPAM_subsystem import subsystem_spam
from Laser_cooling_subsystem import laser_cooling_subsystem
from Raman_subsystem import Raman_subsystem
from Photoionization_subsystem import PI_subsystem_ECDL, PI_subsystem_commercial

layout.table_grid(dx=52, dy=92)
laser_cooling_subsystem(x=-1, y=0, thumbscrews=True)
Raman_subsystem(x=1 , y=26.5, thumbscrews=True)
PI_subsystem_commercial(x=29 , y=8, angle = 0, thumbscrews=True) #405 for sr88+ 
PI_subsystem_ECDL(x=38 , y=8, thumbscrews=True) # 461 for sr88+
subsystem_spam(x=32 , y=50, thumbscrews=True)
<img src="https://github.com/user-attachments/assets/75341182-ff6c-4106-bd7c-8fa9ee56bba2" width=700> <!-- ### Modular Doublepass Baseplate (f50 & f100 design) <p align="center"> <img src="https://github.com/user-attachments/assets/5d332f5a-defc-4eb4-8ca6-a720dad9cfe6" alt="doublepass_f50_f100" width="55%" /> </p> ### Simple ECDL (all off-the-shelf components) ![image](https://github.com/user-attachments/assets/41fba0be-d6c5-48b3-9fd5-c1e4fdddcd74) -->

PyOpticL Community Members:

  • 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
<img width="800" src="https://github.com/user-attachments/assets/da1f5e60-a97e-493c-a372-581fa3e241eb" />

Again we thank the MIT QUANTA LAB for sharing their C4PO ('CAD for Precision Optics') based on OpenSCAD which inspired this library.

View on GitHub
GitHub Stars98
CategoryDevelopment
Updated10d ago
Forks18

Languages

Python

Security Score

85/100

Audited on Mar 23, 2026

No findings