Skip to main content

fourierslm

CI Docs

Fourier optics of a phase-only SLM: the beam on the SLM, its phase pattern, and the field it makes in the focal region of a lens, in physical units.

Documentation: https://melvinrdn.github.io/fourierslm

Install

pip install fourierslm    # or: uv add fourierslm

Example

A Gaussian pulse of 1 mJ and 200 fs on a square of 10 beam radii, a vortex of charge 1, and a lens of 50 cm placed 30 cm after the SLM. With the peak power, |E|² is the peak intensity in every plane. focus gives the field in the back focal plane, the Fourier transform of the field on the SLM, on a window of 3 mm around the axis. free then propagates it through the focus.

import matplotlib.pyplot as plt
import numpy as np

import fourierslm as fs

lam, f, w = 1030e-9, 0.5, 2e-3
X, Y = fs.slm_grid(size=10 * w)  # 2048 × 2048 points
x, y = fs.focus_grid(X, Y, lam, f, window=3e-3)  # ±1.5 mm around the axis

intensity = fs.intensity.gaussian(X, Y, w, power=fs.peak_power(energy=1e-3, duration=200e-15))  # W/m²
phase = fs.phase.vortex(X, Y, charge=1)
E_slm = fs.slm_field(intensity, phase)

E_focus = fs.propagate.focus(E_slm, X, Y, x, y, lam, f, slm_distance=0.3)  # back focal plane
z = np.linspace(-60e-3, 60e-3, 121)
I = np.abs(fs.propagate.free(E_focus, x[1] - x[0], lam, z)) ** 2  # W/m², shape (len(z), len(x), len(x))

fig, ax = plt.subplots(1, 2, figsize=(9, 3.6))
c = len(x) // 2
im = ax[0].imshow(I[60] * 1e-4, extent=[x[0] * 1e6, x[-1] * 1e6] * 2, origin="lower", cmap="bone")
ax[0].set(xlabel="x [µm]", ylabel="y [µm]", title="intensity at the focus", xlim=(-250, 250), ylim=(-250, 250))
fig.colorbar(im, ax=ax[0], label="W/cm²")
ax[1].imshow(
    I[:, c, :].T * 1e-4,
    extent=[z[0] * 1e3, z[-1] * 1e3, x[0] * 1e6, x[-1] * 1e6],
    origin="lower",
    aspect="auto",
    cmap="bone",
)
ax[1].set(xlabel="z [mm]", ylabel="x [µm]", title="intensity at y = 0", ylim=(-600, 600))
fig.tight_layout()
plt.show()

Intensity of the vortex at the focus, and at y = 0 through the focus

License

MIT

Metadata

Release files for fourierslm 0.3.0

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

Source distribution (sdist)

Source distribution for fourierslm 0.3.0
File Size Uploaded Provenance Actions
fourierslm-0.3.0.tar.gz 11.6 kB Without provenance Details for fourierslm-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.0 kB

Release files / fourierslm-0.3.0.tar.gz

Download URL fourierslm-0.3.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e7b41ba9de881895f8b4591ccca036c40b0bdd69621da9c8230d38b00e3814dd
BLAKE2b-256 checksum
How to use checksums
d48bd9cf836510b64dc8f9f4fc21b1d126d191d52346c2a935296ac34b0d702b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / fourierslm-0.3.0-py3-none-any.whl

Download URL fourierslm-0.3.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
159d935948c8623516cd65c574442b4d941a30e33dfd60ca754545057d26df1f
BLAKE2b-256 checksum
How to use checksums
b3adff4168a3cf85bd044e0c7127591755a19d26058412ab878dae483ead4928
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for fourierslm 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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