Skip to main content

Design, analysis, and optimization of programmable electromagnetic metasurfaces

Project description

metasurface-py

CI Python 3.11+ License: BSD-3

Open-source Python package for design, analysis, and optimization of programmable electromagnetic metasurfaces for wireless communication and sensing.

Installation

pip install -e ".[dev]"

Quickstart

import numpy as np
from metasurface_py.geometry import RectangularLattice
from metasurface_py.elements import PhaseOnlyCell, DiscretePhaseSpace
from metasurface_py.surfaces import Metasurface
from metasurface_py.em import steering_phase, far_field_pattern
from metasurface_py.core.types import AngleGrid
from metasurface_py.plotting import plot_pattern_2d

lattice = RectangularLattice(nx=32, ny=32, dx=5.4e-3, dy=5.4e-3)
cell = PhaseOnlyCell(state_space=DiscretePhaseSpace(num_bits=2))
surface = Metasurface(lattice=lattice, cell=cell, mode="reflect")

freq = 28e9
phase = steering_phase(lattice, theta_steer=np.radians(30), phi_steer=0.0, freq=freq)
state = surface.set_state(phase).quantize(cell.state_space.codebook)

angles = AngleGrid.from_degrees(theta=np.arange(-90, 91, dtype=float), phi=np.array([0.0, 90.0]))
pattern = far_field_pattern(surface, state, freq=freq, angles=angles)
plot_pattern_2d(pattern, cut_phi=0.0)

Features

  • Metasurface modeling — Rectangular/hexagonal lattices, phase-only and lookup-table unit cells, amplitude-phase coupled elements
  • Far-field analysis — Array factor, directivity, sidelobe level, HPBW, beam steering, focusing, multi-beam synthesis
  • Optimization — Continuous (L-BFGS-B, DE), discrete refinement, relax-then-quantize pipeline, multi-objective Pareto sweeps
  • Hardware constraints — Phase quantization, grouped control lines, dead elements, manufacturing noise
  • RIS channel models — Free-space path loss, narrowband SISO RIS-assisted links, optimal phase computation
  • Sensing — Monostatic/bistatic RCS, detection SNR, Fisher information, CRLB for localization
  • Mutual coupling — Canonical dipole coupling approximation
  • Publication-quality plotting — 13+ plot functions, IEEE/Nature/poster presets, colorblind-safe palettes, PDF/PNG export
  • Experiment management — TOML configs, parameter sweeps, reproducibility metadata
  • Interoperability — CSV/HDF5/Touchstone import, scikit-rf adapter, xarray labeled outputs

Tutorials

Interactive Jupyter notebooks that run in Google Colab (no install required):

Notebook Description Colab
01 Getting Started Create a metasurface, steer a beam, compare quantization Open In Colab
02 Optimization Relax-then-quantize with hardware constraints Open In Colab
03 RIS Link RIS-assisted communication link, N² scaling Open In Colab
04 Sensing & ISAC Radar detection, localization CRLB, comms-sensing tradeoff Open In Colab

Citation

If you use metasurface-py in your research, please cite:

@software{metasurface_py,
  author       = {Hodge, John},
  title        = {metasurface-py: Design, analysis, and optimization of programmable electromagnetic metasurfaces},
  year         = {2026},
  url          = {https://github.com/jman4162/metasurface-py},
  version      = {0.1.0},
  license      = {BSD-3-Clause},
}

License

BSD-3-Clause

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

metasurface_py-0.1.0.tar.gz (78.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metasurface_py-0.1.0-py3-none-any.whl (65.5 kB view details)

Uploaded Python 3

File details

Details for the file metasurface_py-0.1.0.tar.gz.

File metadata

  • Download URL: metasurface_py-0.1.0.tar.gz
  • Upload date:
  • Size: 78.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metasurface_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63b0d9fbdefd9c449c41c7a7bc6622e42f6416c638c6c1896f170e38a0dda344
MD5 2410fe69edfe265e62ff6ef822b6b32f
BLAKE2b-256 330c046ea82b7f20288a8d2c9df58098122b368d2e3ac147811b1e1544a7da4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for metasurface_py-0.1.0.tar.gz:

Publisher: publish.yml on jman4162/metasurface-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file metasurface_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: metasurface_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 65.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for metasurface_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 48ec37ba3c0e4cfe40596ffb9bc75e7de464c9075e82ad971795fbe113fce573
MD5 4fbfc5a40e363a8513ba9c321f6e5676
BLAKE2b-256 2f19f5218557b28265d736f66ec082cc2bd4569a0586349b8cdc595744dffbd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for metasurface_py-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jman4162/metasurface-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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