Git Product home page Git Product logo

Comments (4)

wavefrontshaping avatar wavefrontshaping commented on May 30, 2024

Hi,

Can you tell me what example you are talking about?
I do not see any radial solver example in the pyMMF README file.
However, I can tell you that the first error is not so much a bug as a difference of behavior between Python 3.6 and 3.8.
I will happily change it if you tell me what piece of code causes the error.

I corrected the broken links.

from pymmf.

vongostev avatar vongostev commented on May 30, 2024

I used directly a code presented in the README

import pyMMF
import numpy as np
import matplotlib.pyplot as plt


NA = 0.275
radius = 7  # in microns
# calculate the field on an area larger than the diameter of the fiber
areaSize = 2.5*radius
npoints = 2**7  # resolution of the window
n1 = 1.45
wl = 0.6328  # wavelength in microns
curvature = None

profile = pyMMF.IndexProfile(npoints=npoints, areaSize=areaSize)
profile.initParabolicGRIN(n1=n1, a=radius, NA=NA)

solver = pyMMF.propagationModeSolver()
solver.setIndexProfile(profile)
solver.setWL(wl)

NmodesMax = pyMMF.estimateNumModesGRIN(wl, radius, NA)

modes = solver.solve(nmodesMax=NmodesMax+10,
                     boundary='close', curvature=curvature)

Nmodes = modes.number

m = 10

plt.figure()
plt.subplot(121)
plt.imshow(np.real(modes.profiles[m]).reshape([npoints]*2))
plt.subplot(122)
plt.imshow(np.imag(modes.profiles[m]).reshape([npoints]*2))

My log is:

2021-06-05 19:03:00,484 - pyMMF.core [DEBUG  ]  Debug mode ON.
2021-06-05 19:03:00,485 - pyMMF.core [INFO   ]  Selectinf axisymmetric radial solver
2021-06-05 19:03:00,496 - pyMMF.solv [INFO   ]  Found 5 radial mode(s) for m=0
2021-06-05 19:03:00,497 - pyMMF.solv [INFO   ]  Searching propagation constant for |l| = 1

Restarting kernel... 

So, the algorithm selects radial solver automatically and crashes in the 'binary_search' function (I found it with step-by-step debugging).

P.S. I use python 3.8.

from pymmf.

wavefrontshaping avatar wavefrontshaping commented on May 30, 2024

I updated the code and the README.

There were two issues, one because of np.arange not liking numbers like 1e3 as being recognized as floats, while it worked on the previous versions. Secondly, when I coded the radial solver, it became the default solver for GRIN and step-index fibers, but the example was supposed to use the 2d eigenvalue solver. I now have examples for the two solvers in the README.

I also added a more detailed example as a Jypyter notebook in the example folder.
Tell me if it works for you.

from pymmf.

vongostev avatar vongostev commented on May 30, 2024

Hi Sébastien,

Unfortunately, new examples with radial solver are not worked on my PC with infinite loop in solvers.radial.binary_search because of constant value in line 216

f[-1]/np.max(np.abs(f))

I use

  • python 3.8.5 and 3.9.2 (same results)
  • numpy 1.20.1
  • scipy 1.6.1
  • numba 0.53.0

I will try to fix it using your examples, so in case of success I will make a pull request with a solution.

from pymmf.

Related Issues (2)

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.