-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help with low_level interface example #347
Comments
Hi, I just came across your post while trying to use this package. I think your error message was due to an error in the stats plotting tool as I got the code to run by commenting out line 47, i.e. # Plotting.stats(output). Since the Luna package is still an early release (v0.3) I think they might have made changes to this plotting routine that broke it for this case. From your question, i think you might just want to simulate spectral broadening in a single hollow-core fiber which you can do using the simple_interface examples, i.e. the first part of the 2 stage_compressor. I think these will only work with single gases rather than mixtures but you will probably be able to find condition in which to make a supercontinuum without using a mixture, which is probably best as making gas mixtures is an extra step of hassle in real-life as well. |
@omairg is mostly correct. The issue here is that for a gas mixture, the density statistic which is being collected is multidimensional (number of gases x propagation steps). The statistics plotting routine can't deal with that at the moment. If you need this functionality, we can add it. From what you're saying, @omairg is also correct in suggesting that the simple interface will do the job for you, and this has been more thoroughly tested (and the examples should all be up to date). Regarding parameter settings, are you asking how to make Luna run a simulations for exactly the numbers you want, or how to choose the gas pressure? If the former isn't clear, do ask and we can help and add to the documentation where needed (I'm aware that the docs are woefully incomplete--at the moment we simply don't have the time to write more of it). The latter is a much more complicated question which would turn the documentation into a physics paper. Happy to help in choosing parameters, but there is no one recipe which will work to get the output you need. |
@omairg @chrisbrahms Thanks for the help! I'm running the 2 stage compressor program and it's doing everything I need it to do. I did add a line to it at the ending (Plotting.spec_2d(compressor, log10=true) to plot the spectrum but for some reason I'm getting duplicate spectrum plots for the He11 mode even though I set modes = 1. Any idea what is causing this? Also, is there any way to export the plots as a jpeg or png? |
I would also like to know if for the 2 stage compressor does the simulation assume that the FWHM of the pulse is matched to the core fiber diameter? |
hi, I;m not sure about the reasons why you are getting multiple plots, bu there is a built in command in the matplotlib library for saving figures, you would use it as follows where savename is a string that you want to save with. I think the type of file depends on the extension you give it. Since you are probably new to Julia, i have been finding that the free bing chatGPT is usefull for providing information on how to do things in both Julia and Python, although it does get things wrong. My understading of the code is that the energy you give the code is the starting energy in the lowest order mode of the HCF, this is a pretty good assumption because when the pulse diameters are matched then the coupling to that modes is >98% and less than a few percent for the other modes. however this is for an ideal Gaussian mode coupling the lowest order Bessel mode of the fiber. However in real life, their might be astigmatism etc that will cause the coupling efficiency to be less. |
The double plot is because by default, the @omairg's way to save the figure works, but it will save the current figure which isn't always the one you want. The plotting function also returns the figure object, which you can then save: fig = Plotting.prop_2D(...)
fig.savefig("test.png") will save the figure as PNG. The API for
By default, a |
Thanks @chrisbrahms,you learn something new each day, hope you don't mind me trying to help with advice, just to mirror Martin's comments, this is a really usefull package to have open-sourced, and it's seems especially suited to experimentalists, so thanks for putting in the work. |
@chrisbrahms @omairg Is there a way to implement a hollow core fiber with a gas pressure distribution (ie one that varies with the propagation distance along the fiber)? I appreciate the help! |
@timothyara Hi, the documentation page for the prop_capillary function explains how to do this, it just involves entering a tuple for the pressure rather than a single value, |
@omairg @chrisbrahms Thank you !! |
Hi Timothy, I'm not really familiar with these low level bits of Luna, but i think it isn't really necessary to do a calculation for what you want to know. If you are transferring one HCF mode to another fiber mode with a different diameter, then you only need to make sure your optical imaging system has an appropriate magnification/demagnification according to the ratio of the diameters of the fibers you are using. i.e. if the diameters were the same then you would choose lenses that would image the end of one HCF 1:1 onto the entrance of the other HCF. This should give you optimal coupling assuming a perfect imaging system, because the fundamental modes have the same profile but just will have different sizes depending on the fiber diameter. |
Thanks for your response @omairg . I will keep this condition for optimal coupling of Gaussian to Bessel mode of fiber in mind when designing my optical setup. I'm still interested in specifying more details about the beam (i.e gaussian,fwhm, wo, etc) to see if it has any impact on the results of the simulation. So, I'm still seeking resources/examples that show me how to do this. |
The gb = Pulses.GaussPulse(...)
gbp = Pulses.GaussBeamPulse(...) Two other notes:
Also, just for future reference: when posting code to an issue, it's much easier to help you if you copy&paste the code as text (in a code block, see the GitHub docs) rather than a screenshot. Saves me typing it back in to run it myself 😃 |
Hello,
I'm running the mixture_modeAvg under mixtures in the low_level interface but I seem to be getting this error: PyError ($(Expr(:escape, :(ccall(#= /Users/timothyaraujo/.julia/packages/PyCall/ilqDX/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'ValueError'>
ValueError('x and y must have same first dimension, but have shapes (1345,) and (2, 1345)')
File "/Users/timothyaraujo/.julia/conda/3/aarch64/lib/python3.10/site-packages/matplotlib/axes/_axes.py", line 1721, in plot
lines = [*self._get_lines(self, *args, data=data, **kwargs)]
File "/Users/timothyaraujo/.julia/conda/3/aarch64/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 303, in call
yield from self._plot_args(
File "/Users/timothyaraujo/.julia/conda/3/aarch64/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 499, in _plot_args
raise ValueError(f"x and y must have same first dimension, but " ...
Can I get some help with this? It would also be nice if there were some comments or some documentation that explains how the simulation parameters are being set. I'm specifically interested in spectrum of a 800nm, 30 fs, few mJ pulse after passage of an Ar filled, few mm diameter hollow core fiber. So, I'm most interesting in the gas pressure needed to obtain a supercontinuum. I'm attaching the code in the zipped file which is in the state that I ran it.
Archive.zip
Thanks.
The text was updated successfully, but these errors were encountered: