kaanaksit / odak

Scientific computing library for optics, computer graphics and visual perception.
https://kaanaksit.com/odak
Mozilla Public License 2.0
177 stars 52 forks source link

Zero padding and cropping in beam propagation #42

Closed kaanaksit closed 1 year ago

kaanaksit commented 2 years ago

While propagating coherent optical beams with Odak using odak.wave.propagate_beam or odak.learn.wave.propagate_beam, oftentimes, we have to first zero pad an input field in space and afterwards crop the propagated field in space again. Rather than following this, it makes perfect sense to have a flag variable as an input to beam propagation functions so that we avoid rewriting the same code in future projects.

kaanaksit commented 2 years ago

Commit a88fef455bfd1ec7bcaff86fe1623b2b0a84eb8d resolves this issue in odak.learn.wave.propagate_beam with zero_padding=[False, False, False]:

zero_padding     : list
                       Zero padding the input field if the first item in the list set true. Zero padding in the Fourier domain if the second item in the list set to true. Cropping the result with half resolution if the third item in the list is set to true.

I will go ahead and find a way to unify odak.wave.propagate_beam and odak.learn.wave.propagate_beam.

kaanaksit commented 1 year ago

We will not bring this to odak.wave.propagate_beam as we are not actively using this submodule at the time being.