Skip to content

slohani-ai/LG-OAM-simulations-with-Tensors

Repository files navigation


Logo

OAM-Tensors (GPU/CPU)

Sanjaya Lohani (https://sanjayalohani.com) . slohani@mlphys.com.

Let's leverage the power of tensor operations in simulating LG-OAM intensity modes, and phase patterns for a Spatial Light Modulator (SLM). Being tensors, the generated patterns can be directly fed into any machine learning frameworks.
Explore the docs »

Superposition OAM Tensors . Non-Superposition OAM Tensors · Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Optical communication relies on the generation, transmission, and detection of states of light to encode and send information. In order to increase the transfer rate one of the most promising methods is making use of orbital angular momentum (OAM) states of light. However, a primary technical difficulty is the accurate classification of OAM value detected at the receiver. This project explores the various ways to simulate LG-OAM states (with GPU) that can be easily applied to train/test any machine learning setups at the receiver in prior. Additionally, the code generates phase patterns that can be uploaded to a SLM in order to have the correspoinding spatial distribution at the receiver. Overall this provides the robust way to simulate Laguerre-Gauss OAM modes to be used in the real-world communication setups.

Please cite the following(s) if you use any part of the code in your project:

  • Lohani, S., Knutson, E. M., & Glasser, R. T. (2020). Generative machine learning for robust free-space communication. Communications Physics, 3(1), 1-8. nature-communications physics.
  • Lohani, S., & Glasser, R. T. (2018). Turbulence correction with artificial neural networks. Optics letters, 43(11), 2611-2614. OSA-Optics Letters . arXiv.
  • Lohani, S., Knutson, E. M., O’Donnell, M., Huver, S. D., & Glasser, R. T. (2018). On the use of deep neural networks in optical communications. Applied optics, 57(15), 4180-4190. OSA-Applied Optics . arXiv.

Thank you!

Built With

Getting Started

To get a local copy up and running, follow these simple steps.

Prerequisites

Please install libraries from the requirements.txt file

pip install requirements.txt

Installation

  1. Clone the repo
    git clone https://github.com/slohani-ai/LG-OAM-simulations-with-Tensors.git

Usage

from utils.Imaging import Save
from utils.Noise import Noise_Dist
from source.OAM_Intensity_Phase import LG_Lights_Tensorflow

lg = LG_Ligths_Tensorflow(xpixel, ypixel, dT, verbose)

where xpixel = width, ypixel = height, dT = SLM resolution (typically 8e-6 m), and versbose is False as default.

It only requires a single line of code to simulate everything.

  • Superposition Modes. Documentation: please see Superposition_OAM_Tensors_GPU

    1. A single batch of superposition of various modes

      Intensity, Phase = lg.Superposition(p_l_array, alpha_array, w, grating_period, save_image)
    2. Simultaneous simulation for multple batches of superposition modes ; ; .. .. ..

       Intensity, Phase = lg.Superposition_Batch(p_l_array, alpha_array, w, grating_period, save_image)

      where,

      • p_l_array: Tensorflow tensor or Numpy array of size [None, 2] for a single batch and [Batch, No. of modes to be superposed per layer, 2] for superposition_batch. In [None, 2] first column represents p-value and second column repesents l-value,
      • alpha_array: an array or list representing mixture percentages of various modes,
      • w = beam width at z = 0,
      • grating_period: grating lines. Usful in implementing the simulated phase mask on the SLM,
      • save_image: False as default. If True, simulated OAM modes are automatically saved as images in the same dir. for example the following script simultaneously generates multiple superposition OAM modes.
      p_set = np.random.randint(0, 2, 36) 
      l_set = np.random.randint(-10, 10, 36)
      p_and_l_set = np.stack([p_set, l_set],axis=1)
      p_and_l_set = p_and_l_set.reshape(-1, 3, 2) #(batch, no. of oam modes to be superimposed, 2)
      
      alpha_array = np.ones([len(p_and_l_set), 3, 1])
      
      lg.verbose=False
      intensity_list, phase_list = lg.Superposition_Batch(p_l_array=p_and_l_set, alpha_array=alpha_array,\
                                                  w=0.00015, grating_period=0, save_image=False)
      
      print ('Total size of SUP-OAM modes: ',len(intensity_list))
      
      fig, ax = plt.subplots(nrows=3, ncols=4, figsize=(8, 8))
      for i, axi in enumerate(ax.flat):
        axi.imshow(intensity_list[i])
        axi.set_title(f'SUP-OAM {i}')
      plt.tight_layout()
      plt.show()

      Intensity

      and Corresponding Phase masks at grating period = 20 are shown below,

      lg.verbose=False
      intensity_list, phase_list = lg.Superposition_Batch(p_l_array=p_and_l_set, alpha_array=alpha_array,\
                                                  w=0.00015, grating_period=20, save_image=False)
      fig, ax = plt.subplots(nrows=3, ncols=4, figsize= (8, 8))
      for i, axi in enumerate(ax.flat):
      axi.imshow(phase_list[i])
      axi.set_title(f'SUP-Phase {i}')
      plt.tight_layout()
      plt.show()

      Phase

  • Non-superposition Modes. Documentation: please see Non-Superposition_OAM_Tensors_GPU

    • Multiple non-superposition OAM modes simultaneously,
    Intensity, Phase = lg.Non_Superposition(p_l_array, w, grating_period, save_image)
  • Noisy OAM Modes. (for example 200 noisy superposition modes per clean OAM image).

intensity_with_gaussian = Noise_Dist().Guassian_Noise_Batch(intensity_list, mean=0., std=1., multiple=200, factor=5e5)

This also supports Gaussain_Noise, Possion_Noise, Gamma_Noise, Poisson_Noise_Batch and Gamma_Noise_Batch as well.

  • Saving Tensors as Images. (for example saving 200 noisy superposition modes for each clean OAM images simultaneously)
Save().Save_Tensor_Image(intensity_with_gaussian)

For more examples, please refer to Superposition Notebook . Non-Superposition Notebook

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/NewFeature)
  3. Commit your Changes (git commit -m 'Add some NewFeature')
  4. Push to the Branch (git push origin feature/NewFeature)
  5. Open a Pull Request

License

Distributed under the Apache License. See LICENSE for more information.

Contact