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.7

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.7
File Actions
lightwave2d-0.10.7-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for lightwave2d-0.10.7-cp314-cp314-win_amd64.whl
lightwave2d-0.10.7-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.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.7-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details for lightwave2d-0.10.7-cp314-cp314-macosx_26_0_arm64.whl
lightwave2d-0.10.7-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for lightwave2d-0.10.7-cp313-cp313-win_amd64.whl
lightwave2d-0.10.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for lightwave2d-0.10.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.7-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details for lightwave2d-0.10.7-cp313-cp313-macosx_26_0_arm64.whl
lightwave2d-0.10.7-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for lightwave2d-0.10.7-cp312-cp312-win_amd64.whl
lightwave2d-0.10.7-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.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.7-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details for lightwave2d-0.10.7-cp312-cp312-macosx_26_0_arm64.whl
lightwave2d-0.10.7-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for lightwave2d-0.10.7-cp311-cp311-win_amd64.whl
lightwave2d-0.10.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for lightwave2d-0.10.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.10.7-cp311-cp311-macosx_26_0_arm64.whl CPython 3.11 CPython 3.11 macOS 26.0+ ARM64 Details for lightwave2d-0.10.7-cp311-cp311-macosx_26_0_arm64.whl

Total release size: 34.7 MB

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

Download URL lightwave2d-0.10.7-cp314-cp314-win_amd64.whl
Size 7.5 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
577e59c3b43d7de455fd008c059e849854ea2c9a7664e61b31af9de863a8bf8d
BLAKE2b-256 checksum
How to use checksums
ad0fd73182af6c3f1ff9dee93101f161781ab63c0b17bbc823ec047b76a18621
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.7-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.7-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
896ec20cfba6f80b802a4120892f6ac2e05a640ed043f0a89880b7b5b080d25d
BLAKE2b-256 checksum
How to use checksums
9a015cd0881f4899e7b96cfd0dd9d69e0ff65daa2e8db644b5f11e6ba35fdbe3
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.7-cp314-cp314-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.7-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
52e5aa2055c1657856851933d4bea036a1579046fded78453a54a999f7ae7da7
BLAKE2b-256 checksum
How to use checksums
c05a7dbd8ebacace469b0b16dbd5bb966ca69ad2b15c1d75a7caf66c380b3234
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.7-cp313-cp313-win_amd64.whl

Download URL lightwave2d-0.10.7-cp313-cp313-win_amd64.whl
Size 6.0 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
5aa0648a274a94568fa106fcda80950d567bf154592d6a3e7b3d34cae7854ab5
BLAKE2b-256 checksum
How to use checksums
bb62ae5b6b68d0994db15972f12085e6b6da1057da59876cb52df1d7716b0b1e
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.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.7-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
a4baafeb5aa51064ea93a388797bfcc55cec0b3955569bc87baf1f4e0f126528
BLAKE2b-256 checksum
How to use checksums
61384d688201bb48852b0e0f0314bfb93ec891c4ae35849fc9dad406f8d39f50
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.7-cp313-cp313-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.7-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
802e8bfba165a7374bcee83f5c53b453d2a6c71d796be2484c6e61b661599da9
BLAKE2b-256 checksum
How to use checksums
189e9dae6494d5865d9f1a6e1020d0dcd0f1f4fabeb0b4413a3e969044a4f32d
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.7-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.10.7-cp312-cp312-win_amd64.whl
Size 4.8 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
113149bdd29796b1e1aa0002f18459a63e5530a510ac119a6beb7fe9a25d2f40
BLAKE2b-256 checksum
How to use checksums
8f0f867ed6c072fdf451e017ce89a3b64d196c1a8d655a260a9b5424045f9be5
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.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.7-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
0e0dada105d29fc1c1f665be112ea3ce04437991c87a72ec239bd0b16f7a3000
BLAKE2b-256 checksum
How to use checksums
5862ee5f3b8522f1ed851af4f599a09d77a265ce8e0bf26e1496c6ae550ee19e
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.7-cp312-cp312-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.7-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
cf06b8d34f8168b63555232bf1308d66f89d704979d2ddbe1a6e157f1e4a6cc5
BLAKE2b-256 checksum
How to use checksums
7c7b8b74dc53ca7c4e42228cbda42879f427cbfa0512d4ee24634f6c083f8fcb
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.7-cp311-cp311-win_amd64.whl

Download URL lightwave2d-0.10.7-cp311-cp311-win_amd64.whl
Size 3.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
db5b7d3f0700a4c4b5802db548299acffc21581c510731b6cf74924f5deb841d
BLAKE2b-256 checksum
How to use checksums
88e8129e0b7884bf1d9835cffddbff57e35f962e744b8237843c0c92f8242a3b
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.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.10.7-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
5e0f906157e326f6ff0cab5d12afaa124e9bc8fefd5d0087a12ee465827fb8b8
BLAKE2b-256 checksum
How to use checksums
048c254f5f806f83481bb2a6b48f5e9b6d2b209ea059923a260a09713a52f648
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.7-cp311-cp311-macosx_26_0_arm64.whl

Download URL lightwave2d-0.10.7-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
01754f227071ad57aa59dfd2e0c4a1a2f1c634e1bee534d7dcdbd210b655fc8b
BLAKE2b-256 checksum
How to use checksums
1e7025281d286b1ca88a64daa4e87061bd4b065ae6ec6e111eeeef82acc9266d
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.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.

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