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

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.3
File Actions
lightwave2d-0.11.3-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details for lightwave2d-0.11.3-cp314-cp314-win_amd64.whl
lightwave2d-0.11.3-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.11.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.11.3-cp314-cp314-macosx_26_0_arm64.whl CPython 3.14 CPython 3.14 macOS 26.0+ ARM64 Details for lightwave2d-0.11.3-cp314-cp314-macosx_26_0_arm64.whl
lightwave2d-0.11.3-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details for lightwave2d-0.11.3-cp313-cp313-win_amd64.whl
lightwave2d-0.11.3-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.11.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.11.3-cp313-cp313-macosx_26_0_arm64.whl CPython 3.13 CPython 3.13 macOS 26.0+ ARM64 Details for lightwave2d-0.11.3-cp313-cp313-macosx_26_0_arm64.whl
lightwave2d-0.11.3-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for lightwave2d-0.11.3-cp312-cp312-win_amd64.whl
lightwave2d-0.11.3-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.11.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.11.3-cp312-cp312-macosx_26_0_arm64.whl CPython 3.12 CPython 3.12 macOS 26.0+ ARM64 Details for lightwave2d-0.11.3-cp312-cp312-macosx_26_0_arm64.whl
lightwave2d-0.11.3-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for lightwave2d-0.11.3-cp311-cp311-win_amd64.whl
lightwave2d-0.11.3-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.11.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
lightwave2d-0.11.3-cp311-cp311-macosx_26_0_arm64.whl CPython 3.11 CPython 3.11 macOS 26.0+ ARM64 Details for lightwave2d-0.11.3-cp311-cp311-macosx_26_0_arm64.whl

Total release size: 35.3 MB

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

Download URL lightwave2d-0.11.3-cp314-cp314-win_amd64.whl
Size 7.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
48a38a8eaa35ec2cd3918a7e314efad69a9afc5aff7ac8eba4df85af7047ef46
BLAKE2b-256 checksum
How to use checksums
a64cc2c8de0af062b730ad1b387cd0e49ab8ed56aeba1407dcee8910a61d696a
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.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.3-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
c6d6d6e11531545159b92bf93e1d53838bfb07a44b7f8d49934d83e4c54ed407
BLAKE2b-256 checksum
How to use checksums
5180a5041938d413cd250bf3d9e91cbe5bbb9099d4e67cd9d28fdf9651d5ed56
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.3-cp314-cp314-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.3-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
040561141a907b60ad264d6dca76ecb9c4500df956e71b2eef70e648f0453006
BLAKE2b-256 checksum
How to use checksums
d7e378b05268f74d1a9026acd880a83600c082f47fb91ab880dc2076c878876d
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.3-cp313-cp313-win_amd64.whl

Download URL lightwave2d-0.11.3-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
47d4cc6a5720a297b513f42a0e35d89446130d6f3d023a662f6f69b6dba6acdd
BLAKE2b-256 checksum
How to use checksums
dcc71e42bbb9589347e0da55210455484a086dc3094107fdd348a0b97cbbb404
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.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.3-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
119106332e42320da54795646bc73c72900dada1e7d8f27a17dfbbb6e633150f
BLAKE2b-256 checksum
How to use checksums
a3d3fc6b00dc28f2da61aa378074d7db3c43f3ef8b6e3b556b9cb03156fe0d75
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.3-cp313-cp313-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.3-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
3b6e9be7ae90cb599619d9eddae01813d091563a2caf0b927dbd5b93fff21274
BLAKE2b-256 checksum
How to use checksums
db1fbb16a354345de24b9b493c16e934d0feb19525732aa6e8a2d562e2a98ba5
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.3-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.11.3-cp312-cp312-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
bdb68a2f0e32ef1e6aff83514f1065623e5cc3f2f83fb61ada251c3fe1a086db
BLAKE2b-256 checksum
How to use checksums
efb4e0941f3938ca2dddf5bf7c9b81278a913a524a82d7facea8392ff9d17045
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.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.3-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
f007d67b8dc4b06cb94064a2d2e794f21a3ffc12cfe041c5c88a0faca2462fa8
BLAKE2b-256 checksum
How to use checksums
cd34f302f7c1dd5bf3b287440a1e923da405525c4a5ee97b57a8ec591e09eee0
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.3-cp312-cp312-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.3-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
87903c11edff2b0e49852ada7990347d472f4d6673872b621abc88adad78b285
BLAKE2b-256 checksum
How to use checksums
644695c14c0861e542de4e6bc731a9a2c7615f013b3ae8728183839003e29ccf
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.3-cp311-cp311-win_amd64.whl

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

Download URL lightwave2d-0.11.3-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
f1aa679d11a782c2a4733958626cbd3b761efd3e6fcef083bc055bee24b38b4b
BLAKE2b-256 checksum
How to use checksums
24690ecb5149a1dd09da2b67f5888300487b985b719f45ac1e423301e02c2743
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.3-cp311-cp311-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.3-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
cc95158b7f825b901c897638fdbe484a02745af3fdb0b6283c6b8d4ea5f6971b
BLAKE2b-256 checksum
How to use checksums
f163c09a8f5cc54b1db86b7c94dcfd4e596b3ac680dc4c8c00087a7cb955b5f0
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.3

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