Skip to main content

en ru

SVETlANNa

SVETlANNa is an open-source Python library for simulating free-space optical setups and neuromorphic systems such as Diffractive Neural Networks. It is built on the PyTorch framework, leveraging key features such as tensor-based computations and automatic differentiation.

At its core, SVETlANNa relies on Fourier optics and includes several optical elements such as free space, apertures, phase masks, thin lenses, and Spatial Light Modulators (SLMs).

The library name combines the Russian word "svet" ("light" in English) and the abbreviation ANN (artificial neural network). At the same time, the full word sounds like the Slavic female name Svetlana.

Documentation

Documentation for SVETlANNa is available at compphyslab.github.io/SVETlANNa.docs.

There is also a supporting GitHub repository, SVETlANNa.docs, containing numerous application examples in Jupyter notebook format.

Quick Start

import torch
import svetlanna as sv
from svetlanna.units import ureg

# define the computational grid and the wavelength of light
sim_params = sv.SimulationParameters(
    x=torch.linspace(-5 * ureg.mm, 5 * ureg.mm, 256),
    y=torch.linspace(-5 * ureg.mm, 5 * ureg.mm, 256),
    wavelength=10 * ureg.um,
)

setup = sv.LinearOpticalSetup([
    sv.elements.RoundAperture(sim_params, radius=2 * ureg.mm),
    sv.elements.FreeSpace(sim_params, distance=10 * ureg.cm, method='ASM'),
])

incident_field = sv.Wavefront.plane_wave(sim_params)
output_field = setup(incident_field)

Features

  • Free-space propagation solvers, including the Angular spectrum method (ASM) and the Rayleigh-Sommerfeld convolution (RSC). See this work for a definition of the methods and a comparison between them.
  • Support for solving classical diffractive optical element and SLM optimization problems with the Gerchberg-Saxton and Hybrid Input-Output algorithms.
  • Flexible API that supports custom elements.
  • Native GPU acceleration for all computations.
  • Visualization tools.

Possible applications

  • Modeling and optimization of optical systems and optical beams propagating in free space.
  • Calculation of phase-mask, Diffractive Optical Element (DOE), and SLM parameters for both classical optical systems and neuromorphic optical computers.
  • Modeling and optimization of Optical Neural Network and Diffractive Optical Neural Network parameters for different tasks.

Installation

You can install SVETlANNa from PyPI using pip:

pip install svetlanna

You should install PyTorch separately, following the instructions on the PyTorch website, to ensure compatibility with your system and desired features (e.g., CUDA support).

Examples

Result of training a feed-forward optical neural network for the MNIST classification task: the image of the digit "8" is passed through a stack of 10 phase plates with adjusted phase masks. Selected detector regions correspond to different classes of digits. The predicted class is identified by the detector region with the maximum optical intensity.

Examples of visualization of optical setups and optical fields:

drawing

Example of a five-layer Diffractive Optical Neural Network trained to recognize numbers from the MNIST database:

drawing drawing drawing

Contributing

Contributions are always welcome! See CONTRIBUTING.md for ways to get started.

Acknowledgements

The initial work on this repository was supported by the Foundation for Assistance to Small Innovative Enterprises.

Authors

License

Mozilla Public License Version 2.0

Release files for svetlanna 2.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for svetlanna 2.0.2
File Size Uploaded
svetlanna-2.0.2.tar.gz 70.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for svetlanna 2.0.2
File Interpreter ABI Platform
svetlanna-2.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 161.1 kB

Release files / svetlanna-2.0.2.tar.gz

Download URL svetlanna-2.0.2.tar.gz
Size 70.6 kB
Tags Source
SHA-256 checksum
How to use checksums
546c83ed72bbb48558a1f2e25ed66d8e20ed0bc2a202237f4dbe3784cdc7e673
BLAKE2b-256 checksum
How to use checksums
d86781d2c66a8fe0a2554e3a3c9af454eb220c2ed64949905dc48ee1b3ba09b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1020-azure

Release files / svetlanna-2.0.2-py3-none-any.whl

Download URL svetlanna-2.0.2-py3-none-any.whl
Size 90.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c4a3aca2c3f398540fe9139bac44f2219b2e718513fca457849736ee8ef1fb6
BLAKE2b-256 checksum
How to use checksums
b78b64d3dcde2a361b3d76b03fb15a201cac0927d65cef4e9bdd65e3b5ba5429
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Linux/6.17.0-1020-azure

Release history Release notifications | RSS feed

This release

2.0.2 This release

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

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