Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
157 commits
Select commit Hold shift + click to select a range
db68c3a
trying to figure out local curvature change
DavidLanders95 Sep 18, 2025
9678453
About to implement local hessian solution
DavidLanders95 Sep 19, 2025
af4d26d
Opl difference for one local gaussian seems to work
DavidLanders95 Sep 20, 2025
adfcecb
Added gaussian evaluation routine
DavidLanders95 Sep 20, 2025
730d6dd
Gaussian Beams with Aberrated Lens, Aperture and Single Atom seem to …
DavidLanders95 Sep 22, 2025
1d80cc2
Simplified notebook and added large input plane wave to atom
DavidLanders95 Sep 22, 2025
4bb0b43
Ah confused about single atom and how to fit the surface with a cubic
DavidLanders95 Sep 22, 2025
7bbc136
Not working potential
DavidLanders95 Sep 23, 2025
d59d66f
going to simplify further
DavidLanders95 Sep 23, 2025
b01096b
simplified taylor solution
DavidLanders95 Sep 23, 2025
cbb7cac
simplified taylor solution saved
DavidLanders95 Sep 23, 2025
dd1db45
simplified taylor solution - removed tangent and normal calculation
DavidLanders95 Sep 23, 2025
ea34774
single_ray_single_atom works
DavidLanders95 Sep 23, 2025
191aed3
Functional version against handcoded single ray single atom works
DavidLanders95 Sep 23, 2025
2b3dc91
Single atom multiple rays seems to work
DavidLanders95 Sep 23, 2025
a15a629
Rearranged files tidily in neccessary folders
DavidLanders95 Sep 24, 2025
7729158
Aperture working
DavidLanders95 Sep 24, 2025
a38490b
Gaussian Taylor working with simplified design
DavidLanders95 Sep 26, 2025
a3b944e
Removed unneccessary functions
DavidLanders95 Sep 26, 2025
b3a40ee
Fixed up evaluate.py
DavidLanders95 Sep 26, 2025
f0b7bbe
Getting closer to it working well, about to test amplitude component
DavidLanders95 Sep 27, 2025
a262521
Attenuation seems to work correctly.
DavidLanders95 Sep 27, 2025
8bc3915
aberrated lens working again
DavidLanders95 Sep 29, 2025
86bbb2c
Finalising aberrated fit with gaussians.
DavidLanders95 Oct 7, 2025
6bbb588
Aberration of lens with many gaussians beginning to work.
DavidLanders95 Oct 7, 2025
5c64dd2
Renamed aberrated lens
DavidLanders95 Oct 7, 2025
89b564a
adjusted and cleaned evaluate.py functions
DavidLanders95 Oct 7, 2025
e2123f7
Fixed bug in gaussian_taylor where ray.dx was coming out with an extr…
DavidLanders95 Oct 7, 2025
6bb9bb6
Aberrated lens runs with gpu_kernel and is quite fast
DavidLanders95 Oct 7, 2025
6772714
Edited pallas kernel and added single gaussian test
DavidLanders95 Oct 7, 2025
b36bb18
Very important sign change added to gaussian_taylor.
DavidLanders95 Oct 7, 2025
f7255fc
Aberrated lens and individual biprism seem to work.
DavidLanders95 Oct 7, 2025
36b2288
Adjusted settings in aperture notebook
DavidLanders95 Oct 7, 2025
f114e26
Removed unneccessary notebooks
DavidLanders95 Oct 7, 2025
6d3438b
Edited sign of single gaussian so it matches forward model now
DavidLanders95 Oct 7, 2025
f6e0be3
Renamed aberrated lens simple
DavidLanders95 Oct 7, 2025
6ecaebb
Created aberrated probe notebook
DavidLanders95 Oct 7, 2025
5d5daf3
Added complete Krivanek lens to Gaussian Taylor
DavidLanders95 Oct 7, 2025
d419aa7
Added CollinsPropagator, and FourierTransform Functions - Still need …
DavidLanders95 Oct 7, 2025
5587791
Swapped sign conventions where neccessary so that we correctly follow…
DavidLanders95 Oct 10, 2025
c243312
Switched to more common sign convention... and I think it all works now.
DavidLanders95 Oct 10, 2025
f14e05f
Cleaned up tests and added a Fraunhofer test too
DavidLanders95 Oct 10, 2025
8735a18
Aberrated probe with new gaussians works again.
DavidLanders95 Oct 10, 2025
c063156
Fixed amplitude damping coefficient of components, aberrated probe wo…
DavidLanders95 Oct 11, 2025
37ced48
Added make gaussian aperture function to streamline making of an inpu…
DavidLanders95 Oct 11, 2025
90e1b4b
Updated notebooks with convenience changes
DavidLanders95 Oct 11, 2025
43f5460
Added square plane wave input function for convenience
DavidLanders95 Oct 11, 2025
cdc2821
Making sure notebooks still run
DavidLanders95 Oct 11, 2025
15c2d36
Renamed old aberrations test and replaced it with Krivanek Function
DavidLanders95 Oct 11, 2025
70fbd12
Renamed make_gaussian_aperture with make_gaussian_plane_wave_round_ap…
DavidLanders95 Oct 11, 2025
87d09a0
Added krivanek aberrations
DavidLanders95 Oct 11, 2025
be4809b
Tried to build aberrated probe, but it's not so easy.
DavidLanders95 Oct 11, 2025
1d07aba
Removed needless test
DavidLanders95 Oct 13, 2025
e9ce68c
Trying to test aberrated probe but it's really not so easy. About to…
DavidLanders95 Oct 13, 2025
2bce1d8
Aberrated probe seems to work for small aberrations. More testing req…
DavidLanders95 Oct 13, 2025
58c727f
Aberrated probe seems to work for small aberrations. More testing req…
DavidLanders95 Oct 13, 2025
ef4510a
Added angular spectrum propagator too to test against gaussian beams.
DavidLanders95 Oct 13, 2025
2c23217
Added magnetic phase sample and start of notebook
DavidLanders95 Oct 14, 2025
aa71885
rough gaussian physics solution explained with interactive sliders. A…
DavidLanders95 Oct 16, 2025
c3e8ade
Working on reworked formulation of gaussian beam that has no position…
DavidLanders95 Oct 20, 2025
fbcac47
Tidied up notebook a little.
DavidLanders95 Oct 20, 2025
e4d7aa5
Finalised 1D example with ABCD testcase too.
DavidLanders95 Oct 20, 2025
bab5bf7
Finalised 1D example with ABCD testcase too.
DavidLanders95 Oct 20, 2025
42788cd
Finalised 1D example with ABCD testcase too.
DavidLanders95 Oct 20, 2025
f8aaf82
Merge branch 'gaussian_aberrations2' of https://github.com/TemGym/Tem…
DavidLanders95 Oct 20, 2025
b58a10e
Getting ready to lift from notebook to .py file
DavidLanders95 Oct 20, 2025
4729fd9
Simplified Gaussian1D some more in preparation for .py file
DavidLanders95 Oct 22, 2025
441b031
Removed comment
DavidLanders95 Oct 22, 2025
39b3c91
Moved gaussian code to .py file and verified it still works.
DavidLanders95 Oct 22, 2025
4f3e1f5
Gaussian1D and 2D seem to work.
DavidLanders95 Oct 23, 2025
a4b2314
Moved explainer files
DavidLanders95 Oct 23, 2025
4e2ebc5
Modified BeamFactory to work with new gaussian implementation
DavidLanders95 Oct 23, 2025
ed1e447
Removing old files
DavidLanders95 Oct 28, 2025
63589bd
simplified utils.py energy2wavelength
DavidLanders95 Oct 28, 2025
0f0b8df
Updated Gaussian_Action2D function as the final gaussian beam solutio…
DavidLanders95 Oct 28, 2025
d046b36
Edited ray properties of r_xy and d_xy
DavidLanders95 Oct 28, 2025
8a20570
making new notebooks work and added some tests.
DavidLanders95 Oct 28, 2025
e96ce59
Only one notebook left to get working - aperture_probe.ipynb.
DavidLanders95 Oct 28, 2025
8db4849
Tests pass, all notebooks seem correct. Energy and constant phase not…
DavidLanders95 Oct 28, 2025
b5761ad
Updated FresnelPropagator to have prefactor for test
DavidLanders95 Oct 29, 2025
196fecf
Started adding distorted_projector, and seidel aberrated lens
DavidLanders95 Oct 29, 2025
b5e8d6f
Added make_gaussian_grid_input function so we can test the distortion…
DavidLanders95 Oct 29, 2025
0c411a0
Renamed aberrations in aberrations.py
DavidLanders95 Oct 29, 2025
a40cbab
Renamed variables on make_gaussian and added distorted lens .py file.…
DavidLanders95 Oct 29, 2025
fbac2eb
Added distorted lens
DavidLanders95 Oct 29, 2025
f1b48ff
Updated notebooks
DavidLanders95 Oct 29, 2025
5b17dc7
Resetting again before implementing simpler propagator
DavidLanders95 Nov 3, 2025
6ec31fb
Simplifying action update without amplitude for now. Added tests whic…
DavidLanders95 Nov 4, 2025
5201a74
All tests except for fourierABCD propagator pass
DavidLanders95 Nov 4, 2025
6ee2290
Distorted lens works.
DavidLanders95 Nov 4, 2025
e66f1ef
Added spiral distortion solution and fixed zero_phase error in aberra…
DavidLanders95 Nov 5, 2025
c15b4a8
Removed redundant explainer notebooks
DavidLanders95 Nov 5, 2025
9e40f3e
Got magnetic phase sample working again
DavidLanders95 Nov 5, 2025
06204d1
Sample Hologram tidied up a bit but works
DavidLanders95 Nov 6, 2025
b24e16a
Moved files to utils, tidied up sample phase hologram a bit more
DavidLanders95 Nov 6, 2025
39fcb94
on-axis distortion seems to work
DavidLanders95 Nov 6, 2025
96f331e
Off axis and on axis aberrated hologram programmes are made, but I ha…
DavidLanders95 Nov 6, 2025
118eb42
Found parameters to make distortion field
DavidLanders95 Nov 6, 2025
23bb058
Lowered simulation size
DavidLanders95 Nov 6, 2025
26ce3de
Removed old gaussian code
DavidLanders95 Nov 6, 2025
3a2e54b
Removing old code and simplifying gaussian.py
DavidLanders95 Nov 6, 2025
f973125
Tidied up gaussian.py and moved functions to utils.py
DavidLanders95 Nov 6, 2025
06ab5d8
Added offset to input plane wave object
DavidLanders95 Nov 6, 2025
fd7f182
made elaborate sample notebook, but not working yet
DavidLanders95 Nov 7, 2025
6728bda
Created aberrated Sample notebook and it seems to work ok.
DavidLanders95 Nov 7, 2025
e1c8b5b
changes to get model working for malika
DavidLanders95 Nov 7, 2025
3099be9
hard to get chosen fringe spacing to line up with model
DavidLanders95 Nov 13, 2025
44ef710
Down to 6nm fringe spacing and with the equations to automate it
DavidLanders95 Nov 13, 2025
8653238
Updated lens_biprism with some titles.
DavidLanders95 Nov 13, 2025
f2b1ded
Added in overlap factor instead of num_rays argument to square wave
DavidLanders95 Nov 13, 2025
d96fb29
added overlap factor to rectangular_input_wave
DavidLanders95 Nov 13, 2025
54de327
Working with projector lens turned off
DavidLanders95 Nov 13, 2025
464a697
Readded in projector lens
DavidLanders95 Nov 13, 2025
79c7a20
Began to add amplitude back into the gaussian update
DavidLanders95 Nov 14, 2025
51299de
Modified GaussianBeam representation to be a a litle simpler, and add…
DavidLanders95 Nov 14, 2025
c2dba27
Reran notebooks to make sure they still work
DavidLanders95 Nov 14, 2025
d67174f
Simplified _call__ method
DavidLanders95 Nov 14, 2025
dc27f3b
Added and removed some comments
DavidLanders95 Nov 17, 2025
3c5b5fc
Tried to add hologram test against libertem - a bit finicky as everyt…
DavidLanders95 Nov 17, 2025
1c1202a
Add 2D intepolating function and normalisation to square wave input. …
DavidLanders95 Nov 17, 2025
21397c8
renamed variables in libertem_holo_test and added 3D interpolator
DavidLanders95 Nov 18, 2025
b2a596e
Removed constants from utils and put them into new file and simplifie…
DavidLanders95 Nov 18, 2025
9849edf
Linting
DavidLanders95 Nov 18, 2025
7a62b8a
First pass at interpolated sample in holograph aberrations
DavidLanders95 Nov 18, 2025
46ac67b
Added linear phase cube, amplitude, rotation and reference hologram g…
DavidLanders95 Nov 19, 2025
f1352c2
Removed old magnetic sample
DavidLanders95 Nov 19, 2025
931fc54
Added explanation headings to notebook and astigmated hologram compar…
DavidLanders95 Nov 19, 2025
5f470b5
Run first hologram with no astigmatism
DavidLanders95 Nov 19, 2025
648ed1a
Added phase plate visualisation
DavidLanders95 Nov 19, 2025
f0d8ace
Added unit option to gaussian beam
DavidLanders95 Nov 20, 2025
f1195fe
Added single slice of atomic potential, and Atom simulation seems to …
DavidLanders95 Nov 21, 2025
9fbf8ab
Removed old gaussian test notebook that is no longer needed
DavidLanders95 Nov 21, 2025
5e40a98
Glauber solution is fairly complicated, and not sure what integration…
DavidLanders95 Nov 21, 2025
7553a5c
Multislice solution is imperfect, but maybe with higher order integra…
DavidLanders95 Nov 21, 2025
65681b5
Ray method still won't converge with trying some new parameters
DavidLanders95 Nov 23, 2025
99a9aee
Added probe input wavefunction
DavidLanders95 Nov 23, 2025
d8095b4
Added heading to aperture probe notebook
DavidLanders95 Nov 24, 2025
f4bd0ef
Tested STEM probe in atomic scattering - found it also does not work
DavidLanders95 Nov 24, 2025
5035c99
Added update to gaussianbeam.derive to include _one
DavidLanders95 Nov 24, 2025
b0b856f
Tested third order gaussian beam but didn't make a difference.
DavidLanders95 Nov 24, 2025
2ff6f7a
Added a random phase sample
DavidLanders95 Dec 1, 2025
4131b98
Added amorphous carbon sample - no tested and verified Contrast Trans…
DavidLanders95 Dec 1, 2025
44141c3
Ran tests, simulation does seem to work for small non-linear phase pl…
DavidLanders95 Dec 5, 2025
13e866d
Measurement of hologram works with ROI usage from Libertem
DavidLanders95 Dec 8, 2025
2a170a6
Can't measure MIP yet - something is wrong with the scale
DavidLanders95 Dec 8, 2025
3b58c68
Can get ball park MIP measurements. Still off by a volt though.
DavidLanders95 Dec 10, 2025
fd3bea6
Removing buggy phase of square
DavidLanders95 Dec 15, 2025
ccb367f
Managed to get a simulation working - Fringe spacing of utmost impor…
DavidLanders95 Dec 22, 2025
f94394d
God single lens optimisation working, but hard to know what loss func…
DavidLanders95 Feb 4, 2026
90b527e
Updated notebook and it seems to converge.
DavidLanders95 Feb 4, 2026
7ab7e63
SSIM with single lens and lbfgs seems to work ok.
DavidLanders95 Feb 5, 2026
a5c0421
Did quick test with simpsons rule, I am on the right track with gauss…
DavidLanders95 Feb 6, 2026
546ee4a
Checkpoint from VS Code for cloud agent session
DavidLanders95 Feb 6, 2026
85b29b4
Create simplified two-lens notebook with Collins FFT and Optuna integ…
Copilot Feb 6, 2026
9f42abb
Add test script and documentation for simplified two-lens notebook
Copilot Feb 6, 2026
74e2fad
Fix code style issues in test script
Copilot Feb 6, 2026
4ddd459
Add comprehensive implementation summary document
Copilot Feb 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
628 changes: 628 additions & 0 deletions archived/aberrated_probe.ipynb

