lasy-org / lasy Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://lasydoc.readthedocs.io
License: Other
Home Page: https://lasydoc.readthedocs.io
License: Other
It seems that, in the default lasy
example, laser_energy
is actually not taken into account.
This might be confusing to the user ; we should probably implement some default behavior, or a warning that tells the user when it is not used.
We should at least make sure that the example does not crash.
Probably after #58.
From multiple intensity measurement, apply the Gerchberg-Saxton algorithm to retrieve the phase.
As pointed out by Remi, we should add some automated tests to the implementations of Laguerre-Gauss and Hermite-Gauss Modes.
Some things that could be added to check the modes are behaving as expected:
(related to #34)
Our current CI test only dumps the field to an openPMD file and makes sure that this is not crashing.
However, it would be good to check the actual values.
Maybe we could build a template test file that would work for any profile, and then simply loop through our existing profiles and:
lasy
profileWe discussed today on Jan 6th to add pre-commit CI logic.
Tasks:
Just collating some next steps regarding the documentation:
Overview of the Code
section would be, I think, quite a nice place to elaborate on the reason for developing the code as well as some documentation relating to the standards adopted in the output files, representations of the pulse internal (similar to our recent z vs t representation discussion) etc etc. It would be nice if the basics were clear and easy to find without delving into the source code. We can also add a section on some general theory (perhaps for propagator or other). Also would be nice to have a list of codes (which can be updated continuously) which support lasy inputRandom late Friday thought: we could have a function for the FFT + metadata, if that's needed in multiple places.
Hi everyone,
It is great to know (from slack discussion) that LASY is soon going to be implemented for use in FBPIC. I am very excited about this additional powerful utility.
During the slack discussion with Remi, I mis-understood 'spectral phase' with the 'phase measured with the wave-front sensor'.
Non-uniform 'spectral-phase' tells that the laser pulse is not compressed to Fourier limit, however, it can not give any information about laser spot (please correct me if I am wrong). It is nicely available for use in the code (Paraxial_Approximation_Laser).
On the other hand, the non-uniform phase distribution, measured by wave-front sensor, tells how much the focal spot is deviated from Gaussian one (please correct me if I am wrong).
Do you think that we can load the phase distribution information measured by wave-front sensor in code and calculate the real intensity distribution in the laser spot. If this can be done, it will be extremely powerful and realistic.
Thank you and my best wishes to the entire team.
In the current implementation, the central class is Laser
, which contains the laser profile parameters, one grid where the laser is defined and will also contain the propagator. The current API would be:
The current one
box = Box()
laser = GaussianLaser(box, ) # or any class derived from Laser
laser.propagate()
laser.write_to_file()
Manuel raised the point that, in this way, class Laser
(and its derived classes) contain a mix of numerical and physical parameters, while the laser (understand: laser profile) should only contain physical properties. So we discussed a few ways to abstract the laser profile so it can be defined with physical parameters only. This is made complicated by the variety of profiles: some profiles, e.g. from experiments, are actually only defined on a grid, so there would be some interpolation between this grid and the propagator one. Suggestions would be:
The simulation-like
This is close to the current one, just separating the laser profile. Also, in the snippet below, Lasy
could be Laser
. This may be a good improvement to the current one, but still has some limitation (having multiple grids, propagators, geometries etc. will not be naturally supported, but ofc can be done with multiple lasy
instances).
laser_profile = GaussianLaserProfile(...)
box = Box()
grid = Grid(box)
propagator = Propagator()
lasy = Lasy(laser_profile, grid, propagator, ...)
lasy.propagate() # or evaluate
lasy.rt_to_xyt()
lasy.write_to_file()
(if box
and grid
are initialised inside Lasy/Laser
, it is very close to the current one, with just the laser profile explicitly separated.)
The object-oriented one
laser = GaussianLaser(...)
grid = Grid(dim='xyt') # 3D cartesian
propagator = Propagator(laser, grid) # only propagator has a grid
propagator.propagate()
write_to_file(laser, grid, propagator) # not sure if write_to_file naturally belongs to a class
grid_rz = Grid(dim='rt') # 2D cylindrical
propagator_rz = Propagator(laser, grid_rz)
propagator_rz.propagate()
write_to_file(laser, grid_rz, propagator_rz)
Here are points that we should consider in the discussion:
get_spectrum
function? (if yes, the third suggestion might be a bit awkward.) Or should this be in e.g. openpmd-viewer for separation of concerns?As agreed offline, let's replace
import scipy.constants as scc
scc.m_e*scc.c**2
with
from scipy.constants import c, m_e
m_e*c**2
consistently across the code.
This needs the following operations:
This requires the following new capabilities:
There are other ways to make this work, including supporting RZ input in HiPACE++, but I think it is preferable to do such
operations in LASY at the moment.
In my understanding, LASY should absolutely support cylindrical + azimuthal decomposition (please let me know if someone disagrees). Do we want to support it from the beginning, or start with axisymmetric and add the decomposition later? I have a preference for the latter, as I believe that having a fully working axisymmetric implementation asap will help us develop all the rest of the code (output, profiles, etc. and only afterwards correct it for azimuthal decomposition).
A practical point: multiple modes in the azimuthal decomposition could be handled by this argument
Line 16 in 5ed4931
Should we start with axisymmetric profiles only? Please vote (thumbs-up/down) below.
PR #151 proposes a main implementation for the openPMD reader. Here are things that should be added in follow-up PRs, because they require separate changes, or because they rely on things not yet implemented
Some quantities are stored in multiple places.
For instance, dim
is stored at the Laser
level and at the Box
level.
Should we remove this duplication and only store these quantity ones (to avoid potential incoherence if the user tries to update these objects)?
Theres a rogue
For convenience, we could store this somewhere or append it to test.py
.
Also, should we add capabilities for openPMD-viewer to work with envelope data (e.g. in LpaDiagnostics)?
I think this would be useful in the process of shaping the standard (before implementing it in e.g. FBPIC of HiPACE++).
The fully analytic Gaussian laser profile can be implement in https://github.com/LASY-org/lasy/blob/development/lasy/gaussian_laser.py. This can probably be done in a similar way to the FBPIC implementation. In particular, this would be a good occasion to implement the first transverse and longitudinal profiles.
This is a longitudinal profile: get the complex longitudinal envelope (both amplitude and phase) from FROG measurements.
One nice way to incorporate experimentally measured transverse intensity profiles (such as focal spot images, near field profiles or anything in between) would be to decompose it into a set of Hermite-Gaussian modes. These higher-order gaussian modes are a natural choice for data taken with a camera.
The process envisaged to get the data in would be:
If the data is stored as a series of coefficients, then you have effectively an analytic representation of the experimental pulse. This could be useful for speeding up propagation.
This style of method has already been implemented by LPGP, CNRS to get real pulses into FBPIC (https://journals.aps.org/prab/pdf/10.1103/PhysRevAccelBeams.25.101301) and worked quite well.
Something along these lines would be a powerful addition to LASY.
These are commonly-used pulses.
Right now, box.lo
, box.hi
, etc. are list, so one needs to remember that e.g. box.lo[0]
corresponds to x
(in cartesian) and box.lo[2]
corresponds to t
, which can be quite error-prone.
Should we make them dictionaries instead (so that we would use box.lo['x']
, box.lo['t']
instead)?
In particular, the documentation should list the available laser profiles, along with their mathematical definition.
Laser.export_to_z
and Laser.import_from_z
do proper conversions between Z and T representations. Some additions would make it useful:
Laser
class, but might be cumbersome, not sure.Should probably be done before #14.
Read a 2D transverse intensity profile (at a format that makes sense from the experiment, @MKirchen @rob-shalloo what would make most sense?) and initialize a transverse profile for the envelope.
When visiting this page:
https://lasydoc.readthedocs.io/en/latest/api/profiles/transverse/gaussian.html
I get this rendering:
Is this specific to my browser/setup?
It is common for experiments to measure the laser (intensity) spectrum. Given the spectral phase (either measured or assumed e.g. flat), one can reconstruct the temporal profile of the amplitude of the laser pulse.
We cannot release lasy to PyPI until axiprop is also uploaded:
hightower8083/axiprop#8
current zip:
Uploading lasy-0.1.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.7/40.7 kB • 00:00 • 48.9 MB/s
WARNING Error during upload. Retry with the --verbose option for more details.
ERROR HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
Invalid value for requires_dist. Error: Can't have direct dependency:
'axiprop @
https://github.com/hightower8083/axiprop/archive/refs/heads/main.zip'
same via git
Uploading lasy-0.1.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 40.7/40.7 kB • 00:00 • 45.7 MB/s
WARNING Error during upload. Retry with the --verbose option for more details.
ERROR HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/
Invalid value for requires_dist. Error: Can't have direct dependency:
'axiprop @
git+https://github.com/hightower8083/axiprop.git@9bd516898c1cc4e1bcbfb9
adac26f8909ec087a0'
Copyright etc.
Right know, the definition of the Box
uses 'xyz'
and 'rz'
, which somewhat suggests that the user should pass the z
coordinates.
Should we instead tell the user to pass the x
, y
and t
coordinates when defining the box (since the envelope will be internally represented and output with t
), and thus remove all references to z
to avoid confusions?
Depend on #53.
Once the CI framework is ready, I believe it would be useful to make a well documented and commented PR creating a CI test. This would be used as a template when a new contributor wants to add a test.
This PR could probably test a laser profile (as I suspect this is what users are most likely to contribute). The test could do the following:
Should this
Grid
rather than a numpy array and Box
? This would still be compatible with discussions at #12, we would then have 2 functions, one taking numpy inputs, the other one a Grid. Likewise,lasy/lasy/utils/openpmd_output.py
Line 3 in 8bbf54b
lasy/lasy/utils/laser_energy.py
Line 4 in 8bbf54b
In order to avoid math errors later (esp. in the exact definition of the propagator), should we have a clear definition of the complex envelope field (used internally) somewhere? e.g.
where p_x
and p_y
are the components of the (complex) polarization vector and where
where lambda_0
is the wavelength defined by the user.
There are different ways to define the overall amplitude of a laser e.g. with a0
, e_max
, etc.
However, for e.g. donut-like laser pulses, a0
is not well-defined, or at least not intuitive.
Another way which, I think, would work for any (realistic) laser profile would be to pass the total laser energy in order to define the amplitude.
Let's add zenodo.org DOI integration for releases. Goal: basis for best practices on code & analysis reproducibility.
This is a list of tests that should be added. If you see a significant part of the code that should be tested and is not below, please add it to the list.
A few additional remarks:
rt
and xyt
. In practice, we'll see if we have to do that or if we can find a better solution.The function below should write down the envelope fields at the openPMD format.
Line 81 in 5ed4931
Laser
already, so now is a good time to address this issue.
As suggested in comments in there, the openPMD-api handling could be put in a separate function called in there.
One point of discussion was the kind of output we would support (electric field/vector potential, envelope/full field, etc.). In particular, we mentioned the following 3 options (I believe we were leaning towards the last one, but I am not sure we reached a final conclusion):
For this issue, I propose to write a file (e.g. standard/standard.rst
) to propose a standard. This should be a good way for discussing it until we converge to something.
As a reminder, the various points and options are:
A few general points that should be in there:
CI currently consists in running 1 Python script (examples/test.py
) and asserting that it doesn't crash. This is in this command
lasy/.github/workflows/unix.yml
Line 45 in 826a58d
We could use pytest and setuptools, as do FBPIC and Wake-T (and many others). Once this is setup, we can start creating CI test.
In principle, it would be great if all profiles could support both representations, for consistency. However, this may be a bit awkward in some cases, e.g. for Hermite-Gauss (meant for Cartesian coordinates) and Laguerre-Gauss (meant for cylindrical coordinates).
One general solution could be to:
This would be general enough to support a number of workflows that are IMO important, e.g.:
This way, 3D codes only have to support Cartesian data (they can implement cylindrical, but don't have to) and likewise for cylindrical codes, without loss of generality.
The propagator is currently empty, see
Line 66 in 5ed4931
Grid
and Box
should be used to represent data in Fourier space (currently only used for position space, but it is not specific to that)Laser
class for convenience (so that, if we propagate multiple times, we don't need the forward FFT each time).This needs the following operations:
This requires the following new capabilities (only 1 atm):
Hello,
Thank you for the work on Lasy. I have been trying it, alongside Warpx and have some questions I was hoping someone can help with. The first one is on the parameter npoints; is this the number of points in the x,y,t dimensions that will also be used in the Warpx simulation? Do these numbers need to be equal the number of grid points in my Warpx simulation? Is increasing the number of points better or worse for my simulation? Another parameter that has been confusing is the t_peak, on paper I know what it is but conceptually I’m a little lost. I’m used to just having my laser be there without having this parameter. I know that when the value of t_peak is too low my gaussian profile starts at a high intensity and loses its shape. Is there a way to calculate t_peak so that my pulse is nice and gaussian ?
Although many profiles are separable in longitudinal and transverse profiles E(x,y,t) = f(x,y) * g(t)
, some cannot, e.g. in the presence of pulse front tilt. Here, we include spatio-temporal coupling (STC) as well as a number of general effects that lead to STC (please complete the list):
LASY should support the main STCs, and how this is included is probably worth a discussion. A suggestion:
Laser
could have the option to multiply the envelope array by phase terms at any point, which should be enough (to be checked) for all STC.The description above assumes 3D XYT for the sake of simplicity, but some STC are also relevant for 2D RT.
More info in https://opg.optica.org/oe/fulltext.cfm?uri=oe-12-19-4399&id=81164
When reading the data from a lasy-produced file, a full PIC code might want t
to be slowest-varying variable, since it will be taking slices at fixed t
, to feed the laser antenna.
Therefore, we might consider storing the laser field already in this format, in the openPMD file.
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.