gregmoille / pylle Goto Github PK
View Code? Open in Web Editor NEWLugiato Lefever Equation Solver in Python/Julia
License: Other
Lugiato Lefever Equation Solver in Python/Julia
License: Other
According to this page, the Julia implementation of the LLE is more than 4x faster than the pure-python implementation. I am not a specialist in the LLE, but looking at the code, I would assume that the FFTs are the rate-limiting step for the process. If this is the case, then I would expect that there would be minimal difference in Python versus Julia, since both languages should be calling similar FFT routines that are written in C or Fortran.
Python can have very different speeds for the FFT depending on which backend is used. If I recall correctly, np.fft uses c-implementations of the FFT accessed through BLAS/LAPACK, and the speed can depend dramatically on which implementation is being used. For intel processors, if the Intel MKL is used as the backend, then good performance is obtained. However, if OpenBLAS is used (common on Linux I believe) the results can be a factor-of-a-few slower. I think that scipy.fftpack uses a fortran implementation that has more consistent performance, but not always the fastest. We encountered this issue with the PyNLO package, and a similar issue with the PyAbel package:
https://pyabel.readthedocs.io/en/latest/transform_methods/comparison.html#low-level-computational-efficiency
So, I'm curious about a few things.
Have you done some profiling to show what steps limit the speed of the LLE solver?
Could the speedup that you saw going from Python to Julia be accounted for by a switch in the underlying FFT or linear algebra implementations?
Do you still have the pure-python LLE implementation?
Hello, I have a few questions I would like to ask you~
First, can I understand your theoretical model as a combination of LLE and CMT?
Why convert the dispersion β in the LLE model into a mode-dependent Dint, etc.. If only β2, β3 are considered, the calculation speed is tens of seconds, so the simulation time becomes much slower.
Also, is the frequency interval of the optical comb fixed to FSR? The secondary optical frequency comb cannot be generated?
Your article says that this is a friendly and fast LLE model solver, but since I have been studying the communication field, I just started the microcavity, so many parameters and simulation principles in the code are not very understandable.
η = δω/α # need to be fixed
B0 = np.sqrt(2*η)
What do these mean?
Is the step-by-step Fourier method not used?
I want to use SSMF, but I don't know how to set the incident light, and the initial light field, whether to consider the frequency and line width.
If I set u0 = Aexp(iω*τ), (f :193.4T), the sampling frequency of the FFT is greater than 400T?
I see you compare the running time of matlab python in the article. Can you upload the matlab code?
Update installation
Check the automatic installation
Hi !
I already have implemented a split-step algorithm to solve non-linear equation (RK4IP).
But I was curious about yours. I took a look to the ComputeLLE.jl file.
Unfortunately, I don't understand your split-step update.
Especially :
Have you a reference on this implementation ? (Article(s) ? Book(s) ?)
Thanks for your answer,
Lucas.
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
Warning: 'classifiers' should be a list, got type 'tuple'
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\pyLLE
copying pyLLE_analyzedisp.py -> build\lib\pyLLE
copying pyLLE_llesolver.py -> build\lib\pyLLE
copying pyLLE_init_.py -> build\lib\pyLLE
running egg_info
writing pyLLE.egg-info\PKG-INFO
writing dependency_links to pyLLE.egg-info\dependency_links.txt
writing requirements to pyLLE.egg-info\requires.txt
writing top-level names to pyLLE.egg-info\top_level.txt
reading manifest file 'pyLLE.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyLLE.egg-info\SOURCES.txt'
copying pyLLE\ComputeLLE.jl -> build\lib\pyLLE
C:\Users\my\AppData\Local\Programs\Python\Python312\Lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\pyLLE
copying build\lib\pyLLE\ComputeLLE.jl -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\_analyzedisp.py -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\_llesolver.py -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\__init__.py -> build\bdist.win-amd64\wheel\.\pyLLE
running install_egg_info
Copying pyLLE.egg-info to build\bdist.win-amd64\wheel\.\pyLLE-4.1.1-py3.12.egg-info
running install_scripts
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
error: [WinError 2] The system cannot find the file specified
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyLLE
Running setup.py clean for pyLLE
Failed to build pyLLE
ERROR: Could not build wheels for pyLLE, which is required to install pyproject.toml-based projects
Describe the solution you'd like
Straight-forward addition of non-linear losses in the LLE through a coefficient, if turned to 0 it would not be taken into account
Additional context
I need to check NLSE formalism for the implementation of TPA
It would be better if a detailed readme file can be added for analyze disp class. Just getting started with frequency combs and found this well written library but it was very time consuming to understand the analyze disp class.
Describe the bug
Fail install
To Reproduce
pip install pyLLE on clean environment
Expected behavior
Expect to install
Error or Screenshots
python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [66 lines of output]
Warning: 'classifiers' should be a list, got type 'tuple'
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\pyLLE
copying pyLLE_analyzedisp.py -> build\lib\pyLLE
copying pyLLE_llesolver.py -> build\lib\pyLLE
copying pyLLE_init_.py -> build\lib\pyLLE
running egg_info
writing pyLLE.egg-info\PKG-INFO
writing dependency_links to pyLLE.egg-info\dependency_links.txt
writing requirements to pyLLE.egg-info\requires.txt
writing top-level names to pyLLE.egg-info\top_level.txt
reading manifest file 'pyLLE.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'pyLLE.egg-info\SOURCES.txt'
copying pyLLE\ComputeLLE.jl -> build\lib\pyLLE
C:\Users\andre\anaconda3\envs\LLEenv\Lib\site-packages\setuptools_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
installing to build\bdist.win-amd64\wheel
running install
running install_lib
creating build\bdist.win-amd64
creating build\bdist.win-amd64\wheel
creating build\bdist.win-amd64\wheel\pyLLE
copying build\lib\pyLLE\ComputeLLE.jl -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\_analyzedisp.py -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\_llesolver.py -> build\bdist.win-amd64\wheel\.\pyLLE
copying build\lib\pyLLE\__init__.py -> build\bdist.win-amd64\wheel\.\pyLLE
running install_egg_info
Copying pyLLE.egg-info to build\bdist.win-amd64\wheel\.\pyLLE-4.1.1-py3.12.egg-info
running install_scripts
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
error: [WinError 2] Impossibile trovare il file specificato
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyLLE
Running setup.py clean for pyLLE
Failed to build pyLLE
ERROR: Could not build wheels for pyLLE, which is required to install pyproject.toml-based projects
Desktop (please complete the following information):
Thank you!
The addition of Raman / soliton recoil, Ω, from ω_r= D1+ (D2/D1)Ω would be super useful, even as just a generalized parameter. I'm looking into implementing it myself too but I thought I'd bring it up here too.
Describe the bug
Error with encoding on windows when using the debugger and greeks letters. Might need to write the letter in Latin alphabet instead to fix it
To Reproduce
Need to set the debug option to True on Windows
solver = pyLLE.LLEsolver(sim=sim, res=res, debug=True)
solver.Analyze(plot=True, plottype='all')
solver.Setup()
Expected behavior
No error while setting up everything
Error or Screenshots
Traceback (most recent call last):
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyLLE\_llesolver.py", line 475, in Setup
self._logger.info('LLEsovler.Setup', Info)
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyLLE\_llesolver.py", line 76, in info
open(self.fname,'a').write(mess)
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03b3' in position 142: character maps to <undefined>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\sje\Documents\NIST_files\Programs\Microcombs\Design\pyLLE_test\Example_pyLLE.py", line 25, in <module>
solver.Setup() # this is where the error occurs
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyLLE\_llesolver.py", line 478, in Setup
self._logger.info('LLEsovler.Setup', Info)
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyLLE\_llesolver.py", line 76, in info
open(self.fname,'a').write(mess)
File "C:\Users\sje\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03c0' in position 277: character maps to <undefined>
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at [email protected]
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True
Desktop (please complete the following information):
Quick fix
Set the debugger to False:
solver = pyLLE.LLEsolver(sim=sim, res=res, debug=False)
I'm working on getting pyLLE to run on our lab server and I am running into an issue where I see no progress on the bar when I run the following from the example file. There is no output on the log file except for a singular 0.
solver.Setup(verbose=False, tmp_dir='E:\\JuliaSolver\\')
result = solver.SolveTemporal(verbose=True, bin='C:\\Users\\photon\\AppData\\Local\\Julia-1.1.1\\bin\\julia.exe')
time.sleep(1000)
solver.RetrieveData()
I tried manually running the julia command as C:\\Users\\photon\\AppData\\Local\\Julia-1.1.1\\bin\\julia.exe c:\\Users\\photon\\anaconda3\\envs\\photon\\lib\\site-packages\\pyLLE\\ComputeLLE.jl E:\\JuliaSolver\\ 0.001 6 0.1
and it crashed and gave me the following error:
ERROR: LoadError: DimensionMismatch("cannot broadcast array to have fewer dimensions")
Stacktrace:
[1] check_broadcast_shape(::Tuple{}, ::Tuple{Base.OneTo{Int64}}) at .\broadcast.jl:454
[2] check_broadcast_shape(::Tuple{Base.OneTo{Int64}}, ::Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}) at .\broadcast.jl:457
[3] check_broadcast_axes(::Tuple{Base.OneTo{Int64}}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(*),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(*),Tuple{Complex{Int64},Array{Complex{Float64},2}}},Complex{Float64}}}) at .\broadcast.jl:459
[4] check_broadcast_axes at .\broadcast.jl:463 [inlined]
[5] instantiate at .\broadcast.jl:258 [inlined]
[6] materialize!(::Array{Complex{Float64},1}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(-),Tuple{Array{Complex{Float64},1},Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(*),Tuple{Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{2},Nothing,typeof(*),Tuple{Complex{Int64},Array{Complex{Float64},2}}},Complex{Float64}}}}}) at .\broadcast.jl:756
[7] Fdrive(::Int64) at c:\Users\photon\anaconda3\envs\photon\lib\site-packages\pyLLE\ComputeLLE.jl:272
[8] SSFM½step(::Array{Complex{Float64},2}, ::Float64, ::Dict{Any,Any}) at c:\Users\photon\anaconda3\envs\photon\lib\site-packages\pyLLE\ComputeLLE.jl:348
[9] MainSolver(::Float64, ::Dict{Any,Any}, ::Array{Complex{Float64},2}) at c:\Users\photon\anaconda3\envs\photon\lib\site-packages\pyLLE\ComputeLLE.jl:414
[10] top-level scope at none:0
[11] include at .\boot.jl:326 [inlined]
[12] include_relative(::Module, ::String) at .\loading.jl:1038
[13] include(::Module, ::String) at .\sysimg.jl:29
[14] exec_options(::Base.JLOptions) at .\client.jl:267
[15] _start() at .\client.jl:436
in expression starting at c:\Users\photon\anaconda3\envs\photon\lib\site-packages\pyLLE\ComputeLLE.jl:430
I suspect something faulty is being passed to the julia script but I'm not sure.
I met some problems while rewriting the core code in 'ComputeLLE.jl' about the basic Spilt-Step Fourier Method in Main Solver code area.(See Fig.1)
As we known,SSFFT alogrithm obey the following solving method:
The two terms required by the SSFFT method can be obtained by setting the linear term to zero or the nonlinear term to zero respectively.For example:
However,it is difficult to figure out the original terms in Main Solver of 'ComputeLLE.jl'.Could you please show me the original form of the formula?Thanks a lot.
Describe the bug
The pyLLE can't install in cmd.
To Reproduce
When Python 3.7.2 and Julia 1.1.1 is installed, in a cmd window (Windows) type:
pip install pyLLE Failed.
Expected behavior
1)How to install pyLLE ?
Error or Screenshots
C:\Users\yumtong>pip install pyLLE
Collecting pyLLE
Using cached https://files.pythonhosted.org/packages/4e/24/a0247d0b1c7af554425177808db4053a0b0466c7696dd74ed08bae9eadbf/pyLLE-3.0.0.tar.gz
ERROR: Could not install packages due to an EnvironmentError: [Errno 22] Invalid argument: 'C:\Users\yumtong\AppData\Local\Temp\pip-install-vnd6q9d6\pyLLE\pyLLE.egg-info/Icon\r'
Add any other context about the problem here.
Describe the bug
Quantum noise is not well implemented in the julia core
Expected behavior
Quantum noise should be ℏω/2 . Hence should not be flat over the spectrum. Should be added on every loop of the split -tep Fourier
Additional context
Should be easy to fix, just need to do it
Hi Greg,
First of all thanks for working on this project. The tool has been exceptionally useful for the visualisation of frequnecy combs and I can't you enough. PyLLE worked for me in the Spring of 2021, but I've tried it again recently on a new computer and the example doesn't seem to be working. Specifically, it does this thing where the progress bar never updates and the solver stops in like 6 seconds flat. Any assistance is greatly appreciated!
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
In the example iPython notebook, the dispersion is plotted and the "LLE" dispersion is similar, but not exactly the same as the dispersion from the FEM model. How is the dispersion being used by the LLE? I would have expected that using the dispersion from the FEM model for each resonator mode would have been sufficient. Is the idea to smooth the FEM-derived dispersion?
Hey Gregory,
We're interesting to try using the steady state solver function of pyLLE. I've tried using the example from the 2019 arXiv paper and there seem to be some issues. For example, it's difficult to define simulation parameters like the pump detuning or the initial solution parameters (like beta). Could you provide an example for the steady state solver?
Thanks,
Zach
Describe the bug
sim/dispfile not in hdf5 tree of the temp file.
see https://github.com/gwiederhecker/pyLLE/pull/1#issue-230562772 for more details
To Reproduce
Seems to happen
Expected behavior
No error when Julia fetch the temp hdf5 file.
Additional context
Easy fix. Remove dispfile in the list of fetched parameter in pyLLE/ComputeLLE.jl
Hi Greg and all!
We're just getting started trying to use pyLLE for some microresonator simulations. What's the current state of the project? Should we be attempting to install version 4.0.0, or just keep using the master branch for the time being?
Describe the bug
When I run this code from the example, I get an error saying that no attribute exists.
To Reproduce
import inspect
import os
import sys
currentdir = os.getcwd()
parentdir = os.path.dirname(currentdir)
sys.path.insert(0, parentdir)
import pickle as pkl
import time
import numpy as np
import pandas as pd
import plotly.graph_objs as go
import plotly.graph_objs
import plotly.io as pio
import pyLLE
from scipy import constants as cts
import plotly.express as px
pio.renderers._default = "notebook"
pio.templates._default = "seaborn"
resonator = dict(
# Size of the resonator
R = 23e-6,
# Intrinsic quality of the resonator
Qi = 1e6,
# ?
Qc = 1e6,
# ?
γ = 3.2,
# This is the dispersion file
# The dispersion file is a
# 2D .cssv that contains
# the azimuthal mode number,
# and frequency of resonance
# in the first and second columns, respectively
#
dispfile = "./RW1000_H430.csv"
)
simulation = dict(
Pin = [160e-3],
f_pmp = [283e12],
# Does this mean the mode number?
φ_pmp = [0],
#?
δω=[None],
#?
Tscan = 0.7e6,
# ?
μ_sim = [-220, 220],
δω_init = 1e9 * 2 * np.pi,
δω_end = -3.5e9 * 2 * np.pi
)
solver = pyLLE.LLEsolver(sim = simulation, res = resonator, debug = True)
fig = solver.Analyze(plot=True)
fig.update_yaxes(range = [-50, 50], title = 'Dint (GHz)')
fig.show()
Expected behavior
I expected to see a figure containing a plot of the linear dispersion of the resonator
Error or Screenshots
<class 'matplotlib.figure.Figure'>
Traceback (most recent call last):
File "/Users/buddyugwumba1/Documents/UCR/Graduate/Dr. Taheri/pyLLE project/pyLLE_Example.py", line 87, in
fig.update_yaxes(range = [-50, 50],title = 'Dint (GHz)')
AttributeError: 'Figure' object has no attribute 'update_yaxes'
(project) (base) buddyugwumba1@Buddys-MacBook-Pro-2 pyLLE project % python3 pyLLE_Example.py
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
Describe the solution you'd like
Use full Plotly for every display and pdf/png export of figure instead of ad-hock solution through Matplotlib
Possible way to do it
The julia errors are not caught through the python interface.
Need to updat the subprocess.stderr = sub.PIPE when Julia is launched
We have some questions about one of the parameters, Tscan. How is this value determined? When we changed it (up or down), we found that it made a big difference to the results, and there was no such amount in the actual experiment, so we didn't know what the basis for the adjustment was. We would appreciate it if you could answer us at any time! :)
Hello
l have successfully run the code, but, i have some confusion about parameter you setting in ComputeLLE.jl
Thanks for your answer. Kind regards,
LiChenhong
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.