openphoton


Nameopenphoton JSON
Version 0.1.7 PyPI version JSON
download
home_page
SummaryA scalar diffraction simulation package
upload_time2023-12-13 02:14:14
maintainer
docs_urlNone
authorGilbert M. Oca
requires_python
licenseMIT
keywords python optics diffraction simulation lens slm light wave propagation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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 :

```python
pip install openphoton
```

Create a laser beam :
```python
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.
```python
# 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 :
```python
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 :
```python
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.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "openphoton",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,optics,diffraction,simulation,lens,SLM,light,wave,propagation",
    "author": "Gilbert M. Oca",
    "author_email": "<boyfriendnibluefairy@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bd/f7/ff8d23a11de2ee673a62a71d5405965553835d0d6a4efc6746b493b2a0fe/openphoton-0.1.7.tar.gz",
    "platform": null,
    "description": "# openphoton\n\nStep-By-Step Tutorial:\nhttps://youtu.be/bz9cDEuyxx0\n\n### FEATURES:\n - Light propagation using Rayleigh-Sommerfeld Diffraction Integral\n - Includes Fresnel Approximation and Fraunhofer Approximation\n - Simulation of converging lens and diverging Lens\n - Simulation of amplitude-based test object using SLM\n\nThe 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.\n\n## Examples of How To Use (Alpha Version)\n\nAdd openphoton to your operating system or python virtual environment :\n\n```python\npip install openphoton\n```\n\nCreate a laser beam :\n```python\nimport openphoton as op\n\n# side length (m)\n# aperture radius (m)\nu0 = op.devices.laser_beam(\n    side_length=0.06,\n    aperture_radius=0.026,\n    pixels=1024)\n```\n\nIn order to forward propagate the wave field, you must choose between fresnel (near-field) approximation and\nfraunhoffer (far-field) approximation. To determine which approximation is best for your system, you have to calculate\nthe Fresnel number F_N. If F_N = [1, +infinity], then use fresnel approximation. Otherwise, use fraunhoffer approximation.\n```python\n# uo = wave field to propagate\n# L = source plane side length (m)\n# wavelength = wavelength of light (m)\n# z = propagation distance (m)\n# u1 = resulting wave field after propagation\nu1 = op.rayleigh_sommerfeld.fresnel_approx(\n    u0, L, wavelength, z)\n```\n\nApply converging lens or diverging lens on the laser beam :\n```python\nimport numpy as np\n\n# u1 = wave field before the lens\n# L = u1 side length (m)\n# wavelength of light (m)\n# f_length = lens focal length (m)\n# u2 = wave field after the lens\nu2 = np.multiply(u1, op.lenses.converging_lens(u1,L,wavelength,f_length))\n```\n\nApply SLM or test object on the laser beam :\n```python\nimport numpy as np\n\n# filename = image of test object file name\nfilename : str = \"USAF_1951_1024p.png\"\n\n# SLM_amplitude() converts RGB image into numpy array\n# pixel_size = number of pixels of image, ideally this must be the same with u1\ntest_object = op.devices.SLM_amplitude(filename, pixel_size)\n\n# u1 = wave field before the test object\n# L = u1 side length (m)\n# wavelength of light (m)\n# u2 = wave field after the test object\nu2 = np.multiply(u1, test_object)\n```\n\n\n### References:\n - 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.\n - Schmidt, Jason D. \"Numerical simulation of optical wave propagation with examples in MATLAB.\" SPIE (2010).\n - 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.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A scalar diffraction simulation package",
    "version": "0.1.7",
    "project_urls": null,
    "split_keywords": [
        "python",
        "optics",
        "diffraction",
        "simulation",
        "lens",
        "slm",
        "light",
        "wave",
        "propagation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6096be3655b1203f8b5a39f39c9462dd2f3eda3b57ea5dd093ad009391120009",
                "md5": "fdde5f37736d72f74ce12efaa66c1de9",
                "sha256": "b3befa127cccf3f49f5d6afbef12c000514bb7914831a4d0a8ab9db495086c9a"
            },
            "downloads": -1,
            "filename": "openphoton-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fdde5f37736d72f74ce12efaa66c1de9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6780,
            "upload_time": "2023-12-13T02:14:12",
            "upload_time_iso_8601": "2023-12-13T02:14:12.849591Z",
            "url": "https://files.pythonhosted.org/packages/60/96/be3655b1203f8b5a39f39c9462dd2f3eda3b57ea5dd093ad009391120009/openphoton-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bdf7ff8d23a11de2ee673a62a71d5405965553835d0d6a4efc6746b493b2a0fe",
                "md5": "d2fd75e229246c96701879e592b1d927",
                "sha256": "b65d4d772e35df2e7198b2205ac6274c15269c3505a0dd9bdbd71904ba189e31"
            },
            "downloads": -1,
            "filename": "openphoton-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "d2fd75e229246c96701879e592b1d927",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5687,
            "upload_time": "2023-12-13T02:14:14",
            "upload_time_iso_8601": "2023-12-13T02:14:14.654127Z",
            "url": "https://files.pythonhosted.org/packages/bd/f7/ff8d23a11de2ee673a62a71d5405965553835d0d6a4efc6746b493b2a0fe/openphoton-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-13 02:14:14",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "openphoton"
}
        
Elapsed time: 0.23299s