Skip to content

Commit

Permalink
fixed several bugs due to numpy expirations
Browse files Browse the repository at this point in the history
some commands used in LightPipes had to be changed because of expirations in numpy release 2.01.
  • Loading branch information
FredvanGoor committed Aug 5, 2024
1 parent f4ffded commit 8436e8f
Show file tree
Hide file tree
Showing 706 changed files with 2,897 additions and 15,163 deletions.
6 changes: 3 additions & 3 deletions Examples/Interference/Young.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
R=0.3*mm
d=1.2*mm

#img=mpimg.imread('Young.png')
#plt.imshow(img); plt.axis('off')
# img=mpimg.imread('Young.png')
# plt.imshow(img); plt.axis('off')

#plt.show()
# plt.show()

F=Begin(size,wavelength,N)
F1=CircAperture(R/2.0,-d/2.0, 0, F)
Expand Down
4 changes: 2 additions & 2 deletions Examples/Waveguide/LensLikeMedium.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
linewidth=0.0,
)
ax1.set_title('Radial energy distribution in the x-direction')
ax1.set_xlabel('x [$\\mu m$]')
ax1.set_xlabel(r'x [$\mu m$]')
ax1.set_ylabel('z [cm]')
ax1.set_zlabel('Intensity [.a.u.]')

Expand All @@ -73,7 +73,7 @@
linewidth=0.0,
)
ax2.set_title('Radial energy distribution in the y-direction')
ax2.set_xlabel('x [$\\mu m$]')
ax2.set_xlabel(r'x [$\mu m$]')
ax2.set_ylabel('z [cm]')
ax2.set_zlabel('Intensity [.a.u.]')
ax2.azim=-45
Expand Down
3 changes: 2 additions & 1 deletion LightPipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
'Zernike',
'noll_to_zern',
'ZernikeName',
'ZernikeName2Noll',
'ZernikeFit',
'ZernikeFilter',
'LPtest',
Expand Down Expand Up @@ -93,7 +94,7 @@
from .propagators import ABCD, Fresnel, Forward, Forvard, GForvard, Propagate, Steps
from .lenses import Axicon, Lens, GLens, LensFarfield, LensForvard, LensFresnel, \
Convert
from .zernike import ZernikeName, ZernikeNolltoMN, noll_to_zern, \
from .zernike import ZernikeName, ZernikeName2Noll, ZernikeNolltoMN, noll_to_zern, \
ZernikeFilter, ZernikeFit, Zernike
from .core import CircAperture, CircScreen, RectAperture, RectScreen
from .core import GaussAperture, GaussScreen, GaussHermite, GaussLaguerre, SuperGaussAperture
Expand Down
2 changes: 1 addition & 1 deletion LightPipes/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.1.4'
__version__ = '2.1.5'
42 changes: 42 additions & 0 deletions LightPipes/zernike.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,48 @@ def ZernikeName(Noll):
else:
return ""

def ZernikeName2Noll(zname):
"""
*Returns the Noll index of the Zernike term*
:param zname: Zernike term
:type zname: string
:return: Noll index
:rtype: int
.. seealso::
* :ref:`Examples: Zernike aberration.<Zernike aberration.>`
"""
name = [
"piston",
"horizontal tilt",
"vertical tilt",
"defocus",
"oblique primary astigmatism",
"vertical primary astigmatism",
"vertical coma",
"horizontal coma",
"vertical trefoil",
"oblique trefoil",
"primary spherical",
"vertical secondary astigmatism",
"oblique secondary astigmatism",
"vertical quadrafoil",
"oblique quadrafoil",
"horizontal secondary coma",
"vertical secondary coma",
"oblique secondary trefoil",
"vertical secondary trefoil",
"oblique pentafoil",
"vertical pentafoil",
]
if zname in name:
return name.index(zname) + 1
else:
raise ValueError(f"Unknown name for Zernike aberration, must be one of {name}")
return -1


def noll_to_zern(j):
"""
Expand Down
10 changes: 5 additions & 5 deletions LightPipes/zernikemath.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

import numpy as _np

import math

def zernike(n,m,rho,phi):
"""
Expand Down Expand Up @@ -38,10 +38,10 @@ def zernike(n,m,rho,phi):
prod = _np.power(rho, n-2*s)
else:
prod = 1.0
prod *= _np.math.factorial(n-s)*sign
prod /= (_np.math.factorial(s)
* _np.math.factorial(int(((n+mabs)/2))-s)
* _np.math.factorial(int(((n-mabs)/2))-s))
prod *= math.factorial(n-s)*sign
prod /= (math.factorial(s)
* math.factorial(int(((n+mabs)/2))-s)
* math.factorial(int(((n-mabs)/2))-s))
summ += prod
sign = -sign
if m>=0:
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f1324301ca7e61a0f8c88a300a5f54d9
config: 5daebc8ae92a60c1879cb93b0b75d4aa
tags: 645f666f9bcd5a90fca523b33c5a78b7
48 changes: 26 additions & 22 deletions docs/2DAiryBeam.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>7.3.1. Generation of a 2-dimensional Airy beam from a Gaussian laser beam. &mdash; LightPipes for Python 2.1.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/plot_directive.css" type="text/css" />
<title>7.3.1. Generation of a 2-dimensional Airy beam from a Gaussian laser beam. &mdash; LightPipes for Python 2.1.5 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/plot_directive.css" />


