-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Implement methods for conversion between temporal and spatial field presentations #126
Conversation
added and tested the wrappers for z2t and t2z convertors
…tions of lasy objects removed absorbers and useless stuff fixed bug with the phase terms for envelopes replaced `scc.c` with `c` for the cleared code added docstrings to the new methods
for more information, see https://pre-commit.ci
…o the methods, fixed the in-code comments, removed unnessecary variables
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!! See comments below. Furthermore, could you add a CI test? Suggestions:
- in 3D, for the Gaussian example that you shared in your figures, generate a beam with lasy (so, time representation), call
export_to_z
, and compare with theory (the tolerance will ofc depend on the resolution, but it should be tight enough for the t representation to largely fail the test). Then you could callimport_from_z
, and compare with the original profile. - Same test in RZ, as these use quite different functions.
Co-authored-by: Maxence Thévenet <maxence.thevenet@desy.de>
Could you have a look at the pre-commit.ci issue? |
Thanks! as described in the message above, could you add a CI test for this PR? This should be consistent with what was discussed also with @RemiLehe at a LASY meeting a few weeks back. |
added dots at the end of the first docstring for pre-commit check
added a draft test for `t2z2t` conversion
bugfixes draft test is fixed
for more information, see https://pre-commit.ci
removed unused laser object
I've added a simple test where we take field in I've also used for convenience a new I've also removed forced version from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test! See comment below.
tests/test_t2z2t.py
Outdated
assert np.allclose( | ||
laser_t_in.field.field[ind0], laser_t_out.field.field[ind0], atol=1e-8 | ||
) | ||
assert np.allclose(Field_approx, Field_orig, atol=2e-3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are Field_orig
and Field_approx
supposed to be close to each other in general? Otherwise, could we compare instead something like (pseudo-code) laser_t_in
and laser_z*(1+z**2/zR**2)**.5
for a beam with a length = zR centered around t=0 and z=0? These should be close.
…ntations defined the checks for `t-z-t` numerical correctness and analytical check for `z` representation
for more information, see https://pre-commit.ci
Hey @MaxThevenet , I've revised the test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for this PR! Below are minor typos fixes.
This PR adds to main
Laser
class the methodsexport_to_z
andimport_from_z
for conversion between temporal and spatial field presentations, and the test script for these methods.Additionally this PR includes:
fft
method in propagator to comply with the used envelope definition:ifft
with"backward"
normalization should be used to convert the field to the frequency domainc
fromscipy.constants
is using instead ofscc.c
axiprop