Skip to content
Snippets Groups Projects
Commit 57d861f9 authored by Joris Nonnast's avatar Joris Nonnast
Browse files

add bahtinov notebook

parent 5728f872
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:9c99c583 tags:
``` python
import cv2
import numpy as np
import matplotlib.pyplot as plt
from diffractio import um, nm, mm, np, degrees
from diffractio.scalar_sources_XY import Scalar_source_XY
from diffractio.scalar_fields_XY import Scalar_field_XY
from diffractio.scalar_masks_XY import Scalar_mask_XY
from ipywidgets import interact, fixed
```
%% Output
number of processors: 4
total memory : 7.6 Gb
available memory : 48 %
max frequency : 2900 GHz
%% Cell type:code id:303e2923 tags:
``` python
%matplotlib notebook
mask = cv2.imread("BahtinovMask.png", cv2.IMREAD_GRAYSCALE)
mask = np.pad(mask, 2*len(mask))
h, w = 1024, 1024
mask = cv2.resize(mask, (w, h))
length = 10*mm
x0 = np.linspace(-length/2, length/2, 1024)
y0 = np.linspace(-length/2, length/2, 1024)
wavelength = 0.580 * um
u0 = Scalar_source_XY(x=x0, y=y0, wavelength=wavelength)
t1 = Scalar_mask_XY(x=x0, y=y0, wavelength=wavelength)
```
%% Cell type:code id:2632f9d4 tags:
``` python
%matplotlib inline
def propagate(z):
u0 = Scalar_source_XY(x=x0, y=y0, wavelength=wavelength)
u0.RS(z=10*mm, new_field=False)
t0 = Scalar_mask_XY(x=x0, y=y0, wavelength=wavelength)
t0.circle((0, 0), 1*mm)
u0 = u0*t0
u0.RS(z=z, new_field=False)
#u0 = u0.RS(z=10*mm)
u0.draw(logarithm=True)
interact(propagate, z=(0*mm, 1*mm, 0.005*mm))
```
%% Output
<function __main__.propagate(z)>
%% Cell type:code id:93fcb03e tags:
``` python
```
%% Cell type:code id:03bc9175 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment