-
Notifications
You must be signed in to change notification settings - Fork 24
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
Space time profile #182
Open
spencerjolly
wants to merge
55
commits into
LASY-org:development
Choose a base branch
from
spencerjolly:space-time
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+369
−33
Open
Space time profile #182
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
63de332
Add files via upload
spencerjolly 92f3b71
Update spacetime_profile.py
spencerjolly 9f8511f
Update spacetime_profile.py
spencerjolly 54cba90
Update spacetime_profile.py
spencerjolly 5e26c58
correct time variable name
spencerjolly 2f98d43
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8ae8c09
fix typos and remove mention of pft
spencerjolly e321db7
style changes
spencerjolly 7553b76
remove spurious indent
spencerjolly deeee9b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d7ce091
Update lasy/profiles/spacetime_profile.py
spencerjolly deaaee8
change sc to b in spacetime
spencerjolly 6e0d701
change sc to b in spacetime
spencerjolly a3cae81
Update gaussian_profile.py
spencerjolly cf69c74
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 9602196
Update gaussian_profile.py
spencerjolly a37a7aa
Update test_gaussian_propagator.py
spencerjolly 3e17248
Update test_laser_profiles.py
spencerjolly ae1f801
Update test_laser_profiles.py
spencerjolly 7ace218
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 0fb6242
Update test_gaussian_propagator.py
spencerjolly 8da190a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] b9405ee
Update gaussian_profile.py
spencerjolly 4654d15
Update test_gaussian_propagator.py
spencerjolly a7a2bfd
Update test_laser_utils.py
spencerjolly 74dbf87
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 6085d77
Update test_t2z2t.py
spencerjolly ae50294
Update test_t2z2t.py
spencerjolly ef8765d
Update test_gaussian_propagator.py
spencerjolly a3b1a54
Update gaussian_profile.py
spencerjolly c830f08
Update laser_utils.py
spencerjolly d118d42
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 78524b3
Update laser_utils.py
spencerjolly fb2f9ae
Update test_laser_utils.py
spencerjolly 483fcf3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 864f22c
Update test_laser_utils.py
spencerjolly 0670864
Update test_laser_utils.py
spencerjolly afc1cff
Update test_laser_utils.py
spencerjolly df03522
Update test_gaussian_propagator.py
spencerjolly 08a73ae
Update test_gaussian_propagator.py
spencerjolly d849dde
Update test_gaussian_propagator.py
spencerjolly 5a21323
Update test_gaussian_propagator.py
spencerjolly 46eb96a
Update test_laser_utils.py
spencerjolly 43250a6
Update test_laser_profiles.py
spencerjolly 15cc158
Update test_laser_profiles.py
spencerjolly 9663291
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 41b17de
Update test_laser_profiles.py
spencerjolly f525a8e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d05ea42
Update test_laser_utils.py
spencerjolly b4d6b9b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2f6b091
Update test_laser_utils.py
spencerjolly b675f8a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 02aa927
Update test_laser_utils.py
spencerjolly b6f32e6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 8717ea8
Update test_laser_utils.py
spencerjolly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import numpy as np | ||
|
||
from .profile import Profile | ||
|
||
|
||
class SpaceTimeProfile(Profile): | ||
r""" | ||
Class that can evaluate a pulse that has certain space-time couplings. | ||
|
||
More precisely, the electric field corresponds to: | ||
|
||
.. math:: | ||
|
||
E_u(\\boldsymbol{x}_\\perp,t) = Re\\left[ E_0\\, | ||
\\exp\\left(-\\frac{\\boldsymbol{x}_\\perp^2}{w_0^2} | ||
- \\frac{(t-t_{peak}+2ibx/w_0^2)^2}{\\tau_{eff}^2} | ||
- i\\omega_0(t-t_{peak}) + i\\phi_{cep}\\right) \\times p_u \\right] | ||
|
||
where :math:`u` is either :math:`x` or :math:`y`, :math:`p_u` is | ||
the polarization vector, :math:`Re` represent the real part. | ||
The other parameters in this formula are defined below. | ||
|
||
Parameters | ||
---------- | ||
wavelength: float (in meter) | ||
The main laser wavelength :math:`\\lambda_0` of the laser, which | ||
defines :math:`\\omega_0` in the above formula, according to | ||
:math:`\\omega_0 = 2\\pi c/\\lambda_0`. | ||
|
||
pol: list of 2 complex numbers (dimensionless) | ||
Polarization vector. It corresponds to :math:`p_u` in the above | ||
formula ; :math:`p_x` is the first element of the list and | ||
:math:`p_y` is the second element of the list. Using complex | ||
numbers enables elliptical polarizations. | ||
|
||
laser_energy: float (in Joule) | ||
The total energy of the laser pulse. The amplitude of the laser | ||
field (:math:`E_0` in the above formula) is automatically | ||
calculated so that the pulse has the prescribed energy. | ||
|
||
tau: float (in second) | ||
The duration of the laser pulse, i.e. :math:`\\tau` in the above | ||
formula. Note that :math:`\\tau = \\tau_{FWHM}/\\sqrt{2\\log(2)}`, | ||
where :math:`\\tau_{FWHM}` is the Full-Width-Half-Maximum duration | ||
of the intensity distribution of the pulse. | ||
|
||
w0: float (in meter) | ||
The waist of the laser pulse, i.e. :math:`w_0` in the above formula. | ||
|
||
b: float (in meter.second) | ||
Spatial chirp, i.e. :math:`b` in the above formula, that results in the laser frequency | ||
varying as a function of `x`. A representative real value is b = w0 * tau. | ||
|
||
|
||
t_peak: float (in second) | ||
The time at which the laser envelope reaches its maximum amplitude, | ||
i.e. :math:`t_{peak}` in the above formula. | ||
|
||
cep_phase: float (in radian), optional | ||
The Carrier Enveloppe Phase (CEP), i.e. :math:`\\phi_{cep}` | ||
in the above formula (i.e. the phase of the laser | ||
oscillation, at the time where the laser envelope is maximum) | ||
""" | ||
|
||
def __init__(self, wavelength, pol, laser_energy, w0, tau, b, t_peak, cep_phase=0): | ||
super().__init__(wavelength, pol) | ||
self.laser_energy = laser_energy | ||
self.w0 = w0 | ||
self.tau = tau | ||
self.b = b | ||
self.t_peak = t_peak | ||
self.cep_phase = cep_phase | ||
|
||
def evaluate(self, x, y, t): | ||
""" | ||
Return the envelope field of the laser. | ||
|
||
Parameters | ||
---------- | ||
x, y, t: ndarrays of floats | ||
Define points on which to evaluate the envelope | ||
These arrays need to all have the same shape. | ||
|
||
Returns | ||
------- | ||
envelope: ndarray of complex numbers | ||
Contains the value of the envelope at the specified points | ||
This array has the same shape as the arrays x, y, t | ||
""" | ||
transverse = np.exp(-(x**2 + y**2) / self.w0**2) | ||
|
||
tau_eff = np.sqrt(self.tau**2 + (2 * self.b / self.w0) ** 2) | ||
|
||
spacetime = np.exp( | ||
-((t - self.t_peak + (2 * 1j * self.b * x / self.w0**2)) ** 2) | ||
/ tau_eff**2 | ||
) | ||
|
||
oscillatory = np.exp(1.0j * (self.cep_phase - self.omega0 * (t - self.t_peak))) | ||
|
||
envelope = transverse * spacetime * oscillatory | ||
|
||
return envelope |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe this could actually be part of the
GaussianProfile
laser. See other comments.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.
I don't actually see how it could be applied with GaussianProfile. In that class it calls the temporal and spatial profiles separately, but we need access to the space and time dimensions at the same time.
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.
Yes, agreed. If we decide to have it applied with GaussianProfile, we would completely change the implementation of the
GaussianProfile
(which is definitely possible): instead of calling the temporal and spatial profile separately, we would have the Python code for the gaussian profile directly in the body of theGaussianProfile
class. Does that work for you?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.
Yes, ok with me. In fact, it would mostly entail pasting the code from this PR to the GaussianProfile class. However, I also wanted to add a pulse-front tilt parameter (in addition to the current "spatial chirp" parameter). I could do that in this PR so that it is all there, and then we could paste it.
Let me know how you want to continue.
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.
Sounds good. I think it is good to do all of the above as part of the current PR, i.e. adding spatial chirp, and moving all of this to the
GaussianProfile
class.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.
I've done these changes. There are some weird test and docs errors at the moment, but in any case I need to build a stand-alone test for the space-time cases. I will try to do it next week.