Skip to main content

python Documentation Status PyPi PyPi_download

LightWave2D is a software designed for comprehensive 2D Finite-Difference Time-Domain (FDTD) simulations, featuring a user-friendly installation and operation process. The characterization of wave propagation, scattering, and diffraction within LightWave2D is determined by a set of specific components, as illustrated in the subsequent figure.

LightWave2D integrates various components, including waveguides, scatterers (squares, circles, ellipses, triangles, lenses), gratings, and resonators. Additional parameters governing the simulation are contingent upon the attributes of the components and the simulation setup.


Documentation

All the latest available documentation is available here or you can click the following badge:

Documentation Status


Installation

For common versions of Windows, Linux, and macOS, (on x86_64 architecture), the package can readily be installed using pip;

>>> pip install LightWave2D

Coding examples

LightWave2D was developed with the aim of being an intuitive and easy to use tool. Below are two examples that illustrate this:

# Spherical scatterer

from LightWave2D.grid import Grid
from LightWave2D.experiment import Experiment
from MPSPlots import colormaps

grid = Grid(
    resolution=0.1e-6,
    size_x=32e-6,
    size_y=20e-6,
    n_steps=300
)

experiment = Experiment(grid=grid)

scatterer = experiment.add_circle(
    position=('30%', '50%'),
    epsilon_r=2,
    radius=3e-6
)

source = experiment.add_line_source(
    wavelength=1550e-9,
    point_0=('10%', '100%'),
    point_1=('10%', '0%'),
    amplitude=10,
)

experiment.add_pml(order=1, width=70, sigma_max=5000)

experiment.run_fdtd()

