TheLartians / PyPropagate

A paraxial wave propagation framework for python
GNU General Public License v3.0
5 stars 7 forks source link

Custom 3D grid for FD #40

Closed s-sajid-ali closed 6 years ago

s-sajid-ali commented 6 years ago

I've seen the examples and the settings object used to define the grid stores the equations. How do I independently create a 3D array of refractive indices and feed it to an FD propagator ?

I'd like to use this grid and compare the results of the FD propagator against the ones I have like I've done here.

TheLartians commented 6 years ago

Hey Sajid, there are multiple ways to feed a custom array into pypropagate.

The preferred and most compatible method is to integrate the array into the internal algebra system by calling pc.array(array_name,array_data), where array_name is an arbitrary string used for printing and array_data is a numpy array containing the data. You can then access array elements inside the algebra system by calling the resulting function with symbolic indices. This is how I created the fresnel zoneplate in this example. This should also work with higher dimensional arrays where all indices are given as arguments to the resulting function. To familiarise yourself with the algebra system I wrote this tutorial, which also covers arrays.

You can also interact with the propagator data directly, however this is a bit more complicated and requires internal knowledge of the implementation and mathematics of the propagator.