Skip to main content

A package for finite-difference time domain computation for light propagation

Project description

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 .

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

lightwave2d-0.1.6.post10-cp312-cp312-win_amd64.whl (914.2 kB view details)

Uploaded CPython 3.12Windows x86-64

lightwave2d-0.1.6.post10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (627.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

lightwave2d-0.1.6.post10-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

lightwave2d-0.1.6.post10-cp311-cp311-win_amd64.whl (616.0 kB view details)

Uploaded CPython 3.11Windows x86-64

lightwave2d-0.1.6.post10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (425.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

lightwave2d-0.1.6.post10-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

lightwave2d-0.1.6.post10-cp310-cp310-win_amd64.whl (317.8 kB view details)

Uploaded CPython 3.10Windows x86-64

lightwave2d-0.1.6.post10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

lightwave2d-0.1.6.post10-cp310-cp310-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file lightwave2d-0.1.6.post10-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 3a648278232f8b4fa060efe4e8cbe35742dc8c03186528cbb5f27a57c88cc2ea
MD5 ff97181c13c6302125c4f7dd17231e98
BLAKE2b-256 6c2dc6a9f17ebab478dbab1f8ea2c6e0876ead642b00fb0d123f9657bfdd6824

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f121138e25660f404dfcb655d8cf69eab8226cab36d8dfb370bd9aca1ff632ae
MD5 07b894ea032911102f8ce122c66fbc4b
BLAKE2b-256 1957f207cb662e21a915e89f2017ed4148ccadf8291b71a59283f5d60a477d0a

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2a47777ecbd66aa6613f09d5eef1e37e856d0ec03c0918572564b3153764842c
MD5 5a32cef58718cb0050810e3673194e19
BLAKE2b-256 a686bf5cb6d770593d32742cd9b1989ecf9410030add7f7622b7385a1e3cd69c

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c002ce0392b551ab41074e409a428e6555912b5bf30ae7a2b857534a07e0143b
MD5 0dd4d463cc3766a93238c5c608ad97a4
BLAKE2b-256 9df896fb6517b9c0761737f3e1928ac8f46d0d2e5791e7a4c69dceafa2b3e989

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b51c00bc5c61b2f7474fbed39cf88f7afd395c2bb8bd4f888f39b844e50c6b9e
MD5 ee9a912fb8ad94fe55c6415becd06201
BLAKE2b-256 b1d75ba90d091374b04040dde7780df674eb55d10bb211d5cdfa7a6c9be87820

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d19a3b45811937fe27739bb8f9e38d6e5eeb7826289cf9f0f4ddc9a1a7a698ae
MD5 b4315bac4674ede6db6cbba3c5d7fac6
BLAKE2b-256 9a08c049b738c51e1cd8045090b5dfc504a9ad41eea955dbcdef43f900fd3a19

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 9be23476d82064c9d9b9666472e974b732bdd487912912af578fb966e4513fd6
MD5 9579b65f9e8b6cc419f9739b161f2774
BLAKE2b-256 795576c11c957d57214103b9ee7279265fa5c056bb9af801e5eca936fcd5424a

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a9d937de9561b188e5852c94de086ef7b6cfd6b30c6fabc70158880962e5d689
MD5 b09762214e2f0c07a6b5d22d973f64a3
BLAKE2b-256 081c68e6ca8e3b5b01da623a2a7e62c3d838e8d8c764c9c7860039da880694ca

See more details on using hashes here.

File details

Details for the file lightwave2d-0.1.6.post10-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for lightwave2d-0.1.6.post10-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c54974baaaa175f8d13992e2915afeee8cd215b5bf19b4a3d96649133a19929b
MD5 a270897d6cac5a75d5d7dc095cfecef0
BLAKE2b-256 1989a6962a547d89227f01b79b8130f7a4b0fcc3e08af189ba38036f9df28df7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page