Git Product home page Git Product logo

article_mmf_disorder's Introduction

Code examples and supporting data for the paper

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 experiment
  • TM_modes_X.npz: transmission matrix in the mode basis after correction for the deformation
  • TM5_0.npy and TM5_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.npy and TM17_1.npy: full transmission matrix in the pixel basis for no deformation ()
  • TM25_0.npy and TM25_1.npy: full transmission matrix in the pixel basis for
  • TM35_0.npy and TM35_1.npy: full transmission matrix in the pixel basis for
  • TM50_0.npy and TM50_1.npy: full transmission matrix in the pixel basis for
  • TM52_0.npy and TM52_1.npy: full transmission matrix in the pixel basis for the maximum deformation ().
  • conversion_matrices.npz: contains the matrices modes_in and modes_out mode 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.npz with XX = 17, 25, 35 and 50. Results of the aberration correction relative to the corresponding full pixel basis transmission matrix TMXX.

/Generate_theoretical_modes

Calculation of the theoretical fiber modes.

Requires: pyMMF

See section 2.1 of the Supplementary Information.

/Aberration_correction

See section 2.2 of the Supplementary Information.

Requires: PyTorch

/Analysis

Processing of the results and creation of the plots.

/Layout

Generation of input mask on the digital micro-mirror device (DMD)

See section 1.2 of the Supplementary Information.

Requires: SLMLayout

More information

Visit our website on Wavefrontshaping.net for more information, codes and tutorials.

article_mmf_disorder's People

Contributors

wavefrontshaping avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

863zq michaelw17

article_mmf_disorder's Issues

What is the version of pytorch of this code?

i meet errors of dtype with pytorch, the repo as follows, i think is the version of pytorch causing this, my pytorch version is 1.13.1+cu116
/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/functional.py:4289: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
warnings.warn(
/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/functional.py:4227: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
warnings.warn(
Traceback (most recent call last):
File "/data/hll/liangliang/article_MMF_disorder-main/Aberration_correction/temp.py", line 154, in
y_pred = model(pt_modes_in,pt_modes_out)
File "/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/hll/liangliang/article_MMF_disorder-main/Aberration_correction/PyTorchAberrations/aberration_models.py", line 37, in forward
output_modes = self.abberation_output(output_modes)
File "/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/hll/liangliang/article_MMF_disorder-main/Aberration_correction/PyTorchAberrations/aberration_models.py", line 103, in forward
input = self.zernike_ft(input)
File "/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/modules/container.py", line 204, in forward
input = module(input)
File "/home/dell/anaconda3/envs/ddpm/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/data/hll/liangliang/article_MMF_disorder-main/Aberration_correction/PyTorchAberrations/aberration_layers.py", line 142, in forward
return ComplexZernikeFunction.apply(input, self.alpha, self.j)
File "/data/hll/liangliang/article_MMF_disorder-main/Aberration_correction/PyTorchAberrations/aberration_layers.py", line 23, in forward
nx = torch.arange(0,1,1./input.shape[1], dtype = input.dtype)
RuntimeError: "arange_cpu" not implemented for 'ComplexFloat'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.