article_MMF_disorder
article_MMF_disorder copied to clipboard
Code examples and supporting data for the paper
Learning and avoiding disorder in multimode fibers
M. W. Matthès, Y. Bromberg, J. de Rosny and S. M. Popoff
@article{PhysRevX.11.021060,
title = {Learning and Avoiding Disorder in Multimode Fibers},
author = {Matth\`es, Maxime W. and Bromberg, Yaron and de Rosny, Julien and Popoff, S\'ebastien M.},
journal = {Phys. Rev. X},
volume = {11},
issue = {2},
pages = {021060},
numpages = {12},
year = {2021},
month = {Jun},
publisher = {American Physical Society},
doi = {10.1103/PhysRevX.11.021060},
url = {https://link.aps.org/doi/10.1103/PhysRevX.11.021060}
}
Global requirements:
- Numpy
- Matplotlib
/Data
Contain the raw and processed data required to generate the figures and to run the demo codes.
param.json: json file containing the parameters of the experimentTM_modes_X.npz: transmission matrix in the mode basis after correction for the deformationTM5_0.npyandTM5_1.npy: full transmission matrix in the pixel basis for no deformation (). Because of the 100 Mo restriction of Github, the file is split into two, can be recombined with:
import numpy as np
part1 = np.load('TM5_0.npy')
part2 = np.load('TM5_1.npy')
TM_ref_pix = np.concatenate([part1, part2], axis = 0)
TM17_0.npyandTM17_1.npy: full transmission matrix in the pixel basis for no deformation ()
TM25_0.npyandTM25_1.npy: full transmission matrix in the pixel basis forTM35_0.npyandTM35_1.npy: full transmission matrix in the pixel basis forTM50_0.npyandTM50_1.npy: full transmission matrix in the pixel basis forTM52_0.npyandTM52_1.npy: full transmission matrix in the pixel basis for the maximum deformation ().
conversion_matrices.npz: contains the matricesmodes_inandmodes_outmode matrices computed for a system without aberration. They are generated using Generate_theoretical_modes/Generate_modes.ipynb.modes_in_after_correction.npy: Change of basis matrix between the input mode basis and the input pixel basis after aberration correction optimization.modes_out_after_correction.npy: Change of basis matrix between the output mode basis and the output pixel basis after aberration correction optimization.mask_near_degenerate.npy: a mask of the same size as the mode basis TM that represents the blocks of quasi-degenerate modes.TM_XX_optimization_results.npzwith XX = 17, 25, 35 and 50. Results of the aberration correction relative to the corresponding full pixel basis transmission matrixTMXX.
/Generate_theoretical_modes
Calculation of the theoretical fiber modes.
Requires: pyMMF
See section 2.1 of the Supplementary Information.
- Generate_theoretical_modes/Generate_modes.ipynb: Jupyter notebook containing an sample code to compute the theoretical mode profiles knowing the properties of the multimode fiber.
- Generate_theoretical_modes/functions.py: Some useful functions to generate the plots.
/Aberration_correction
See section 2.2 of the Supplementary Information.
Requires: PyTorch
-
Aberration_correction/Demo_correction_aberration.ipynb: Demo code to use the aberration correction model based on PyTorch framework. It requires a TM measured in the pixel basis and the theoretical modes. It learns the aberrations and misalignments of the optical system and compensate for them. It outputs a TM in the basis of the fiber modes.
-
Aberration_correction/Compare_optimization_results.ipynb: Code to compare the results of the optimization for different values of the deformation applied. Uses the
TM_XX_optimization_results.npzdata files. Corresponds to the results presented in the Section S5 of the Supplementary Information of manuscript. -
Aberration_correction/functions.py: Some useful functions to generate the plots.
-
PyTorchAberrations/aberration_models.py: The PyTorch model to apply a set of aberrations and a deformation to the change of basis matrices.
-
PyTorchAberrations/aberration_layers.py: Individual custom layers corresponding to each aberration/deformation we can introduce in the model.
-
PyTorchAberrations/aberration_functions.py: Useful PyTorch functions, in particular to handle complex linear operations using two layers for the real and imaginary parts.
/Analysis
Processing of the results and creation of the plots.
-
Analysis_Deformation.ipynb: Data processing and creation of the figures in the main text of the article.
-
Figures_SI.ipynb: Data processing and creation of the figures for the Supplementary Information.
-
functions.py: Some useful functions to generate the plots.
/Layout
Generation of input mask on the digital micro-mirror device (DMD)
See section 1.2 of the Supplementary Information.
Requires: SLMLayout
- Demo_layout.ipynb: A sample code to generate input patterns to send on the DMD.
More information
Visit our website on Wavefrontshaping.net for more information, codes and tutorials.