Skip to content

How to get an inline hologram of the MNIST dataset? #19

Answered by rafael-fuente
Sud11111 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Sud11111,

Your holograms are amplitude holograms, and they are recorded from [-1,1] amplitude range. You need to specify this ApertureFromImage object because the default is [0,1]:

import diffractsim
diffractsim.set_backend("CPU") 
from diffractsim import MonochromaticField,ApertureFromImage, mm, cm, nm

λ = 600 * nm

F = MonochromaticField(
    wavelength=600*nm, extent_x=70*λ, extent_y=70*λ, Nx=1024, Ny=1024, intensity = 0.01
)

F.add(ApertureFromImage("9.png", image_size=(25*λ, 25 *λ), simulation = F, amplitude_mask_extent = [-1,1]))


F.propagate(z=30*λ)
rgb = F.get_colors()

F.plot_colors(rgb)

This example would reconstruct the number 9 hologram:

Note that the holograms don't hav…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rafael-fuente
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants