Skip to Content
DocsGetting startedGetting started

Getting started

Welcome to the SVETlANNa documentation. This section gets you from an empty folder to a working optical simulation.

What is SVETlANNa?

SVETlANNa is a Python library for simulating light propagation through optical systems and for building diffractive optical neural networks (DONNs). It is built on PyTorch, which gives you:

  • Automatic differentiation for optimising optical systems
  • GPU acceleration via CUDA
  • Native PyTorch integration (nn.Module, DataLoader, autograd)

SVETlANNa provides four propagation methods: ASM (angular spectrum) and RSC (Rayleigh–Sommerfeld convolution), each with a zero-padded variant (zpASM, zpRSC) that suppresses wrap-around artefacts.

In this section

A minimal example

from svetlanna import SimulationParameters, Wavefront from svetlanna.units import ureg # define the simulation grid params = SimulationParameters.from_ranges( x_range=(-1*ureg.mm, 1*ureg.mm), x_points=256, y_range=(-1*ureg.mm, 1*ureg.mm), y_points=256, wavelength=632.8*ureg.nm ) # create a Gaussian beam wf = Wavefront.gaussian_beam(params, waist_radius=0.3*ureg.mm) # inspect the result print(f"Field shape: {wf.shape}") print(f"Max intensity: {wf.max_intensity:.3f}")

Next steps

Start with Virtual environment to set up an isolated Python environment with PyTorch and SVETlANNa, then move on to the Quickstart, where you build a complete optical system in five minutes.