<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=786ba454"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
Expand All @@ -36,7 +39,7 @@
<img src="_static/front.png" class="logo" alt="Logo"/>
</a>
<div class="version">
2.1.4
2.1.5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -102,35 +105,36 @@
<div itemprop="articleBody">

<section id="generation-of-a-2-dimensional-airy-beam-from-a-gaussian-laser-beam">
<h1><span class="section-number">7.3.1. </span>Generation of a 2-dimensional Airy beam from a Gaussian laser beam.<a class="headerlink" href="#generation-of-a-2-dimensional-airy-beam-from-a-gaussian-laser-beam" title="Permalink to this headline"></a></h1>
<h1><span class="section-number">7.3.1. </span>Generation of a 2-dimensional Airy beam from a Gaussian laser beam.<a class="headerlink" href="#generation-of-a-2-dimensional-airy-beam-from-a-gaussian-laser-beam" title="Link to this heading"></a></h1>
<p>A two-dimensional Airy beam can be generated by substituting a cubic phase
distribution in a Gaussian beam followed by a Fourier transform by a positive lens.
In the simulation below we repeat the simulations published by
Latychevskaia et al. <a class="footnote-reference brackets" href="#a1" id="id1">1</a> and we compare the LightPipes simulation with their results.</p>
Latychevskaia et al. <a class="footnote-reference brackets" href="#a1" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> and we compare the LightPipes simulation with their results.</p>
<p class="rubric">References:</p>
<dl class="footnote brackets">
<dt class="label" id="a1"><span class="brackets"><a class="fn-backref" href="#id1">1</a></span></dt>
<dd><ol class="upperalpha simple" start="20">
<aside class="footnote-list brackets">
<aside class="footnote brackets" id="a1" role="doc-footnote">
<span class="label"><span class="fn-bracket">[</span><a role="doc-backlink" href="#id1">1</a><span class="fn-bracket">]</span></span>
<ol class="upperalpha simple" start="20">
<li><p>Latychevskaia, D. Schachtler, and H.W. Fink, “Creating Airy beams employing a transmissive spatial light modulator”, Appl. Opt. 55, 6095-6101 (2016).</p></li>
</ol>
</dd>
</dl>
</aside>
</aside>
<p>(<a class="reference download internal" download="" href="_downloads/6e3baa4657cb178725791285a1860918/2DAiryBeam.py"><code class="xref download docutils literal notranslate"><span class="pre">Source</span> <span class="pre">code</span></code></a>)</p>
<figure class="align-default" id="id2">
<img alt="_images/2DAiryBeam_00.png" class="plot-directive" src="_images/2DAiryBeam_00.png" />
<figcaption>
<p><span class="caption-text">(<a class="reference download internal" download="" href="_downloads/b711f7be25e23f5580f564541f034cb0/2DAiryBeam_00.png"><code class="xref download docutils literal notranslate"><span class="pre">png</span></code></a>, <a class="reference download internal" download="" href="_downloads/9f1753f781e5de973cbe8a0f64c93cae/2DAiryBeam_00.hires.png"><code class="xref download docutils literal notranslate"><span class="pre">hires.png</span></code></a>, <a class="reference download internal" download="" href="_downloads/101b4acdae0151622ca5580ee5f1db73/2DAiryBeam_00.pdf"><code class="xref download docutils literal notranslate"><span class="pre">pdf</span></code></a>)</span><a class="headerlink" href="#id2" title="Permalink to this image"></a></p>
<p><span class="caption-text">(<a class="reference download internal" download="" href="_downloads/b711f7be25e23f5580f564541f034cb0/2DAiryBeam_00.png"><code class="xref download docutils literal notranslate"><span class="pre">png</span></code></a>, <a class="reference download internal" download="" href="_downloads/9f1753f781e5de973cbe8a0f64c93cae/2DAiryBeam_00.hires.png"><code class="xref download docutils literal notranslate"><span class="pre">hires.png</span></code></a>, <a class="reference download internal" download="" href="_downloads/101b4acdae0151622ca5580ee5f1db73/2DAiryBeam_00.pdf"><code class="xref download docutils literal notranslate"><span class="pre">pdf</span></code></a>)</span><a class="headerlink" href="#id2" title="Link to this image"></a></p>
</figcaption>
</figure>
<figure class="align-default" id="id3">
<img alt="_images/2DAiryBeam_01.png" class="plot-directive" src="_images/2DAiryBeam_01.png" />
<figcaption>
<p><span class="caption-text">(<a class="reference download internal" download="" href="_downloads/eaa3956b4c5fc6fee83129ccd8e64b20/2DAiryBeam_01.png"><code class="xref download docutils literal notranslate"><span class="pre">png</span></code></a>, <a class="reference download internal" download="" href="_downloads/456fbb112dbafd99563b0da699ce83da/2DAiryBeam_01.hires.png"><code class="xref download docutils literal notranslate"><span class="pre">hires.png</span></code></a>, <a class="reference download internal" download="" href="_downloads/6455efd81c11199846dbc78f5770b1fd/2DAiryBeam_01.pdf"><code class="xref download docutils literal notranslate"><span class="pre">pdf</span></code></a>)</span><a class="headerlink" href="#id3" title="Permalink to this image"></a></p>
<p><span class="caption-text">(<a class="reference download internal" download="" href="_downloads/eaa3956b4c5fc6fee83129ccd8e64b20/2DAiryBeam_01.png"><code class="xref download docutils literal notranslate"><span class="pre">png</span></code></a>, <a class="reference download internal" download="" href="_downloads/456fbb112dbafd99563b0da699ce83da/2DAiryBeam_01.hires.png"><code class="xref download docutils literal notranslate"><span class="pre">hires.png</span></code></a>, <a class="reference download internal" download="" href="_downloads/6455efd81c11199846dbc78f5770b1fd/2DAiryBeam_01.pdf"><code class="xref download docutils literal notranslate"><span class="pre">pdf</span></code></a>)</span><a class="headerlink" href="#id3" title="Link to this image"></a></p>
</figcaption>
</figure>
</section>
<section id="self-healing-airy-beam">
<span id="index-0"></span><h1><span class="section-number">7.3.2. </span>Self-healing Airy beam.<a class="headerlink" href="#self-healing-airy-beam" title="Permalink to this headline"></a></h1>
<span id="index-0"></span><h1><span class="section-number">7.3.2. </span>Self-healing Airy beam.<a class="headerlink" href="#self-healing-airy-beam" title="Link to this heading"></a></h1>
<p>In the video below we demonstrate the self-healing feature of Airy beams.
A 2 mm diameter disk is placed in the path of the main lobe at z = 40 cm. After disturbing the beam, the beam’s shape recovers.</p>
<html>
Expand Down Expand Up @@ -235,7 +239,7 @@ <h1><span class="section-number">7.3.1. </span>Generation of a 2-dimensional Air