Large diffs are not rendered by default.

346 changes: 346 additions & 0 deletions archived/aberrated_probe_further_testing.ipynb

Large diffs are not rendered by default.

585 changes: 585 additions & 0 deletions archived/aberrations_visualisation.ipynb

Large diffs are not rendered by default.

388 changes: 388 additions & 0 deletions archived/aperture_image.ipynb

Large diffs are not rendered by default.

794 changes: 794 additions & 0 deletions archived/approximating_functions_with_gaussians_example.ipynb

Large diffs are not rendered by default.

389 changes: 389 additions & 0 deletions archived/fit_three_gaussians.ipynb

Large diffs are not rendered by default.

546 changes: 546 additions & 0 deletions archived/local_gaussians_hessian.ipynb

Large diffs are not rendered by default.

463 changes: 463 additions & 0 deletions archived/local_gaussians_parabola.ipynb

Large diffs are not rendered by default.

598 changes: 0 additions & 598 deletions examples/aberrated_probe.ipynb

This file was deleted.

452 changes: 0 additions & 452 deletions examples/aperture_diffraction.ipynb

This file was deleted.

399 changes: 0 additions & 399 deletions examples/aperture_image.ipynb

This file was deleted.

627 changes: 627 additions & 0 deletions examples/atoms/abtem_HRTEM_example.ipynb

