Closed irfanimaduddin closed 2 years ago
The simulator evaluates the propagation of the light by creating a grid.
extent_x
and extent_y
are the length and height of the rectangular grid and Nx
, Ny
the dimension of the grid respectively.
As you increase the value of Nx
and Ny
the simulation becomes more accurate but more computationally expensive.
Select extent_x
and extent_y
to be larger than your diffraction pattern.
I would like to simulate the diffraction pattern of a grating 20 cm in front of a telescope (F=11 m, D=60 cm) at its focal plane. Do you have some suggestions? Thank you in advance.
It should be straightforward, I can help you. By a grating of 20 cm, what do you mean, exactly?
Note: I recommend waiting until tomorrow, I'm going to make a major update to the repository. I want to convert it into a far more advanced physical optics simulator.
Sorry I still can't catch you up for this one.
The simulator evaluates the propagation of the light by creating a grid. extent_x and extent_y are the length and height of the rectangular grid and Nx, Ny the dimension of the grid respectively.
Do you mean like this?
By a grating of 20 cm, what do you mean, exactly?
I mean the distance between grating and lens is 20 cm.
Note: I recommend waiting until tomorrow, I'm going to make a major update to the repository. I want to convert it into a far more advanced physical optics simulator.
Awesome! Can't wait for it. Does the update include the use of thick lenses as well? And what if we want to use a custom refractive index for the lens? Is it accommodated?
Do you mean like this?
Yes, your guess is right
I mean the distance between grating and lens is 20 cm.
Then, it would be something like this:
import diffractsim
diffractsim.set_backend("CPU") #Change the string to "CUDA" to use GPU acceleration
from diffractsim import MonochromaticField, ApertureFromImage, Lens, mm, nm, cm
F = MonochromaticField(
wavelength=555 * nm, extent_x=60 * cm, extent_y=60 * cm, Nx=1500, Ny=1500
)
F.add(ApertureFromImage("/apertures/your_grating.png", image_size=(30*cm, 30*cm), simulation = F))
F.plot_intensity( square_root = True)
F.propagate(20*cm)
F.add(Lens(f = 1100*cm, radius = 30*cm))
# Very important, rescale the simulation plane to be able to see the small PSF of the telescope
F.scale_propagate(1100*cm, scale_factor = 0.01)
F.plot_intensity( square_root = True)
Note the scale_factor, it should be of the size you expect the PSF of your telescope would be.
Awesome! Can't wait for it. Does the update include the use of thick lenses as well? And what if we want to use a custom refractive index for the lens? Is it accommodated?
Currently, thick lenses cannot be directly introduced, but they can be modeled introducing the associated aberration in the Lens object
Hi! Could you explain me what are NX and NY in
MonochromaticField
andPolychromaticField
? What are they correlation with extent_x and extent_y visually? I would like to simulate diffraction pattern of a grating 20 cm in front of a telescope (F=11 m, D=60 cm) at its focal plane. Do you have some suggestions? Thank you in advance.