Git Product home page Git Product logo

pymmf's Issues

An example from README is incorrect

Dear Sébastien!

There are two bugs in radial solver that uprise in the example from README.

  1. N_BETA_COARSE_DEFAULT in solvers.radial is float, but must be int
  2. binary_search in solver.radial doesn't converge. It has output value -1.79..., but it's abs must be < 1e-6.

Also there are broken links in README.

P.S.: The example from an article works good.

joblib related TypeError

Hello!

After running this code on Ubuntu 20.04.4 machine:

import pyMMF
import numpy as np

NA = 0.14
radius = 4.15
areaSize = 3.5*radius
npoints = 2**8
n1 = 1.455
wl = 1.2

profile = pyMMF.IndexProfile(npoints = npoints, areaSize = areaSize)
profile.initStepIndex(n1=n1,a=radius,NA=NA)
solver = pyMMF.propagationModeSolver()
solver.setIndexProfile(profile)
solver.setWL(wl)

modes_semianalytical = solver.solve(mode = 'SI', curvature = None)

I'm getting TypeError, full log:

2022-03-22 17:17:45,210 - pyMMF.core [DEBUG  ]  Debug mode ON.
2022-03-22 17:17:45,210 - pyMMF.solv [INFO   ]  Finding the propagation constant of step index fiber by numerically solving the dispersion relation.
2022-03-22 17:17:45,291 - pyMMF.solv [INFO   ]  Found 6 modes in 0.08 seconds.
2022-03-22 17:17:45,291 - pyMMF.solv [INFO   ]  Finding analytical LP mode profiles associated to the propagation constants.
2022-03-22 17:17:46,489 - pyMMF.core [ERROR  ]  Uncaught exception
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/process_executor.py", line 436, in _process_worker
    r = call_item()
  File "/usr/local/lib/python3.8/dist-packages/joblib/externals/loky/process_executor.py", line 288, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/_parallel_backends.py", line 595, in __call__
    return self.func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 262, in __call__
    return [func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 262, in <listcomp>
    return [func(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/pyMMF/solvers/SI.py", line 130, in calc_mode
    psi = np.pi/2 if m[idx] < 0 else 0
TypeError: 'int' object is not subscriptable
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./find_modes.py", line 36, in <module>
    modes_semianalytical = solver.solve(mode = 'SI', curvature = None)
  File "/usr/local/lib/python3.8/dist-packages/pyMMF/core.py", line 239, in solve
    modes = solve_SI(
  File "/usr/local/lib/python3.8/dist-packages/pyMMF/solvers/SI.py", line 21, in solve_SI
    modes = associateLPModeProfiles(modes,indexProfile,
  File "/usr/local/lib/python3.8/dist-packages/pyMMF/solvers/SI.py", line 170, in associateLPModeProfiles
    modes.profiles = Parallel(n_jobs=n_jobs)(
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 1056, in __call__
    self.retrieve()
  File "/usr/local/lib/python3.8/dist-packages/joblib/parallel.py", line 935, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/usr/local/lib/python3.8/dist-packages/joblib/_parallel_backends.py", line 542, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 444, in result
    return self.__get_result()
  File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
    raise self._exception
TypeError: 'int' object is not subscriptable

I have:

python 3.8.10
numpy  1.21.5
scipy  1.8.0
numba  0.55.1
llvmlite  0.38.0
joblib  1.1.0

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.