Skip to main content

Prismo

PyPI version CI codecov Documentation Status License: MIT Python 3.9+

A high-performance Python-based FDTD solver for waveguide photonics.

Prismo implements the Finite-Difference Time-Domain method for solving Maxwell's equations, with features designed for photonic integrated circuits, waveguides, and optical devices.

Features

  • 3D vectorial FDTD on Yee grids with automatic time-stepping
  • GPU acceleration via CuPy with transparent CPU fallback
  • Dispersive materials including Lorentz, Drude, Debye, and Sellmeier models
  • Material library with Si, SiO2, Si3N4, Au, Ag, Al, and ITO
  • Anisotropic materials supporting full permittivity and permeability tensors
  • PML absorbing boundaries using the CPML formulation
  • Eigenmode solver for 2D waveguide structures
  • Advanced monitors for frequency-domain (DFT), power flux, and mode expansion
  • S-parameter extraction with Touchstone export
  • Data export to CSV and Parquet formats
  • Lumerical compatibility for importing FSP files and material databases
  • Parameter sweeps with parallel execution

Installation

pip install pyprismo

For GPU acceleration:

pip install pyprismo[acceleration]

For development:

git clone https://github.com/rithulkamesh/prismo.git
cd prismo
pip install -e ".[all]"

Note: The package name on PyPI is pyprismo, but you still import it as prismo:

import prismo  # Import name stays as 'prismo'

Quick Start

import numpy as np
import prismo

# Select backend
prismo.set_backend('cupy')  # Use GPU, or 'numpy' for CPU

# Create simulation
sim = prismo.Simulation(
    size=(10e-6, 5e-6, 0),  # 10×5 μm, 2D
    resolution=50e6,         # 20 nm grid spacing
    boundary_conditions="pml",
)

# Add source
source = prismo.GaussianBeamSource(
    center=(-4e-6, 0, 0),
    size=(0, 2e-6, 0),
    frequency=193e12,  # 1550 nm
    pulse_width=10e-15
)
sim.add_source(source)

# Add DFT monitor
wavelengths = np.linspace(1.5e-6, 1.6e-6, 11)
dft = prismo.DFTMonitor(
    center=(4e-6, 0, 0),
    size=(0, 2e-6, 0),
    frequencies=(299792458.0 / wavelengths).tolist()
)
sim.add_monitor(dft)

# Run
sim.run(time=50e-15)

# Analyze
spectrum = dft.get_power_spectrum('Ex')

Documentation

Materials

# Use pre-defined materials
si = prismo.get_material('Si')
sio2 = prismo.get_material('SiO2')
au = prismo.get_material('Au')

# List all materials
print(prismo.list_materials())

# Create custom dispersive material
material = prismo.LorentzMaterial(
    epsilon_inf=2.0,
    poles=[prismo.LorentzPole(omega_0=2e15, delta_epsilon=1.0, gamma=1e13)]
)

Mode Solver

# Solve for waveguide modes
mode_solver = prismo.ModeSolver(
    wavelength=1.55e-6,
    x=x_coords,
    y=y_coords,
    epsilon=epsilon_profile
)

modes = mode_solver.solve(num_modes=3, mode_type='TE')
fundamental = modes[0]
print(f"Effective index: {fundamental.neff.real:.4f}")

# Use mode as source
mode_source = prismo.ModeSource(mode=fundamental, direction='+x', ...)

S-Parameters

# Extract S-parameters
s_analyzer = prismo.SParameterAnalyzer(
    num_ports=2,
    frequencies=frequencies
)

# Calculate metrics
s21 = s_analyzer.get_s_parameter(1, 0)
insertion_loss = s_analyzer.get_insertion_loss_db(1, 0)

# Export to Touchstone
prismo.export_touchstone("device.s2p", frequencies, s_analyzer.s_matrix)

Data Export

# Parquet (efficient, compressed)
exporter = prismo.ParquetExporter(output_dir="./results")
exporter.export_sparameters(
    filename="device",
    frequencies=frequencies,
    sparameters={'S21': s21}
)

# CSV (universal)
csv_exporter = prismo.CSVExporter(output_dir="./results")
csv_exporter.export_spectrum(...)

Performance

Typical performance on NVIDIA A100:

Dimension Grid Size Throughput
2D 1000×1000 80M cells/s
3D 100×100×100 8M cells/s

CPU performance (NumPy): ~1-2% of GPU performance.

Requirements

  • Python ≥3.9
  • NumPy ≥1.21
  • SciPy ≥1.7
  • Polars ≥0.20 (for Parquet export)

Optional:

  • CuPy ≥12.0 (for GPU acceleration)
  • Matplotlib (for visualization)

Testing

pytest tests/

Run specific test categories:

pytest tests/test_backends.py
pytest tests/validation/

License

MIT License. See LICENSE for details.

Documentation

📚 Full Documentation on ReadTheDocs

Quick Links

For Developers

Citation

If you use Prismo in academic work, please cite:

@software{prismo2025,
  author = {Kamesh, Rithul},
  title = {Prismo: Python FDTD Solver for Photonics},
  year = {2025},
  url = {https://github.com/rithulkamesh/prismo}
}

References

  • Taflove, A., & Hagness, S. C. (2005). Computational Electrodynamics: The Finite-Difference Time-Domain Method. Artech House.
  • Yee, K. S. (1966). "Numerical solution of initial boundary value problems involving Maxwell's equations in isotropic media." IEEE Trans. Antennas Propagation, 14(3), 302-307.

Metadata

Release files for pyprismo 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyprismo 0.0.1
File Size Uploaded
pyprismo-0.0.1.tar.gz 177.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyprismo 0.0.1
File Interpreter ABI Platform
pyprismo-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 292.4 kB

Release files / pyprismo-0.0.1.tar.gz

Download URL pyprismo-0.0.1.tar.gz
Size 177.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cd95769ea59e7aa9d477d3289b4871d2949b29f53f619efe24673e74ff028874
BLAKE2b-256 checksum
How to use checksums
508e9475f07278a0d9785513198808012b0081265f7a2de151d772961b6c0df4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2025.

Transparency log

Release files / pyprismo-0.0.1-py3-none-any.whl

Download URL pyprismo-0.0.1-py3-none-any.whl
Size 115.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24091cc6f4529f8c25da9062008e23f1898a39a7907fa22a6db766d8dbb07c97
BLAKE2b-256 checksum
How to use checksums
226fd566d8b851df790ba443d22b12c57dda16eb3d28fdf282cb01221be6d436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page