Skip to main content

openphoton

Step-By-Step Tutorial: https://youtu.be/bz9cDEuyxx0

FEATURES:

  • Light propagation using Rayleigh-Sommerfeld Diffraction Integral
  • Includes Fresnel Approximation and Fraunhofer Approximation
  • Simulation of converging lens and diverging Lens
  • Simulation of amplitude-based test object using SLM

The latest version allows you to simulate light propagation from a laser, passing through lens, and passing through your test object. More features will be added soon.

Examples of How To Use (Alpha Version)

Add openphoton to your operating system or python virtual environment :

pip install openphoton

Create a laser beam :

import openphoton as op

# side length (m)
# aperture radius (m)
u0 = op.devices.laser_beam(
    side_length=0.06,
    aperture_radius=0.026,
    pixels=1024)

In order to forward propagate the wave field, you must choose between fresnel (near-field) approximation and fraunhoffer (far-field) approximation. To determine which approximation is best for your system, you have to calculate the Fresnel number F_N. If F_N = [1, +infinity], then use fresnel approximation. Otherwise, use fraunhoffer approximation.

# uo = wave field to propagate
# L = source plane side length (m)
# wavelength = wavelength of light (m)
# z = propagation distance (m)
# u1 = resulting wave field after propagation
u1 = op.rayleigh_sommerfeld.fresnel_approx(
    u0, L, wavelength, z)

Apply converging lens or diverging lens on the laser beam :

import numpy as np

# u1 = wave field before the lens
# L = u1 side length (m)
# wavelength of light (m)
# f_length = lens focal length (m)
# u2 = wave field after the lens
u2 = np.multiply(u1, op.lenses.converging_lens(u1,L,wavelength,f_length))

Apply SLM or test object on the laser beam :

import numpy as np

# filename = image of test object file name
filename : str = "USAF_1951_1024p.png"

# SLM_amplitude() converts RGB image into numpy array
# pixel_size = number of pixels of image, ideally this must be the same with u1
test_object = op.devices.SLM_amplitude(filename, pixel_size)

# u1 = wave field before the test object
# L = u1 side length (m)
# wavelength of light (m)
# u2 = wave field after the test object
u2 = np.multiply(u1, test_object)

References:

  • Shen, Fabin, and Anbo Wang. "Fast-Fourier-transform based numerical integration method for the Rayleigh-Sommerfeld diffraction formula." Applied optics 45, no. 6 (2006): 1102-1110.
  • Schmidt, Jason D. "Numerical simulation of optical wave propagation with examples in MATLAB." SPIE (2010).
  • Voelz, David G., and Michael C. Roggemann. "Digital simulation of scalar optical diffraction: revisiting chirp function sampling criteria and consequences." Applied optics 48, no. 32 (2009): 6132-6142.

Metadata

Release files for openphoton 0.1.7

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

Source distribution (sdist)

Source distribution for openphoton 0.1.7
File Size Uploaded Provenance Actions
openphoton-0.1.7.tar.gz 5.7 kB Without provenance Details for openphoton-0.1.7.tar.gz

Built distribution (wheel)

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

Total release size: 12.5 kB

Release files / openphoton-0.1.7.tar.gz

Download URL openphoton-0.1.7.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b65d4d772e35df2e7198b2205ac6274c15269c3505a0dd9bdbd71904ba189e31
BLAKE2b-256 checksum
How to use checksums
bdf7ff8d23a11de2ee673a62a71d5405965553835d0d6a4efc6746b493b2a0fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / openphoton-0.1.7-py3-none-any.whl

Download URL openphoton-0.1.7-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3befa127cccf3f49f5d6afbef12c000514bb7914831a4d0a8ab9db495086c9a
BLAKE2b-256 checksum
How to use checksums
6096be3655b1203f8b5a39f39c9462dd2f3eda3b57ea5dd093ad009391120009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for openphoton 0.1.7

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