LightWave2D
Badge |
Status |
|---|---|
Python versions |
|
Documentation |
|
Tests |
|
PyPI |
|
Conda |
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,
)
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.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 34.9 MB
Release files / lightwave2d-0.11.0-cp314-cp314-win_amd64.whl
| Download URL | lightwave2d-0.11.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 7.5 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
10447a155aa21e4a09ae16d5f2ae82424f79fd3857dcd95607a32f5286896f09
|
|
BLAKE2b-256 checksum How to use checksums |
320c72274d37cb650cd4bf7d77e22109ab668653cadb48b9981ec1e96dcb2fbc
|
| 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.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lightwave2d-0.11.0-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 |
83961ffeb34f8d493eb46fc8cc6c3c7c81e5e7527fe903f51ae1cd92c34a7f40
|
|
BLAKE2b-256 checksum How to use checksums |
7673c3ece80cfca1e7b73a502d01112e17f8c2b42a949bf3263b79afccf004cc
|
| 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.0-cp314-cp314-macosx_26_0_arm64.whl
| Download URL | lightwave2d-0.11.0-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 |
a4596423b98a741284d5ee1aac0f0b95f6240def4cb7a42d9c2c58dace5b4232
|
|
BLAKE2b-256 checksum How to use checksums |
259e386b54c5bd1f090af5f9f7589276b6828ba8d36bd5eb03da2efafaa73eec
|
| 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.0-cp313-cp313-win_amd64.whl
| Download URL | lightwave2d-0.11.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a6eae8db995731e97d7d467c693b849be6a5bff51ae5e7f4b50884244de6d56b
|
|
BLAKE2b-256 checksum How to use checksums |
06947930c11b76c12bbdb28e36deaf22995d2c7b1ffee3869cc46d4f16b92b87
|
| 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.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lightwave2d-0.11.0-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 |
805935818519c98d1be85289469ec1f4ef13b72ec8084352ff83504b18791a01
|
|
BLAKE2b-256 checksum How to use checksums |
37d15eeb839f586218de23a0fc89195ec1d225b2cfb170ce6ebb38db3e8e2c6d
|
| 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.0-cp313-cp313-macosx_26_0_arm64.whl
| Download URL | lightwave2d-0.11.0-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 |
8ad0144e83f63b9b7cf4ada5e2fa45f9dd1ae00e936f5cf400d668d945fda22e
|
|
BLAKE2b-256 checksum How to use checksums |
87f20531ee89f1758a03f67e88526912f5496fe96f0c9a694e49772d9fb5c52c
|
| 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.0-cp312-cp312-win_amd64.whl
| Download URL | lightwave2d-0.11.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.8 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
62ab564a555d6a7b96948e8adfb20fe01b4ebebf70b9d6973e7028a700aa493d
|
|
BLAKE2b-256 checksum How to use checksums |
ed3b1e48fce7389e2410183c5054b1d6bd99e2d337ddbc5fdd4853558202e855
|
| 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.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lightwave2d-0.11.0-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 |
07e840136caedc6b220c9e4a1ce98f9a81199fd53b7f60c00026ce6f30d12a50
|
|
BLAKE2b-256 checksum How to use checksums |
cf84f60344f37d3dd663ccbff35496cc83a109036fad1167dc4f909405611e3e
|
| 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.0-cp312-cp312-macosx_26_0_arm64.whl
| Download URL | lightwave2d-0.11.0-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 |
d3285dbf20227107437a27576b449157b03e77b6760f90b026d91641ef82c8b1
|
|
BLAKE2b-256 checksum How to use checksums |
634eec88e97f32288ef535816c42566bb1ee3ec191eaf0ebd9a8d0eb416dca04
|
| 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.0-cp311-cp311-win_amd64.whl
| Download URL | lightwave2d-0.11.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d2787d218f63cb3cfc8398885274dfe3dbf56010eae2147ab59c6f1a52ed4ae2
|
|
BLAKE2b-256 checksum How to use checksums |
c22f20e85a22a4abb6326eb72f0731b9191122fbf2be8da8ac44d87001d740ad
|
| 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.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | lightwave2d-0.11.0-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 |
4d28ffb65180fcd3ec84b85ee28e2012db73624cd796630efe2f08bc64d8dafd
|
|
BLAKE2b-256 checksum How to use checksums |
79c82adeabfdc4e7cdddc882efa058117ce7e590a3ad36257a063824083d3526
|
| 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.0-cp311-cp311-macosx_26_0_arm64.whl
| Download URL | lightwave2d-0.11.0-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 |
6fd7adfad0ac065b7b238f056a84e265cf71c85bd4ca005d7bde21d8baaf9dec
|
|
BLAKE2b-256 checksum How to use checksums |
a0a944d90aea958a66f6325674793e5e23a13a27639e3fe4edd8c0a229a57fa8
|
| 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.0
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.