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

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

Total release size: 35.3 MB

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

Download URL lightwave2d-0.11.4-cp314-cp314-win_amd64.whl
Size 7.6 MB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
23091de1c849af03dcbfdba98ed8ef969459784025f55a43a9b6bb0385b4624c
BLAKE2b-256 checksum
How to use checksums
0e676562e8e27d447944d51e076a4df8ba34e2a0444b223bc287fcc5a3473ab3
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.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.4-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
207faa096c723f1bfcae525c63c941d095dd5468744506f342a20557e21c102a
BLAKE2b-256 checksum
How to use checksums
6733e9e2f72707bb6b7b474a8503916fb896008eec5b13075001720066b44772
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.4-cp314-cp314-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.4-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
c835c7ce39d7b64c1cfbce9e8b36f8b0e936eb6b09a6a4e5e7dccec676c53e3f
BLAKE2b-256 checksum
How to use checksums
2d3689e4bbc57b5ebe4216dfdb9a97d68cc7aef0b5f57e69a05da4eb0de5a058
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.4-cp313-cp313-win_amd64.whl

Download URL lightwave2d-0.11.4-cp313-cp313-win_amd64.whl
Size 6.1 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
85719c560e288a3f4d5a5268c7af899f6e21ef89e7734b98e00556e4653da1de
BLAKE2b-256 checksum
How to use checksums
3843a8f7be861e798922d6d9ce0b0f98a2e8a900d191b268621b0fdf0979a0f4
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.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.4-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
6f29108fe0a6c41aad274f21b1bc9cac80bb63ab8a99f56458ddc38a8915aa24
BLAKE2b-256 checksum
How to use checksums
129addc0aef72698de10d72e8540079c75548e308cb86cb12ccadeb27412674b
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.4-cp313-cp313-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.4-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
9d438a66f57a6b6259c6c699afc0597414aa609fbebb1698536225c70bee53f0
BLAKE2b-256 checksum
How to use checksums
9715739335ccec0ba84c12b63a6231655a13c1a3c69d64de5be47bbbe10ced58
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.4-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.11.4-cp312-cp312-win_amd64.whl
Size 4.9 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
b436f73fa74de926e0422b51f1f946eec0edfce99f07a6706e9f9df2861f2b17
BLAKE2b-256 checksum
How to use checksums
9d9106dce670e50cbe2e80a4e961e62bd79afebb00288a6cdb9626936ea55c6d
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.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL lightwave2d-0.11.4-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
4c1c03eb8a2933c26c907ffe24a6611dd16c05f621fbdad8b39e5cadaf022bbd
BLAKE2b-256 checksum
How to use checksums
589e67353fc414323ce4d15a722fc578074786ed45e37ed85b5f0901e611b776
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.4-cp312-cp312-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.4-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
ef17c571dfde12d6048d700881589df3c70bf549517d6feb01a222943f95ae66
BLAKE2b-256 checksum
How to use checksums
0d0b82601df229d539c1b0ef00159d66849afc8bbef2e360ba2d4881306f8d3b
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.4-cp311-cp311-win_amd64.whl

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

Download URL lightwave2d-0.11.4-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
75b6681c5f1e2332dbbd9af4e7f1e23f5d8f927eb507160641271f2fa3b07a52
BLAKE2b-256 checksum
How to use checksums
98f9b57c879b10955cd533b3f731bf618e3e0cfd4b3d394213b5ecb4052a7a06
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.4-cp311-cp311-macosx_26_0_arm64.whl

Download URL lightwave2d-0.11.4-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
456407355433f615cc0116a162e5778721e3dd28c8e3f667b7a4731656c9b332
BLAKE2b-256 checksum
How to use checksums
6f23c7315a671902d9b9d43ca64733a80a4b04749db5f182c01e9ba55945076e
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.4

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