Skip to main content
LightWave2D — Simulating light, clearly.

LightWave2D

Badge

Status

Python versions

Python

Documentation

Documentation Status

Continuous integration

Unittest Status

Test coverage

Unittest coverage

PyPI package

PyPI version

PyPI downloads

PyPI downloads

Anaconda package

Anaconda version

Anaconda downloads

Anaconda downloads

LightWave2D is a software designed for comprehensive 2D Finite-Difference Time-Domain (FDTD) simulations, featuring a user-friendly installation and operation process. The characterization of wave propagation, scattering, and diffraction within LightWave2D is determined by a set of specific components, as illustrated in the subsequent figure.

LightWave2D integrates various components, including waveguides, scatterers (squares, circles, ellipses, triangles, lenses), gratings, and resonators. Additional parameters governing the simulation are contingent upon the attributes of the components and the simulation setup.

Key Features

  • Intuitive API for configuring simulations.

  • Support for waveguides, scatterers, gratings, and resonators.

  • Built-in tools for rendering field animations.

  • Extensive gallery of examples in the documentation.


Documentation

All the latest available documentation is available here or you can click the following badge:

Documentation Status


Installation

Install the published package with pip:

>>> pip install LightWave2D

Building Documentation Locally

To generate the HTML documentation on your machine, install the optional dependencies and run:

pip install .[documentation]
cd docs && make html
firefox build/html/index.html

Coding examples

LightWave2D was developed with the aim of being an intuitive and easy to use tool. All dimensional arguments can now be provided using pint quantities or strings with units. Below are two examples that illustrate this:

Spherical scatterer

 from LightWave2D.grid import Grid
 from LightWave2D.experiment import Experiment
 from MPSPlots import colormaps
 from TypedUnit import ureg

 grid = Grid(
     resolution=0.1 * ureg.micrometer,
     size_x=32 * ureg.micrometer,
     size_y=20 * ureg.micrometer,
     n_steps=300
 )

experiment = Experiment(grid=grid)

 scatterer = experiment.add_circle(
     position=('30%', '50%'),
     epsilon_r=2,
     radius=3 * ureg.micrometer
 )

 source = experiment.add_line_source(
     wavelength=1550 * ureg.nanometer,
     position_0=('10%', '100%'),
     position_1=('10%', '0%'),
     amplitude=10,
 )

experiment.add_pml(order=1, width="10%", sigma_max=5000 * ureg.siemens / ureg.meter)

experiment.run()

