-
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
Add thin optical elements in lasy
#199
Conversation
e9d758b
to
682b058
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
682b058
to
3cf7182
Compare
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This is great. I know it's early work, but would it make sense to be able to define something like an |
6c268b9
to
343e05e
Compare
""" | ||
# Transform the field from temporal to frequency domain | ||
time_axis_indx = -1 | ||
field_fft = np.fft.ifft(self.grid.field, axis=time_axis_indx, norm="backward") |
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.
The implementation is not efficient currently, as it performs FFTs forward and backward.
This will be fixed in #256, by keeping the Fourier-space fields in memory and having a flag that keeps track of this.
lasy
lasy
1d248d3
to
12d6ee8
Compare
for more information, see https://pre-commit.ci
@@ -160,6 +160,46 @@ def normalize(self, value, kind="energy"): | |||
else: | |||
raise ValueError(f'kind "{kind}" not recognized') | |||
|
|||
def apply_optics(self, optical_element): |
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.
New API
lasy
lasy
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!
lasy/laser.py
Outdated
|
||
# Apply optical element | ||
if self.dim == "rt": | ||
r, w = np.meshgrid(self.grid.axes[0], omega, indexing="ij") |
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.
Minor comment: might be a bit dangerous to mix w
and omega
.
lasy/laser.py
Outdated
|
||
# Apply optical element | ||
if self.dim == "rt": | ||
r, w = np.meshgrid(self.grid.axes[0], omega, indexing="ij") |
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.
(same as comment in optical_element.py
: should the meshgrid
be done in the optical element? Could just be an option)
Co-authored-by: Maxence Thévenet <[email protected]>
Co-authored-by: Maxence Thévenet <[email protected]>
# along theta (FT_theta). Because the multiplier is assumed to be | ||
# cylindrically symmetric (i.e. theta-independent): | ||
# FT_theta[ multiplier * field ] = multiplier * FT_theta[ field ] | ||
# Thus, we can simply multiply each azimuthal mode by the multiplier. |
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 added more explanations here.
This PR is one suggested way to add thin optical elements in
lasy
, through which the laser profiles can be propagated. This is heavily inspired by examples inaxiprop
.Thin elements are represented by their complex multiplying factor
T(x, y, omega)
and are therefore applied after performing one Fourier transform on the laser profile, along the time axis. This PR only implements one optical element (ParabolicMirror
), but more will be added next.For this reason, I chose to have the user pass the optical element to theIn the latest version, the API has been changed.propagate
function (since this function starts by performing a Fourier transform along the time axis)