<div role="contentinfo">
<p>&#169; Copyright 2017, Fred van Goor.
<span class="lastupdated">Last updated on Sep 04, 2023.
<span class="lastupdated">Last updated on Aug 05, 2024.
</span></p>
</div>

Expand Down
29 changes: 16 additions & 13 deletions docs/BesselBeamWithAnnularSlit.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>7.4.1.2. Generation of a Bessel beam with a lens and an annular slit. &mdash; LightPipes for Python 2.1.4 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/plot_directive.css" type="text/css" />
<title>7.4.1.2. Generation of a Bessel beam with a lens and an annular slit. &mdash; LightPipes for Python 2.1.5 documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/plot_directive.css" />


<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->

<script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=786ba454"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
Expand All @@ -37,7 +40,7 @@
<img src="_static/front.png" class="logo" alt="Logo"/>
</a>
<div class="version">
2.1.4
2.1.5
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
Expand Down Expand Up @@ -108,7 +111,7 @@
<div itemprop="articleBody">

<section id="generation-of-a-bessel-beam-with-a-lens-and-an-annular-slit">
<h1><span class="section-number">7.4.1.2. </span>Generation of a Bessel beam with a lens and an annular slit.<a class="headerlink" href="#generation-of-a-bessel-beam-with-a-lens-and-an-annular-slit" title="Permalink to this headline"></a></h1>
<h1><span class="section-number">7.4.1.2. </span>Generation of a Bessel beam with a lens and an annular slit.<a class="headerlink" href="#generation-of-a-bessel-beam-with-a-lens-and-an-annular-slit" title="Link to this heading"></a></h1>
<p>By positioning an aperture around the disk a non-difracting Bessel beam is generated over a distance given by
the ‘overlap area’. From geometric optics this distance can be estimated by:</p>
<p><span class="math notranslate nohighlight">\(z_{max}=\frac{Df}{a}\)</span>, where <span class="math notranslate nohighlight">\(D\)</span> and <span class="math notranslate nohighlight">\(f\)</span> are the diameter and focallength of the lens respectively.</p>
Expand All @@ -134,7 +137,7 @@ <h1><span class="section-number">7.4.1.2. </span>Generation of a Bessel beam wit

<div role="contentinfo">
<p>&#169; Copyright 2017, Fred van Goor.
<span class="lastupdated">Last updated on Sep 04, 2023.
<span class="lastupdated">Last updated on Aug 05, 2024.
</span></p>
</div>

Expand Down
Loading

0 comments on commit 8436e8f

Please sign in to comment.