Skip to main content

A simulator with programmable photonics and differentiability emphasis

Project description

Spode is an opensource differentiable simulator specialized for programmable photonics. It almost has no learning cost.

It is currently under active development.

Why to use Spode

Spode provides the most comprehensive functions for research, design of programmable photonics.

  • Spode is a frequency-domain simulator specialized for programmable photonics.
  • It supports derivative calculation of any node response to any parameter.
  • The built-in generator enables users easily produce triangular, square, and hexagonal mesh.
  • The built-in visualization function produces high-quality figures satisfying academic purposes.
  • A few functions are available for analyze the imperfections (e.g., random variation) in programmable photonics.

Installation

Spode is written in Python 3, with dependency on Numpy and Scipy. It should be installed successfully with pip:

pip install spode

A Friendly Example

from spode.util import generate
from spode.core import Circuit
import numpy as np

# generator instance for a 2 by 2 square mesh
# initialize all TBUs in the circuit

init_dict = {'theta': 0.0, 'phi': 0.0, 'l': 250e-6}
circuit_element = generate('square_1', [2, 2], init_dict)

 
# define the circuit instance and run the simulation

circuit = Circuit(
                  circuit_element=circuit_element,
                  mode_info={'neff':2.35}, # effective index
                  omega=np.linspace(192.5,193.5,1000) * 2 * np.pi, # [192.5Thz, 193.5Thz]
                  srce_node={'n_0#2_br': 1.0},
                  prob_node=['n_2#0_br'],
                  deri_node=['n_2#0_br'],
                  deri_vari=['']) 
                  
response, grads = circuit.solve() 

# Shapes by pseudo code:
# response.shape = (len(prob_node), len(omega), 2)
# grads.shape = (len(deri_node), len(deri_vari), len(omega), 2)

Tutorials

Lesson 1: a tunable basic unit. We show how to use Spode to define a tunable basic unit (TBU), the building block of programmable photonics, and verify the simulation result by comparing with Lumerical Interconnect.

Lesson 2: a 2 by 2 square mesh. We show two ways to define a 2 by2 square mesh (i.e., manually and using built-in generator), and verify the simulation result by comparing with Lumerical Interconnect.

Lesson 3: Automatic circuit generators. We illustrate a few built-in circuit generators, which could be used in a one-line manner to generate triangular, square, hexagonal mesh. We also introduce a systematic way to name the TBUs, ports presented in the circuit.

Lesson 4: Built-in visualization methods. We first illustrate the built-in visualization functions for triangular, square, hexagonal mesh. Then we explain how to visualize a customized topology by taking advantage of our provided functions.

Contact and Bug Report

If you find any bugs, or want a new feature, please open an issue, or contact me at zhengqi@mit.edu.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spode-0.0.8.tar.gz (22.0 kB view details)

Uploaded Source

File details

Details for the file spode-0.0.8.tar.gz.

File metadata

  • Download URL: spode-0.0.8.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for spode-0.0.8.tar.gz
Algorithm Hash digest
SHA256 4adac3a94bd7d38c9af3e7be1f512c684f6cb8cdc5f37a52d7976008dfc479e7
MD5 7893d11dc48e334d4d5a58ad75fb02a2
BLAKE2b-256 3c352a074932e166848e9dc782a59e3179606bb1c76ba7b7c8c7aedb811ea4ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page