animation = experiment.render_propagation(
    skip_frame=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation.save('./spherical_scatterer.gif', writer='Pillow', fps=10)

some image

Ring resonator

from LightWave2D.grid import Grid
from LightWave2D.experiment import Experiment
from MPSPlots.colormaps import polytechnique
from TypedUnit import ureg

 grid = Grid(
     resolution=0.1 * ureg.micrometer,
     size_x=50 * ureg.micrometer,
     size_y=30 * ureg.micrometer,
     n_steps=800
 )

experiment = Experiment(grid=grid)


 scatterer = experiment.add_ring_resonator(
     position=('35%', '50%'),
     epsilon_r=1.5,
     inner_radius=4 * ureg.micrometer,
     width=2 * ureg.micrometer
 )

 source = experiment.add_point_source(
     wavelength=1550 * ureg.nanometer,
     position=('25%', '50%'),
     amplitude=100,
 )

experiment.add_pml(order=1, width="10%", sigma_max=5000 * ureg.siemens / ureg.meter)

experiment.run()

animation = experiment.render_propagation(skip_frame=5, colormap=polytechnique.red_black_blue)

animation.save('./resonator.gif', writer='Pillow', fps=10)

some image

Lens

from LightWave2D.grid import Grid
from LightWave2D.experiment import Experiment
from MPSPlots import colormaps
from TypedUnit import ureg

 grid = Grid(
     resolution=0.1 * ureg.micrometer,
     size_x=60 * ureg.micrometer,
     size_y=30 * ureg.micrometer,
     n_steps=1200
 )

experiment = Experiment(grid=grid)

 scatterer = experiment.add_lens(
     position=('35%', '50%'),
     epsilon_r=2,
     curvature=10 * ureg.micrometer,
     width=5 * ureg.micrometer
 )

 source = experiment.add_point_source(
     wavelength=1550 * ureg.nanometer,
     position=('10%', '50%'),
     amplitude=10,
 )


experiment.add_pml(order=1, width="10%", sigma_max=5000 * ureg.siemens / ureg.meter)

experiment.run()

experiment.plot_frame(
    frame_number=-1,
    enhance_contrast=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation = experiment.render_propagation(
    skip_frame=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation.save('./lens.gif', writer='Pillow', fps=10)

some image

Plenty of other examples are available online; see the examples section of the documentation.

Testing

To test locally (with cloning the GitHub repository) you’ll need to install the dependencies and run the coverage command as

>>> git clone https://github.com/MartinPdeS/LightWave2D.git
>>> cd LightWave2D
>>> pip install -r requirements/requirements.txt
>>> coverage run --source=LightWave2D --module pytest --verbose tests
>>> coverage report --show-missing

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.


Contact Information

As of 2024 the project is still under development if you want to collaborate it would be a pleasure. I encourage you to contact me.

LightWave2D was written by Martin Poinsinet de Sivry-Houle .

Email:martin.poinsinet-de-sivry@polymtl.ca .

Metadata

Release files for LightWave2D 0.10.8

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

Built distributions (wheels)

Table of built distributions (wheels) for LightWave2D 0.10.8
File Actions
lightwave2d-0.10.8-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for lightwave2d-0.10.8-cp314-cp314-win_amd64.whl
lightwave2d-0.10.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for lightwave2d-0.10.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.8-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details for lightwave2d-0.10.8-cp314-cp314-macosx_26_0_arm64.whl
lightwave2d-0.10.8-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for lightwave2d-0.10.8-cp313-cp313-win_amd64.whl
lightwave2d-0.10.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for lightwave2d-0.10.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.8-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details for lightwave2d-0.10.8-cp313-cp313-macosx_26_0_arm64.whl
lightwave2d-0.10.8-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for lightwave2d-0.10.8-cp312-cp312-win_amd64.whl
lightwave2d-0.10.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for lightwave2d-0.10.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.8-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details for lightwave2d-0.10.8-cp312-cp312-macosx_26_0_arm64.whl
lightwave2d-0.10.8-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for lightwave2d-0.10.8-cp311-cp311-win_amd64.whl
lightwave2d-0.10.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details for lightwave2d-0.10.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.8-cp311-cp311-macosx_26_0_arm64.whl CPython 3.11 CPython 3.11 macOS 26.0+ ARM64 Details for lightwave2d-0.10.8-cp311-cp311-macosx_26_0_arm64.whl

Total release size: 34.7 MB

Release files / lightwave2d-0.10.8-cp314-cp314-win_amd64.whl

Download URL lightwave2d-0.10.8-cp314-cp314-win_amd64.whl
Size 7.5 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
eb5967191091741a0430a7b11e2ded6938e912df534c6c45e9ef4fe143c3e53e
BLAKE2b-256 checksum
How to use checksums
5ea9c618d56f8e214871d4c2534a7d7e1bac4f35068b25d6d3eb96aea5e6c279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.8-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.1 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1335cfb62a2a14f9bd83c9d4d281255e1224ef81ecdb05c406552fa07e65ab32
BLAKE2b-256 checksum
How to use checksums
b1308e313289e451496b9a9a37051c47cb74d5903b89c0e6a809324bfb13f034
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp314-cp314-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.8-cp314-cp314-macosx_26_0_arm64.whl
Size 1.5 MB
Tags CPython 3.14 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
a6f4afa830641cff9ba95f288c46a2b1780384dd90d7345eacf4a7cff62ecc19
BLAKE2b-256 checksum
How to use checksums
010e31d8afb4017f6029967249fc52700ecbd592c20a2b1849f87dd670b3e676
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp313-cp313-win_amd64.whl

Download URL lightwave2d-0.10.8-cp313-cp313-win_amd64.whl
Size 6.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
08224df048a5c8cbab18b391dd37d88171f29792efc007500081c1bc14333e73
BLAKE2b-256 checksum
How to use checksums
ee9a773fb2225b2e2c7da707df3d4db7e9dbc84a74b81204479e39c63161d114
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.9 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ff1e3e9c1d1ea10f0679cdfa432497620451914912054a5866012e5aff0e0258
BLAKE2b-256 checksum
How to use checksums
20102b0aeb5215634d3be92ce8eefdb92a29306a298ee159629628aaab5da2db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp313-cp313-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.8-cp313-cp313-macosx_26_0_arm64.whl
Size 1.4 MB
Tags CPython 3.13 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
c1697ed165ce4ec0a25f8fc91ac191c244a575262cd03c0d197cdb114395aaeb
BLAKE2b-256 checksum
How to use checksums
388097ee18708acecf9a357c92c58c0b5859e0b5fc3f989e0e7e26cca10117c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.10.8-cp312-cp312-win_amd64.whl
Size 4.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
74d1000b407868a54fd2b63ca44e31d5fc9a5d7ad6954a87661642d407440aff
BLAKE2b-256 checksum
How to use checksums
8346ef0a3c10c1bc6f9d0666fcc30595541165e78a08cd83ff1dfb77c664c681
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.8 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1423334c4e9760726765758cd11a856d5ba342fcda36d3bb52d50da26bcf1b94
BLAKE2b-256 checksum
How to use checksums
ddecb954f2813d2f54a268993e2786ef1e3affd4ece434272aa763ff196d46c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp312-cp312-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.8-cp312-cp312-macosx_26_0_arm64.whl
Size 1.3 MB
Tags CPython 3.12 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
c41d52d69f70e599c3bfc0a0d31b957ca735ad9a88c0617f90567cb96a8b8495
BLAKE2b-256 checksum
How to use checksums
11aca09860057ba1d18f6371b1ff1ab42a054c7015b955b735283eedf4633a0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp311-cp311-win_amd64.whl

Download URL lightwave2d-0.10.8-cp311-cp311-win_amd64.whl
Size 3.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
c3ff0b78b14ae9eb493bbbc0c196196e9ab7386b09c99ffcef8e6be264e0d064
BLAKE2b-256 checksum
How to use checksums
3a6590c79cace432815a696e13d374871d0b97f0f2084073d213824c9cdd66e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
ee91b50e33446f09d530770073ad6c03b187fd1a036795d141149db24975025b
BLAKE2b-256 checksum
How to use checksums
b44f5092741ba52cdce656281b5ab9404e79646103d47cdce3490618907f94cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / lightwave2d-0.10.8-cp311-cp311-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.8-cp311-cp311-macosx_26_0_arm64.whl
Size 1.2 MB
Tags CPython 3.11 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
9b02fca86c782138179328a597ad3a1f943054be95f2f5f3fef9ea8a8cf797fc
BLAKE2b-256 checksum
How to use checksums
f6b1bcae066016e0269f13e784df4dcdd2fd8eca99225874c47e08eb1867c578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for LightWave2D 0.10.8

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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