Skip to main content

bamsolve

Predict photonic circuits with AI. The API is free during the public alpha.

Get started

  1. Install the package:
python -m pip install --upgrade bamsolve
  1. Enter your email at https://bamsolve.com/#get-key. Copy the API key shown on the page.
  2. Run the example below. It downloads a ready-to-use GDS and asks for your key with hidden input.
from getpass import getpass
from urllib.request import urlretrieve
from bamsolve import Layer, Stack, bamsolve, pred

urlretrieve(
    "https://bamsolve.com/examples/ebeam_y_1550.gds",
    "ebeam_y_1550.gds",
)
bamsolve(api_key=getpass("Bamsolve API key: "))

stack = Stack(clad=1.444, layers={(1, 0): Layer(n=3.48, z=(0.0, 0.22))})
dev = stack("ebeam_y_1550.gds")
res = pred(dev, inputs={((1, 10), "TE", 1.55)})

print("S shape:", res.S.shape)  # (1, 3, 3)
print("Upper-arm power:", abs(res.S[0, 1, 0]) ** 2)
print("Lower-arm power:", abs(res.S[0, 2, 0]) ** 2)
res.export_s("ebeam_y_1550.s3p")

The example is a 15 µm silicon Y-branch with three ports. Its core is on GDS layer/datatype (1, 0). Port opt1 is at the left end on (1, 10). Port opt2 is at the upper-right end on (1, 11). Port opt3 is at the lower-right end on (1, 12). The z bounds and wavelength are in micrometres. Refractive indices have no units.

This device includes a split and two curved arms. A full 3D FDTD test must resolve these features, the core thickness, and the surrounding cladding. A direct full-matrix calculation also needs a separate input at each port. This takes more work than a straight-waveguide check. The tutorial does not give an FDTD runtime for your computer; runtime depends on the mesh, simulation duration, and hardware.

res.S contains every input and output port for the returned polarization, with shape (wavelength, output_port, input_port). In this example, array index 0 is the left port, index 1 is the upper-right port, and index 2 is the lower-right port. The input tuple selects the field shown in res.E; it does not restrict the S-matrix to one column. res.n_eff holds the effective index. res.E is a complex array indexed as [y, x], on the coordinates res.y and res.x in micrometres.

Read the Get started tutorial for downloadable scripts, a simple straight-waveguide check, port instructions, and plotting. You can also create the straight GDS with gdstk. The downloaded GDS does not require gdstk to run a prediction.

Check the exported file

Install an independent Touchstone reader with python -m pip install scikit-rf, then run:

import numpy as np
import skrf

network = skrf.Network("ebeam_y_1550.s3p")
assert np.allclose(network.s, res.S, atol=1e-7)
print(network.f)  # Frequency in Hz

This checks file compatibility. It does not independently validate the predicted physics.

API configuration

The default API address is https://api.bamsolve.com.

You can set BAMSOLVE_API_KEY before starting Python instead of entering the key in your script. Keep the key out of source control and shared notebooks.

To use a custom server, set its URL before you call pred:

bamsolve(api_key="bsk_...", url="https://YOUR_API_HOST")

You can also set the BAMSOLVE_URL environment variable before you import the module.

Metadata

Release files for bamsolve 0.1.2

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

Source distribution (sdist)

Source distribution for bamsolve 0.1.2
File Size Uploaded Provenance
bamsolve-0.1.2.tar.gz 3.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 8.2 kB

Release files / bamsolve-0.1.2.tar.gz

Download URL bamsolve-0.1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a0975627380c7b1bab071abdaf9dc5f9072e902f97827103bb83bf6a378ef204
BLAKE2b-256 checksum
How to use checksums
3f5b3231a81d826680e5d5feccdec7bf3a39534bb362a76f5d7bea46653a9195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bamsolve-0.1.2-py3-none-any.whl

Download URL bamsolve-0.1.2-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5e23ab722aca6131da17679cb0d2f6a8b10504e6bd06d12af3bd3209b2a6c147
BLAKE2b-256 checksum
How to use checksums
3ab2cd971601cafd2245e88b5ed7df58133fd31447793662a48b08edf1b31fcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.9 {"installer":{"name":"uv","version":"0.11.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for bamsolve 0.1.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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