Skip to main content

Open source library for simulation and engineering of optical setups and diffractive neural networks

Project description

Release is planned for May 2025.

SVETlANNa

SVETlANNa is an open-source Python library for simulation of free-space optical set-ups and neuromorphic systems such as Diffractive Neural Networks. It is primarily built on the PyTorch framework, leveraging key features such as tensor-based computations and efficient parallel processing. At its core, SvetlANNa relies on the Fourier optics, supporting multiple propagation models, including the Angular spectrum method and the Fresnel approximation.

There is a supporting github project SVETlANNa.docs containing numerous application examples in the Jupyter notebook format. This project will be opened upon the release.

The name of the library is composed of the Russian word "svet", which is the "light" in English and the abbreviation ANN standing for an artificial neural network, and simultaneously the whole word sounds like a Russian female name Svetlana.

Abbreviations

NN - Neural Network

ANN - Artificial Neural Network

ONN - Optical Neural Network

DONN - Diffractive Optical Neural Network

DOE - Diffractive Optical Element

SLM - Spatial Light Modulator

Features

  • based on the PyTorch
  • forward propagation models include the Angular spectrum method and the Fresnel approximation
  • possibility to solve the classical DOE/SLM optimization problem with the Gerchberg-Saxton and hybrid input-output algorithms
  • support for custom elements and optimization methods
  • support for various free-space ONN architectures including feed-forward NN, autoencoders, and recurrent NN
  • cross platform
  • full GPU aceleration
  • companion repository with numerous .ipynb examples
  • custom logging, project management, analysis, and visualization tools
  • tests for the whole functionality

Installation, Usage and Examples

Running From Source

  1. Create a virtual environment (e.g., see venv documentation)
  2. Install the PyTorch (it is up to the user to choose a version)
  pip install torch
  1. Istall the Poetry, or check that its version is 2.0.0 or greater
  pip install poetry
  1. In the library folder execute the command
  poetry install

Installation From PIP

Coming soon

Running Tests

To run tests, run the following command

  pytest

Documentation

Documentation

Examples

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

Examples of visualzation of optical set-ups and optical fields:

drawing

Example a of five-layer DONN trained to recognize numbers from the MNIST database:

drawing drawing drawing

Example of

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Acknowledgements

The work on this repository was initiated within the grant by the Foundation for Assistance to Small Innovative Enterprises

Authors

License

Mozilla Public License Version 2.0

Project details


Download files

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

Source Distribution

svetlanna-1.0.1.tar.gz (93.3 kB view details)

Uploaded Source

File details

Details for the file svetlanna-1.0.1.tar.gz.

File metadata

  • Download URL: svetlanna-1.0.1.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for svetlanna-1.0.1.tar.gz
Algorithm Hash digest
SHA256 904df0ce65de24b821d5a0f11a56c20b5ea29f23febdc1f225cd2a64074ee611
MD5 0bc120cb9b1cb07ad21a18d4273d08d0
BLAKE2b-256 9a0e1d9939da80d096eb30bc46d50dbc948193913bbe09a3a092cc16b4fc1fcb

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