Large diffs are not rendered by default.

1,066 changes: 1,066 additions & 0 deletions examples/atoms/glauber_ray_example.ipynb

Large diffs are not rendered by default.

414 changes: 414 additions & 0 deletions examples/atoms/multiple_rays_single_atom.ipynb

Large diffs are not rendered by default.

377 changes: 377 additions & 0 deletions examples/atoms/single_ray_single_atom_baseline.ipynb

Large diffs are not rendered by default.

603 changes: 0 additions & 603 deletions examples/biprism.ipynb

This file was deleted.

314 changes: 0 additions & 314 deletions examples/decompose_image_into_gaussians.ipynb

This file was deleted.

389 changes: 0 additions & 389 deletions examples/fit_three_gaussians.ipynb

This file was deleted.

521 changes: 521 additions & 0 deletions examples/gaussians/aberrated_aperture_probe.ipynb

Large diffs are not rendered by default.

311 changes: 311 additions & 0 deletions examples/gaussians/aberrated_krivanek_image.ipynb

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions examples/gaussians/aberrated_krivanek_lens.ipynb

Large diffs are not rendered by default.

269 changes: 269 additions & 0 deletions examples/gaussians/aperture.ipynb

Large diffs are not rendered by default.

374 changes: 374 additions & 0 deletions examples/gaussians/aperture_probe.ipynb

