Giter VIP home page Giter VIP logo

simphony's Introduction

Simphony: A Simulator for Photonic circuits

Development version PyPI Version PyPI - Python Version Build Status pre-commit Documentation Status License Latest Commit

Simphony, a simulator for photonic circuits, is a fundamental package for designing and simulating photonic integrated circuits with Python.

Key Features:

  • Free and open-source software provided under the MIT License
  • Completely scriptable using Python 3.
  • Cross-platform: runs on Windows, MacOS, and Linux.
  • Subnetwork growth routines
  • A simple, extensible framework for defining photonic component compact models.
  • A SPICE-like method for defining photonic circuits.
  • Complex simulation capabilities.
  • Included model libraries from SiEPIC and SiPANN.

Developed by CamachoLab at Brigham Young University.

Installation

Simphony can be installed via pip using Python 3:

python3 -m pip install simphony

Please note that Python 2 is not supported. With the official deprecation of Python 2 (January 1, 2020), no future compatability is planned.

Documentation

The documentation is hosted online.

Changelogs can be found in docs/changelog/. There is a changelog file for each released version of the software.

Example

Simphony includes a built-in compact model library with some common components but can easily be extended to include custom libraries.

Scripting circuits is simple and short. There are four main parts to running a simulation in Simphony:

  1. Define which component models will be used in the circuit.
  2. Add instances of components into a circuit.
  3. Define connection points.
  4. Run a simulation.

The following script models the MZI circuit shown above:

from simphony.library import siepic
from simphony.netlist import Subcircuit
from simphony.simulation import SweepSimulation

# Declare the models used in the circuit
gc = siepic.ebeam_gc_te1550()                           # grating coupler
y = siepic.ebeam_y_1550()                               # y-branch
wg150 = siepic.ebeam_wg_integral_1550(length=150e-6)    # 150 micron waveguide
wg50 = siepic.ebeam_wg_integral_1550(length=50e-6)      # 50 micron waveguide

# Create the circuit, add all individual instances
circuit = Subcircuit('MZI')
e = circuit.add([
    (gc, 'input'),
    (gc, 'output'),
    (y, 'splitter'),
    (y, 'recombiner'),
    (wg150, 'wg_long'),
    (wg50, 'wg_short'),
])

# You can set pin names individually:
circuit.elements['input'].pins['n2'] = 'input'
circuit.elements['output'].pins['n2'] = 'output'

# Or you can rename all the pins simultaneously:
circuit.elements['splitter'].pins = ('in1', 'out1', 'out2')
circuit.elements['recombiner'].pins = ('out1', 'in2', 'in1')

# Circuits can be connected using the elements' string names:
circuit.connect_many([
    ('input', 'n1', 'splitter', 'in1'),
    ('splitter', 'out1', 'wg_long', 'n1'),
    ('splitter', 'out2', 'wg_short', 'n1'),
    ('recombiner', 'in1', 'wg_long', 'n2'),
    ('recombiner', 'in2', 'wg_short', 'n2'),
    ('output', 'n1', 'recombiner', 'out1'),
])

# Run a simulation on the netlist.
simulation = SweepSimulation(circuit, 1500e-9, 1600e-9)
result = simulation.simulate()

f, s = result.data('input', 'output')
plt.plot(f, s)
plt.title("MZI")
plt.tight_layout()
plt.show()

More examples can be found in the online documentation.

simphony's People

Contributors

contagon avatar rspotc avatar sequoiap avatar smartalech avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.