Skip to main content

LightWave2D

LightWave2D logo

Badge

Status

Python versions

Supported Python versions

Documentation

Documentation

Tests

Tests Test coverage

PyPI

PyPI version Monthly PyPI downloads

Conda

Anaconda version Anaconda downloads Latest Anaconda release

A package for finite-difference time-domain simulation of light propagation.

Set the grid, material boundaries, source, and absorbing layers to model propagation of an electromagnetic pulse in two dimensions. The circular-scatterer example shows the incident and scattered waves evolving together.

See the usage guide for further examples and implementation details.

Installation

Requires Python >=3.10.

$ python -m pip install LightWave2D

Install from the martinpdes Conda channel:

$ conda install -c martinpdes lightwave2d

For an editable source installation:

$ git clone https://github.com/MartinPdeS/LightWave2D.git
$ cd LightWave2D
$ python -m pip install -e .

Scatter a wave from a circular inclusion

"""
Circular Scatterer
==================

This example demonstrates the setup and execution of a circular scatterer experiment using LightWave2D.
We will define the simulation grid, add a circular scatterer and a line source, apply a perfectly matched layer (PML), run the simulation, and visualize the results.
"""

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

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

experiment = Experiment(grid=grid)

scatterer = experiment.add_circle(
    position=("30%", "50%"),  # Center position of the scatterer
    epsilon_r=1.5,  # Relative permittivity of the scatterer
    radius=3 * ureg.micrometer,
    sigma=0 * (ureg.siemens / ureg.meter),  # Conductivity of the scatterer
)

source = experiment.add_line_source(
    wavelength=1550 * ureg.nanometer,
    position_0=("10%", "80%"),  # Starting position of the source
    position_1=("10%", "20%"),  # Ending position of the source
    amplitude=10,  # Amplitude of the source
)

experiment.add_pml(
    order=1,  # Order of the PML polynomial profile
    width="10%",  # Width of the PML region as a percentage of grid size
    sigma_max=5000 * (ureg.siemens / ureg.meter),  # Maximum conductivity for the PML
)

experiment.plot()

result = experiment.run(field_every=5)

# %%
# Render an animation of the field propagation over time
animation = result.render_propagation(
    skip_frame=1,  # Animate every stored field frame
    colormap=colormaps.polytechnique.red_black_blue,  # Colormap for the animation
    enhance_contrast=3,  # Enhance contrast for better visualization
    save_as="./circular_scatterer.gif",  # Save the animation as a GIF file
    fps=30,
)
https://raw.githubusercontent.com/MartinPdeS/LightWave2D/HEAD/docs/images/spherical_scatterer.gif

Time evolution of the field around a circular scatterer.

Documentation

Use the LightWave2D documentation to work through examples and look up the inputs and return values of individual functions.

Contributing

Bug reports, worked examples, and documentation corrections are welcome. To set up a development checkout and run the tests, follow the contributing guide.

Contact

For questions, contact Martin Poinsinet de Sivry-Houle.

License

See the LightWave2D license for terms of use.

Metadata

Release files for LightWave2D 0.11.2

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

Total release size: 35.3 MB

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

Download URL lightwave2d-0.11.2-cp314-cp314-win_amd64.whl
Size 7.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
ad56c03955d4b7e008a98b23446f884520e90fb1c3464e8087432423f1761f82
BLAKE2b-256 checksum
How to use checksums
610652efb46ea867cb772ed17675eb01c61a630d1389f58e54f15d310f51da8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 2.2 MB
Tags CPython 3.14 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e9899347a4973d1989ddae82d2befc402005e51824079dde6c37b65f56e455a6
BLAKE2b-256 checksum
How to use checksums
2ff73db8d72003fb0cea3d1b313541bcd5c60f7f87cbac2beaaad19e23c4c226
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-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
66cfb4fe799a0f5986488ff5f0c88597a4b628785e26a888cbdcef791c49fd65
BLAKE2b-256 checksum
How to use checksums
ecb0ef04156b426c2bb14c8ef45b1381ce03e714a6deb88e3f299eea75432d6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
2b35f2594ee7ce1080c56d7f5a3f3ffab31a515249e37f45424d4d7c195e6dbb
BLAKE2b-256 checksum
How to use checksums
d886e480fd6e6ab4a35b81babd8bd9b7d31bfb2ac29577d3adfd4b62ad23d4fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

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

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

Download URL lightwave2d-0.11.2-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
7350527ea5a2907ddd39a898278f94156cd7ca3270f82fa80db596cb50ea5bd1
BLAKE2b-256 checksum
How to use checksums
c238028ed3e393e3837fdbb9533272907e0ecf60860d3c1d2bf778281c05b784
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-cp312-cp312-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
3725c97c959a11fefe0be20ee128a230e9200244b5a4f5018fa19f34e05034a3
BLAKE2b-256 checksum
How to use checksums
9740b33ff63aa7fdce083aea03133a580e94678654512faec266b90414ddeeae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-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
c2e61b45d078cdf91e68d86a90bde528f03fbf766746fdc4a1b7bbc7c70a79b8
BLAKE2b-256 checksum
How to use checksums
f592186fbfdd7ab691548e5e02a623bc9510d605a05057afdc6f51c252f98ef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

Download URL lightwave2d-0.11.2-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
9058ca3e5e801ce6fe4ce15ae4bf6822fb679f1316ec1eb3e047dcb62bd84004
BLAKE2b-256 checksum
How to use checksums
453b6204e8a7e16a060a12e3dc7e8eee87374dbffaa59466b249fb6fd91bd1ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

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

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

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

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

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

Download URL lightwave2d-0.11.2-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
df2a1af7fdae61c8233c48a4a12c43e799120f00ac507e0e8a59a1b97fd78983
BLAKE2b-256 checksum
How to use checksums
71c98d618238209bf4abd55f005317d0dfe26175bfc69b6ca80c15119fb5cd80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.18

Security for LightWave2D 0.11.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.

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