Large diffs are not rendered by default.

374 changes: 374 additions & 0 deletions examples/gaussians/biprism.ipynb

Large diffs are not rendered by default.

175 changes: 175 additions & 0 deletions examples/gaussians/discontinuous_phase_error_demo.ipynb

Large diffs are not rendered by default.

456 changes: 456 additions & 0 deletions examples/gaussians/distorted_projector_lens.ipynb

Large diffs are not rendered by default.

500 changes: 500 additions & 0 deletions examples/gaussians/lens_biprism.ipynb

Large diffs are not rendered by default.

338 changes: 338 additions & 0 deletions examples/gaussians/magnetic_phase_sample.ipynb

Large diffs are not rendered by default.

420 changes: 420 additions & 0 deletions examples/gaussians/sigmoid_aperture.ipynb

Large diffs are not rendered by default.

167 changes: 167 additions & 0 deletions examples/gaussians/single_gaussian.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "6d5e74cc",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.environ['JAX_ENABLE_X64'] = '1'\n",
"os.environ['XLA_PYTHON_CLIENT_MEM_FRACTION'] = '0.1' \n",
"\n",
"%matplotlib widget\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import jax\n",
"import jax.numpy as jnp\n",
"\n",
"import numpy as np\n",
"from temgym_core.components import Detector\n",
"from temgym_core.gaussian import (\n",
" Lens,\n",
" run_to_end,\n",
" make_gaussian,\n",
")\n",
"from temgym_core.constants import energy2wavelength\n",
"from temgym_core.evaluate import evaluate_gaussians_gpu_kernel_wrapper, evaluate_gaussians_for, evaluate_gaussians_jax_scan\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "38bc5771",
"metadata": {},
"outputs": [],
"source": [
"jax.config.update(\"jax_enable_x64\", True)\n",
"W = 100e-9\n",
"\n",
"Nx = Ny = 512\n",
"dx = W/Nx\n",
"dy = W/Ny\n",
"input_grid = Detector(z=0.0, pixel_size=(dx, dy), shape=(Nx, Ny))\n",
"input_extent = input_grid.extent\n",
"coords = input_grid.coords\n",
"X, Y = coords[:, 0].reshape(input_grid.shape), coords[:, 1].reshape(input_grid.shape)\n",
"\n",
"distance = 1e-3\n",
"output_grid = Detector(z=distance, pixel_size=(dx * 4, dy * 4), shape=(Nx, Ny))\n",
"output_extent = output_grid.extent\n",
"\n",
"voltage = 100e3\n",
"wavelength = energy2wavelength(voltage) # 200 keV\n",
"k0 = 2 * jnp.pi / wavelength\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "43c6bbf2",
"metadata": {},
"outputs": [],
"source": [
"w0 = 1e-8 # beam waist\n",
"\n",
"rays_in = make_gaussian(waist_x=w0, waist_y=w0, voltage=voltage)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "73963965",
"metadata": {},
"outputs": [],
"source": [
"lens = Lens(focal_length=1e-5, z=0.0)\n",
"rays_out = run_to_end(rays_in, [lens])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "773df429",
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "evaluate_gaussians_reliable() missing 5 required positional arguments: 'amplitude', 'pathlength', 'Q_inv', 'k', and 'r2'",
"output_type": "error",
"traceback": [
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
"\u001b[31mTypeError\u001b[39m Traceback (most recent call last)",
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[5]\u001b[39m\u001b[32m, line 2\u001b[39m\n\u001b[32m 1\u001b[39m E_in = evaluate_gaussians_for(rays_out, input_grid)\n\u001b[32m----> \u001b[39m\u001b[32m2\u001b[39m E_gpu = \u001b[43mevaluate_gaussians_reliable\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrays_out\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43minput_grid\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 3\u001b[39m E_scan = evaluate_gaussians_jax_scan(rays_out, input_grid)\n\u001b[32m 5\u001b[39m \u001b[38;5;66;03m# assert jnp.allclose(E_in, E_gpu), \"E_in and E_gpu are not the same\"\u001b[39;00m\n",
"\u001b[31mTypeError\u001b[39m: evaluate_gaussians_reliable() missing 5 required positional arguments: 'amplitude', 'pathlength', 'Q_inv', 'k', and 'r2'"
]
}
],
"source": [
"E_in = evaluate_gaussians_for(rays_out, input_grid)\n",
"E_gpu = evaluate_gaussians_gpu_kernel_wrapper(rays_out, input_grid)\n",
"E_scan = evaluate_gaussians_jax_scan(rays_out, input_grid)\n",
"\n",
"# assert jnp.allclose(E_in, E_gpu), \"E_in and E_gpu are not the same\"\n",
"assert jnp.allclose(E_in, E_scan), \"E_in and E_scan are not the same\"\n",
"# assert jnp.allclose(E_gpu, E_scan), \"E_gpu and E_scan are not the same\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "02ad1737",
"metadata": {},
"outputs": [],
"source": [
"fig, axs = plt.subplots(1, 2, figsize=(12, 5))\n",
"\n",
"# Phase of gaussian beam\n",
"axs[0].imshow(np.angle(E_in), extent=input_extent, cmap='twilight')\n",
"axs[0].set_title('Phase')\n",
"axs[0].set_xlabel('x (m)')\n",
"axs[0].set_ylabel('y (m)')\n",
"axs[0].axis('equal')\n",
"\n",
"quadratic_phase = jnp.exp(-1j * k0 / (2 * lens.focal_length) * (X**2 + Y**2))\n",
"axs[1].imshow(np.angle(quadratic_phase), extent=input_extent, cmap='twilight')\n",
"axs[1].set_title('Phase')\n",
"axs[1].set_xlabel('x (m)')\n",
"axs[1].set_ylabel('y (m)')\n",
"axs[1].axis('equal')\n",
"\n",
"# Plot cross section\n",
"plt.figure()\n",
"plt.plot(np.angle(E_in[Nx//2,:]), label='Gaussian beam')\n",
"plt.plot(np.angle(quadratic_phase[Nx//2,:]), label='Quadratic phase')\n",
"plt.xlabel('x (nm)')\n",
"plt.ylabel('Phase (radians)')\n",
"plt.legend()\n",
"plt.title('Phase cross-section at y=0')\n",
"\n",
"plt.figure()\n",
"plt.imshow(np.abs(E_in), extent=input_extent, cmap='inferno')\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "temgym_core (3.12.3)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
338 changes: 338 additions & 0 deletions examples/gaussians/two_gaussians_interfering.ipynb

Large diffs are not rendered by default.

286 changes: 286 additions & 0 deletions examples/holography_distortion/3D_sample_phase_shift.ipynb

Large diffs are not rendered by default.

324 changes: 324 additions & 0 deletions examples/holography_distortion/amorphous_carbon.ipynb

Large diffs are not rendered by default.

Loading