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 beam of 1 W on a 1920 × 1200 SLM with 8 µm pixels, a vortex of charge 1, and a lens of 50 cm placed 30 cm after the SLM. focus gives the field in the back focal plane, the Fourier transform of the field on the SLM. free then propagates the central part of it through the focus.

import matplotlib.pyplot as plt
import numpy as np

from fourierslm import beam, grid, phase, propagate

lam, f, pitch = 1030e-9, 0.5, 8e-6
X, Y = grid(1920, pitch), grid(1200, pitch)
E = beam.gaussian(X, Y, w=2e-3, power=1.0)  # field [V/m], w is the 1/e² radius of the intensity
E = E * np.exp(1j * phase.vortex(X, Y, charge=1))
E_focus, x, y = propagate.focus(E, pitch, lam, f, slm_distance=0.3)  # back focal plane

keep = np.abs(x) < 1.5e-3  # ±1.5 mm around the axis, x and y share the grid
E_focus, x = E_focus[np.ix_(keep, keep)], x[keep]
z = np.linspace(-60e-3, 60e-3, 121)
I = beam.intensity(propagate.free(E_focus, x[1] - x[0], lam, z))  # [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.2.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.2.0
File Size Uploaded Provenance Actions
fourierslm-0.2.0.tar.gz 9.9 kB Without provenance Details for fourierslm-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.7 kB

Release files / fourierslm-0.2.0.tar.gz

Download URL fourierslm-0.2.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fc5dc44744153b2555def99138b2b87969779db7d2574c9ce9ece90016fc109d
BLAKE2b-256 checksum
How to use checksums
48aca33a1c4fa370b19f7d528a413e109b6f5340a9ddb85b584aa5884234752f
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.2.0-py3-none-any.whl

Download URL fourierslm-0.2.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5086f73df76d35471bf59e356a77c7d2b13ee12ed9e17ba996bd5af182d399a
BLAKE2b-256 checksum
How to use checksums
b5915d97b170450f4e0ca9dde32a103a3aacea8ad7e4d83d717d77450251e610
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.2.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