-
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
Enable initialisation and estimation of optional spatio-temperal coupling parameters to gaussian profile #307
Changes from 52 commits
f39be57
b4f9207
29495d1
7dba5cd
8bb4c42
ff5bb80
e3c5e87
869c270
da2767a
290f953
eece1ee
783a6e9
7c62af6
07ab813
2be5430
a8f314d
3716454
1930b61
fbeeab2
ec2e079
6e0729e
208d948
4c0f1d5
2ba3382
539de75
70260c3
e7046e2
10f7fb6
56b9e1c
e7cf2e8
ff98723
620ebc1
fec6969
23b82f9
52e78ab
2c8a2c5
936d5b8
d428c38
ab04fd8
9d8ac04
0d53cc5
77ba254
85d5ae0
7078e96
a404f53
4f1ae2a
d9ceb7b
b2ed082
acff2ea
b699d89
13972f0
bf38936
6c2c045
f9a189f
2b1da7c
7f66359
b01e5f3
2009f1f
6ecf5d7
681660f
493d506
0a89c81
c561ea5
e3412ed
d6bd1b2
118582d
ae870bf
5e42441
c68bdf7
0cc921b
ca56108
01f20d9
d1ee329
f343362
5f4b3d4
f7a5974
8b77b5c
9a5701d
33b1a15
4472c82
9277e01
c68365a
a6e4274
b529497
0c96a6f
2977480
3b9e7e3
f7d6aa7
3f32d0e
2a378de
28197ed
a1d52eb
d5e0cfc
f0ca9f9
ebc57e6
fc7eac0
07df652
197002a
14221e8
1de89a4
52db34f
b2791b8
365c704
a11c89c
a468337
a676107
cca9570
74b7489
030884b
e839ef8
7b772f3
2f6b19a
b8dce99
6e979e2
7aba7bd
9defa15
99d80f4
1d9863a
d7f6a27
96275cd
99cff49
4abf73c
5432eed
26b302f
6ac3412
baf2a69
805358c
0e0b6af
14583d8
d5f7536
de7a88f
cc4bb9e
156e1ae
a3a51ce
6a1f06c
3bd1071
1b26328
14b1723
f455480
6a20671
7041b43
9b96093
c6a36bf
6ca62d5
cad2e00
b061c13
8ad2a35
cdfb869
d8922a5
cbfd1cd
acd527a
0ec4bba
901a851
c648f8d
b245c58
93d14e5
d464e58
2371fbe
d6fa08c
7a87ac1
20af8ed
aecb2cd
2709d61
391aea1
31e78d2
b5fd9f9
008edbe
a53de8b
62b1dc2
476ff30
8512dce
bb9e06c
fa1d887
4c439d9
da20481
e957928
6e56cb0
4a1b316
47af7b0
de93eda
5ed174c
e703483
885f220
76f7f85
0f90aa4
87759d9
7dc6a0a
3cc9a52
84f530e
4111779
85bd98b
975f4e8
908bd80
2fa7b17
420d7c9
1c7e523
d9b00e7
204568a
d605e01
2f1061e
cc10702
b6d5a37
1be3b90
8921ee0
059a778
97a9c3f
ba01785
5ff16db
be187f9
e2d7ad0
d433e6a
2ad2097
2b5eb39
de7c26a
6f650f2
5e8ce8b
932eb03
69ac5a5
7c8d7b5
9d0e5e9
070e7c0
7b4d70e
16b858f
9f1b220
89b15e9
065c6c8
292509a
5b69bf5
f51080c
251e7f3
2d2faff
2b4e9e2
7fd3c84
98046a5
44c2421
d4200f4
8175dfc
6dfb498
ef6266e
8f3c778
5fbfa99
9acbc4a
10ccbae
ece499f
82337bd
9fa1a18
c0df341
643c551
6852641
fd60446
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
MaxThevenet marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This profile should not be changed. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -873,3 +873,125 @@ | |||||
field = np.moveaxis(prop.z2t(transform_data, t_axis, z0=z0, t0=t0), 0, -1) | ||||||
field *= np.exp(1j * (z0 / c + t_axis) * omega0) | ||||||
grid.set_temporal_field(field) | ||||||
|
||||||
|
||||||
def get_STC(dim, grid, tau, w0, k0): | ||||||
|
||||||
""" | ||||||
Calculate the spatio-temperal coupling factors of the laser. | ||||||
|
||||||
Parameters | ||||||
---------- | ||||||
laser: | ||||||
dim : string | ||||||
Dimensionality of the array. Options are: | ||||||
- 'xyt': The laser pulse is represented on a 3D grid: | ||||||
Cartesian (x,y) transversely, and temporal (t) longitudinally. | ||||||
- 'rt' : The laser pulse is represented on a 2D grid: | ||||||
Cylindrical (r) transversely, and temporal (t) longitudinally. | ||||||
|
||||||
grid : a Grid object. | ||||||
It contains an ndarray (V/m) with | ||||||
the value of the envelope field and the associated metadata | ||||||
that defines the points at which the laser is defined. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would recommend to write 1 sentence per line. The pre-commit CI will fix it. |
||||||
|
||||||
tau : scalar | ||||||
Duration of the laser pulse in s. | ||||||
|
||||||
w0 : scalar | ||||||
Waist of laser in m. | ||||||
|
||||||
k0 : scalar | ||||||
Wavenumber of the field | ||||||
|
||||||
Return | ||||||
---------- | ||||||
STC_fac : dict of floats | ||||||
A dictionary of floats corresponding to the STC factors. The keys are: | ||||||
Phi2: Group-delayed dispersion in :math:`\Phi^{(2)}=d(\omega_0)/dt` | ||||||
phi2: Group-delayed dispersion in :math:`\phi^{(2)}=dt_0/d(\omega)` | ||||||
nu: Spatio-chirp in :math:`\nu=d(\omega_0)/dx` | ||||||
zeta: Spatio-chirp in :math:`\zeta=dx_0/d(\omega_0)` | ||||||
stc_theta_zeta: The direction of the linear spatial chirp on xoy plane\ | ||||||
in rad (0 is along x) | ||||||
beta: Angular dispersion in :math:` \beta = d\theta_0/d\omega` | ||||||
pft: Pulse front tilt in :math:` p=dt/dx` | ||||||
stc_theta_beta: The direction of the linear angular chirp on xoy plane\ | ||||||
in rad (0 is along x) | ||||||
All those above units and definiations are taken from `S. Akturk et al., Optics\ | ||||||
Express 12, 4399 (2004) <https://doi.org/10.1364/OPEX.12.004399>`__. | ||||||
""" | ||||||
# Initialise the returned dictionary | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. US English was used above, and is the norm in LASY.
Suggested change
|
||||||
STC_fac = { | ||||||
"Phi2": 0, | ||||||
"phi2": 0, | ||||||
"nu": 0, | ||||||
"zeta": 0, | ||||||
"stc_theta_zeta": 0, | ||||||
"beta": 0, | ||||||
"pft": 0, | ||||||
"stc_theta_beta": 0, | ||||||
} | ||||||
env = grid.get_temporal_field() | ||||||
env_abs = np.abs(env) | ||||||
phi_envelop = np.unwrap(np.array(np.arctan2(env.imag, env.real)), axis=2) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 1D unwrapping can be a bit dodgy. Also, |
||||||
pphi_pz = (np.diff(phi_envelop, axis=2)) / (grid.dx[-1]) | ||||||
# Calculate goup-delayed dispersion | ||||||
pphi_pz2 = (np.diff(pphi_pz, axis=2)) / (grid.dx[-1]) | ||||||
STC_fac["Phi2"] = np.sum(pphi_pz2 * env_abs[:, :, : env_abs.shape[2] - 2]) / np.sum( | ||||||
env_abs[:, :, : env_abs.shape[2] - 2] | ||||||
) | ||||||
STC_fac["phi2"] = np.max(np.roots([4 * Phi2, -4, tau**4 * Phi2])) | ||||||
# Calculate spatio- and angular dispersion | ||||||
if dim == "rt": | ||||||
pphi_pzpr = (np.diff(pphi_pz, axis=1)) / grid.dx[0] | ||||||
STC_fac["nu"] = np.sum( | ||||||
pphi_pzpr * env_abs[:, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1] | ||||||
) / np.sum(env_abs[:, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1]) | ||||||
# Transfer the unit from nu to zeta | ||||||
STC_fac["zeta"] = np.min(np.roots([4 * nu, -4, nu * w0**2 * tau**2])) | ||||||
# No angular dispersion in 2D and the direction of spatio-chirp is certain | ||||||
return STC_fac | ||||||
if dim == "xyt": | ||||||
pphi_pzpy = (np.diff(pphi_pz, axis=1)) / grid.dx[1] | ||||||
pphi_pzpx = (np.diff(pphi_pz, axis=0)) / grid.dx[0] | ||||||
# Calculate the STC angle in XOY for spatio coupling | ||||||
theta = np.arctan2( | ||||||
pphi_pzpy[: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, :], | ||||||
pphi_pzpx[: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, :], | ||||||
) | ||||||
STC_fac["stc_theta_zeta"] = np.sum( | ||||||
theta | ||||||
* env_abs[ | ||||||
: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1 | ||||||
] | ||||||
) / np.sum( | ||||||
env_abs[ | ||||||
: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1 | ||||||
] | ||||||
) | ||||||
pphi_pzpr = ( | ||||||
pphi_pzpy[: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, :] ** 2 | ||||||
+ pphi_pzpx[:: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, :] ** 2 | ||||||
) ** 0.5 | ||||||
STC_fac["nu"] = np.sum( | ||||||
pphi_pzpr | ||||||
* env_abs[ | ||||||
: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1 | ||||||
] | ||||||
) / np.sum( | ||||||
env_abs[ | ||||||
: env_abs.shape[0] - 1, : env_abs.shape[1] - 1, : env_abs.shape[2] - 1 | ||||||
] | ||||||
) | ||||||
STC_fac["zeta"] = np.min(np.roots([4 * nu, -4, nu * w0**2 * tau**2])) | ||||||
# calculate angular dispersion and pulse front tilt | ||||||
z_centroids = np.sum(grid.axes[2] * env_abs, axis=2) / np.sum(env_abs, axis=2) | ||||||
weight = np.mean(env_abs**2, axis=2) | ||||||
derivative_x = np.gradient(z_centroids, axis=0) / grid.dx[0] | ||||||
derivative_y = np.gradient(z_centroids, axis=1) / grid.dx[1] | ||||||
pft_x = np.sum(derivative_x * weight) / np.sum(weight) | ||||||
pft_y = np.sum(derivative_y * weight) / np.sum(weight) | ||||||
STC_fac["pft"] = np.sqrt((pft_x**2 + pft_y**2)) | ||||||
STC_fac["stc_theta_beta"] = np.arctan2(pft_y, pft_x) | ||||||
STC_fac["beta"] = (np.sqrt((pft_x**2 + pft_y**2)) - temp_chirp * nu) / k0 | ||||||
return STC_fac |
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.