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

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

Total release size: 35.3 MB

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

Download URL lightwave2d-0.11.1-cp314-cp314-win_amd64.whl
Size 7.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
47e860e258fd86f7c3b99120ba99bc057864b4733ca53bf7c395821a4a21360e
BLAKE2b-256 checksum
How to use checksums
f3d85900a81b454fc68465ced73b9a800b9b06263f2d58c9dcb4ec012c81ea36
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.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.1-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
0f000dc6f94f07e3a842827fa1240c828d0803623af6a82a89933e2d2fe7262d
BLAKE2b-256 checksum
How to use checksums
59783b88d3d9c9cc1756d5111e2faa5ec4f4b49b82110e769cfebf4ceb9e9e45
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.1-cp314-cp314-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.1-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
091965050b6c8c84139a55062d737be56ad370bcbf8a8689cb0a9365436c3df6
BLAKE2b-256 checksum
How to use checksums
9020e1b645eda5e9cc5a7748db06eb3eb3c934ea8dc778cbbe985612782798b2
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.1-cp313-cp313-win_amd64.whl

Download URL lightwave2d-0.11.1-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a76f3ae3beebc7b01f720b320b2ddd39d378f42fededc6d3a9ae91163202c4e8
BLAKE2b-256 checksum
How to use checksums
c3f6175afddef41b94ec343621cdec08f81e0bde5cee796b06c4e2944d39c59c
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.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.1-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
0149b2fcf3429ed1da1eaede3b0979ec0c0ed5c60f676970909613db8a7e76fc
BLAKE2b-256 checksum
How to use checksums
fb208f6fae57f0b4d496303f1e9b19479e9f32f380e43b0310e029d70640a952
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.1-cp313-cp313-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.1-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
6db1ef9eafdf6c38e70a5894b7e8a9cbeb20fddff4ddc6b1613f0b0081f96fa3
BLAKE2b-256 checksum
How to use checksums
1f74aecb192c0105aeb56fd8ed6a19a4891973f355d9244a41f01938150b78ba
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.1-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.11.1-cp312-cp312-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
296ab829517abf028a8a73be2c16c5dd972063234383a3a25bec0e1d26460a8f
BLAKE2b-256 checksum
How to use checksums
908f2da6e5edbc9bcab3e99e24cd2bc00360bdc0467fafefecd0556a200580db
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.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.1-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
71d165dcd1c404eaf6c7e52563a40550cc8f88bbd641fa3aabd9ae957008987b
BLAKE2b-256 checksum
How to use checksums
6f9cbb993be87d9baf24736182ca0fac14c26d32e147dc3bea58f914e2f844b0
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.1-cp312-cp312-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.1-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
f5db60cc550cd7f7326c58911a9a522c8acb906edb8015a3fd2ea2868364cfd2
BLAKE2b-256 checksum
How to use checksums
789540db7b2832579b3c23359ebf16f743828ed932cebaccb42e7e92057da516
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.1-cp311-cp311-win_amd64.whl

Download URL lightwave2d-0.11.1-cp311-cp311-win_amd64.whl
Size 3.6 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
33f04e9a46d641e16eaaa85ec024947fb7c81830dd45a3d5450356e71a81b918
BLAKE2b-256 checksum
How to use checksums
e4e3970fdc8c1b7636904a4146edd0457323d309cfa1dcdc679c8690b9ba7e2f
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.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.1-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
1fafad36de72da87d283673f4c930019aaac52a7c24559dcf00fc3439fdaeff2
BLAKE2b-256 checksum
How to use checksums
80ad6b594585a894a9ecd6b44176b0b121d755753f9f927a4bcc3275c946cda1
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.1-cp311-cp311-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.1-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
c87bee2de95bbcc50d209410e4c31ad10720f84567876dd04287ae9e2b581911
BLAKE2b-256 checksum
How to use checksums
10adfa465666562afabb29b672305971d130250911d10f3bf0c56d9040c97e2e
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.1

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