Skip to content
/ femto2 Public

Python library for design of femtosecond laser-written integrated photonic circuits.

License

Notifications You must be signed in to change notification settings

ricalbr/femto2

Repository files navigation

Logo



Python library for the design of femtosecond laser-written integrated photonic circuits.

Latest version Python 3.8 + License: GPL v3

Codecov Tests Documentation Status pre-commit.ci status

femto is an open-source package for the design of integrated optical circuits. The library consists of a growing list of parts and modules, which can be composed to construct complex optical components and large circuits. The optical components can be plotted and exported to a .pgm file for the fabrication of the circuit.

femto logo Table of Contents

Installation

The package can be installed using pip

pip install git+https://github.com/ricalbr/femto.git

(back to top)

Usage

Here a brief example on how to use the library.

First, import all the required modules

from femto.curves import sin
from femto.device import Device
from femto.pgmcompiler import PGMCompiler
from femto.waveguide import Waveguide

Set waveguide parameters

PARAM_WG = dict(scan=4,
                speed=7.5,
                depth=0.050,
                radius=25)

Create a list of waveguides as

wgs = []

# SWG
wg = Waveguide(**PARAM_WG)
wg.start([-2, 4.5, 0.050])
wg.linear([27, 4.5, 0.050], mode='ABS')
wg.end()
wgs.append(wg)

# MZI
for i in range(6):
    wg = Waveguide(**PARAM_WG)
    wg.start([-2, 5+i*0.080, 0.500])
    wg.linear([10, 0, 0], mode='INC')
    wg.mzi(dy=(-1)**i * 0.037, dz=0, fx=sin)
    wg.linear([27, 5+i*0.080, 0.500], mode='ABS')
    wg.end()
    wgs.append(wg)

Now that the waveguides are defined, we set the fabrication parameters

PARAM_GC = dict(filename='MZIs.pgm',
                laser='PHAROS',
                samplesize=(25, 10),
                rotation_angle=0.0)

Create a Device object that allows to store the waveguides and plot them

# CIRCUIT
circuit = Device(**PARAM_GC)

# Add waveguides to circuit
circuit.extend(wgs)

# Make a plot of the circuit
circuit.plot2d()

Export the G-Code with the following commands

# Export G-Code file
with PGMCompiler(**PARAM_GC) as G:
    G.tic()
    with G.repeat(6):
        for i, wg in enumerate(wgs):
            G.comment(f' +--- Mode: {i + 1} ---+')
            G.write(wg.points)
    G.toc()
    G.go_origin()

Other example files can be found here.

(back to top)

Documentation

The complete documentation can be found here.

(back to top)

Issues

To request features or report bugs open an issue here

(back to top)