animation = experiment.render_propagation(
    skip_frame=5,
    unit_size=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation.save('./spherical_scatterer.gif', writer='Pillow', fps=10)

some image

# Ring resonator

from LightWave2D.grid import Grid
from LightWave2D.experiment import Experiment
from MPSPlots.colormaps import polytechnique

grid = Grid(
    resolution=0.1e-6,
    size_x=50e-6,
    size_y=30e-6,
    n_steps=800
)

experiment = Experiment(grid=grid)


scatterer = experiment.add_ring_resonator(
    position=('35%', '50%'),
    epsilon_r=1.5,
    inner_radius=4e-6,
    width=2e-6
)

source = experiment.add_point_source(
    wavelength=1550e-9,
    position=('25%', '50%'),
    amplitude=100,
)

pml = experiment.add_pml(order=1, width=70, sigma_max=5000)

experiment.run_fdtd()

animation = experiment.render_propagation(skip_frame=5, colormap=polytechnique.red_black_blue)

animation.save('./resonator.gif', writer='Pillow', fps=10)

some image

# Ring resonator

from LightWave2D.grid import Grid
from LightWave2D.experiment import Experiment
from MPSPlots import colormaps

grid = Grid(
    resolution=0.1e-6,
    size_x=60e-6,
    size_y=30e-6,
    n_steps=1200
)

experiment = Experiment(grid=grid)

scatterer = experiment.add_lense(
    position=('35%', '50%'),
    epsilon_r=2,
    curvature=10e-6,
    width=5e-6
)

source = experiment.add_point_source(
    wavelength=1550e-9,
    position=('10%', '50%'),
    amplitude=10,
)


experiment.add_pml(order=1, width=50, sigma_max=5000)

experiment.run_fdtd()

experiment.plot_frame(
    frame_number=-1,
    scale_max=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation = experiment.render_propagation(
    skip_frame=5,
    unit_size=5,
    colormap=colormaps.polytechnique.red_black_blue
)

animation.save('./lense.gif', writer='Pillow', fps=10)

some image

Plenty of other examples are available online, I invite you to check the examples section of the documentation.

Testing

To test localy (with cloning the GitHub repository) you’ll need to install the dependencies and run the coverage command as

>>> git clone https://github.com/MartinPdeS/LightWave2D.git
>>> cd LightWave2D
>>> pip install -r requirements/requirements.txt
>>> coverage run --source=LightWave2D --module pytest --verbose tests
>>> coverage report --show-missing

Contact Information

As of 2024 the project is still under development if you want to collaborate it would be a pleasure. I encourage you to contact me.

LightWave2D was written by Martin Poinsinet de Sivry-Houle .

Email:martin.poinsinet-de-sivry@polymtl.ca .

Metadata

Release files for LightWave2D 0.1.6.post11

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.1.6.post11
File
lightwave2d-0.1.6.post11-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
lightwave2d-0.1.6.post11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
lightwave2d-0.1.6.post11-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
lightwave2d-0.1.6.post11-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
lightwave2d-0.1.6.post11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
lightwave2d-0.1.6.post11-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
lightwave2d-0.1.6.post11-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
lightwave2d-0.1.6.post11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
lightwave2d-0.1.6.post11-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details

Total release size: 7.1 MB

Release files / lightwave2d-0.1.6.post11-cp312-cp312-win_amd64.whl

Download URL lightwave2d-0.1.6.post11-cp312-cp312-win_amd64.whl
Size 914.2 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
7030608c8c824c380845a1531a9ef5e27ba490698dcba67333963106ef7ff8ac
BLAKE2b-256 checksum
How to use checksums
05c0ff6d403858b591ce830a5c134fc977bd6c8e5cd3c3d1a9132681c437b253
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightwave2d-0.1.6.post11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 627.6 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c24d0281810db24b8201fc145b4b5aa6d84f02361e1bedf6e3116a394d9852e6
BLAKE2b-256 checksum
How to use checksums
f2addf5e6fb7afd2d53e1865af39b4a7698650fce132f4641c307989370ceea7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp312-cp312-macosx_11_0_arm64.whl

Download URL lightwave2d-0.1.6.post11-cp312-cp312-macosx_11_0_arm64.whl
Size 1.5 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c587de5918ef7b6dc49064c253cb3f5536a8b404fe71f8a9bf721b5866b4eb91
BLAKE2b-256 checksum
How to use checksums
d4b74270e90c1e39dff1f536a14128ccdbae7d96c788a4080ebcaf3da4b20099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp311-cp311-win_amd64.whl

Download URL lightwave2d-0.1.6.post11-cp311-cp311-win_amd64.whl
Size 616.0 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
7e02bca77f9d6c64ce208eaa701ee26c2c90772de8eb5cf670448148944cd076
BLAKE2b-256 checksum
How to use checksums
8a9aaae5b24119b6ab3c0c781dbbdd8c1922fc0a74d1e1302e40932b0c658bba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightwave2d-0.1.6.post11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 425.7 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b6b566aae7324f334cdeb917abdcb7a03b0803351503ae5a6a8751193bd41bac
BLAKE2b-256 checksum
How to use checksums
ad6115095aa386f0cca373e4e840fb8c6f1798667b03af6ba0f59edf284775e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp311-cp311-macosx_11_0_arm64.whl

Download URL lightwave2d-0.1.6.post11-cp311-cp311-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7420c438af39fc8faf0df91143eec5ed46ddb0220409852935a856f90a8c0da9
BLAKE2b-256 checksum
How to use checksums
1ae3455846a71365c3796ae288cc4fd611117c6c38ed85baa433a569ca3af5d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp310-cp310-win_amd64.whl

Download URL lightwave2d-0.1.6.post11-cp310-cp310-win_amd64.whl
Size 317.8 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
6af09334145a0ef008305f69837092e9d48f3075b6984ad9c955ec2832fcc0b6
BLAKE2b-256 checksum
How to use checksums
2acb7cfe81889e769d72883d87c3fd14bc35ede31b42c6871f55a5b5f693f2af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightwave2d-0.1.6.post11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 222.0 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
ec151e9b9a51b33ed6998aa9f947d03504c933070f82a0c72b42f7054ffb09d9
BLAKE2b-256 checksum
How to use checksums
fcca594aa072a048ccbf52fe7eda1255a434e2403a425d9541c87d5c2a3813d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19

Release files / lightwave2d-0.1.6.post11-cp310-cp310-macosx_11_0_arm64.whl

Download URL lightwave2d-0.1.6.post11-cp310-cp310-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b0dfc1656c342a87f2a19503a7822269bfb67008276ce12f5afa2eb1b1dbb0b8
BLAKE2b-256 checksum
How to use checksums
5764128ed467a342a813942df753c244b72f57b8f53478bd01e175b47219dd1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.19
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