Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#288)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Sep 2, 2024
1 parent 539b744 commit 7016e76
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ repos:
# Python: Ruff linter & formatter
# https://docs.astral.sh/ruff/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.6.2
hooks:
# Run the linter
- id: ruff
Expand Down
52 changes: 27 additions & 25 deletions docs/source/tutorials/axiparabola.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@
"from lasy.profiles.longitudinal import GaussianLongitudinalProfile\n",
"from lasy.profiles.transverse import SuperGaussianTransverseProfile\n",
"\n",
"wavelength = 800e-9 # Laser wavelength in meters\n",
"polarization = (1,0) # Linearly polarized in the x direction\n",
"energy = 1.5 # Energy of the laser pulse in joules\n",
"spot_size = 1e-3 # Spot size in the near-field: millimeter-scale\n",
"wavelength = 800e-9 # Laser wavelength in meters\n",
"polarization = (1, 0) # Linearly polarized in the x direction\n",
"energy = 1.5 # Energy of the laser pulse in joules\n",
"spot_size = 1e-3 # Spot size in the near-field: millimeter-scale\n",
"pulse_duration = 30e-15 # Pulse duration of the laser in seconds\n",
"t_peak = 0.0 # Location of the peak of the laser pulse in time\n",
"t_peak = 0.0 # Location of the peak of the laser pulse in time\n",
"\n",
"laser_profile = CombinedLongitudinalTransverseProfile(\n",
" wavelength, polarization, energy,\n",
" wavelength,\n",
" polarization,\n",
" energy,\n",
" GaussianLongitudinalProfile(wavelength, pulse_duration, t_peak),\n",
" SuperGaussianTransverseProfile(spot_size, n_order=16)\n",
" SuperGaussianTransverseProfile(spot_size, n_order=16),\n",
")"
]
},
Expand All @@ -75,12 +77,12 @@
"metadata": {},
"outputs": [],
"source": [
"dimensions = 'rt' # Use cylindrical geometry\n",
"lo = (0,-2.5*pulse_duration) # Lower bounds of the simulation box\n",
"hi = (1.1*spot_size,2.5*pulse_duration) # Upper bounds of the simulation box\n",
"num_points = (3000, 30) # Number of points in each dimension\n",
"dimensions = \"rt\" # Use cylindrical geometry\n",
"lo = (0, -2.5 * pulse_duration) # Lower bounds of the simulation box\n",
"hi = (1.1 * spot_size, 2.5 * pulse_duration) # Upper bounds of the simulation box\n",
"num_points = (3000, 30) # Number of points in each dimension\n",
"\n",
"laser = Laser(dimensions,lo,hi,num_points,laser_profile)"
"laser = Laser(dimensions, lo, hi, num_points, laser_profile)"
]
},
{
Expand Down Expand Up @@ -112,10 +114,10 @@
"source": [
"from lasy.optical_elements import Axiparabola\n",
"\n",
"f0 = 3e-2 # Focal distance\n",
"f0 = 3e-2 # Focal distance\n",
"delta = 1.5e-2 # Focal range\n",
"R = spot_size # Radius\n",
"axiparabola = Axiparabola( f0, delta, R )"
"R = spot_size # Radius\n",
"axiparabola = Axiparabola(f0, delta, R)"
]
},
{
Expand All @@ -133,8 +135,8 @@
"metadata": {},
"outputs": [],
"source": [
"laser.apply_optics( axiparabola )\n",
"laser.propagate( f0 )"
"laser.apply_optics(axiparabola)\n",
"laser.propagate(f0)"
]
},
{
Expand Down Expand Up @@ -165,7 +167,7 @@
"metadata": {},
"outputs": [],
"source": [
"laser.write_to_file('flying_focus', 'h5')"
"laser.write_to_file(\"flying_focus\", \"h5\")"
]
},
{
Expand All @@ -188,9 +190,9 @@
"source": [
"import math\n",
"\n",
"ZR = math.pi*wavelength*f0**2/spot_size**2\n",
"print('Rayleigh length: %.f mm' %(1.e3*ZR))\n",
"print('Focal range: %.f mm' %(1.e3*delta))"
"ZR = math.pi * wavelength * f0**2 / spot_size**2\n",
"print(\"Rayleigh length: %.f mm\" % (1.0e3 * ZR))\n",
"print(\"Focal range: %.f mm\" % (1.0e3 * delta))"
]
},
{
Expand All @@ -200,10 +202,10 @@
"metadata": {},
"outputs": [],
"source": [
"laser.propagate(2*ZR)\n",
"laser.propagate(2 * ZR)\n",
"laser.show()\n",
"plt.ylim(-0.25e-3, 0.25e-3)\n",
"plt.title('Laser field after 2 Rayleigh range')"
"plt.title(\"Laser field after 2 Rayleigh range\")"
]
},
{
Expand All @@ -213,10 +215,10 @@
"metadata": {},
"outputs": [],
"source": [
"laser.propagate(2*ZR)\n",
"laser.propagate(2 * ZR)\n",
"laser.show()\n",
"plt.ylim(-0.25e-3, 0.25e-3)\n",
"plt.title('Laser field after 4 Rayleigh range')"
"plt.title(\"Laser field after 4 Rayleigh range\")"
]
}
],
Expand Down
32 changes: 17 additions & 15 deletions docs/source/tutorials/gaussian_laser.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@
"metadata": {},
"outputs": [],
"source": [
"wavelength = 800e-9 # Laser wavelength in meters\n",
"polarization = (1,0) # Linearly polarized in the x direction\n",
"energy = 1.5 # Energy of the laser pulse in joules\n",
"spot_size = 25e-6 # Waist of the laser pulse in meters\n",
"wavelength = 800e-9 # Laser wavelength in meters\n",
"polarization = (1, 0) # Linearly polarized in the x direction\n",
"energy = 1.5 # Energy of the laser pulse in joules\n",
"spot_size = 25e-6 # Waist of the laser pulse in meters\n",
"pulse_duration = 30e-15 # Pulse duration of the laser in seconds\n",
"t_peak = 0.0 # Location of the peak of the laser pulse in time\n",
"t_peak = 0.0 # Location of the peak of the laser pulse in time\n",
"\n",
"laser_profile = GaussianProfile(wavelength,polarization,energy,spot_size,pulse_duration,t_peak)"
"laser_profile = GaussianProfile(\n",
" wavelength, polarization, energy, spot_size, pulse_duration, t_peak\n",
")"
]
},
{
Expand All @@ -70,12 +72,12 @@
"metadata": {},
"outputs": [],
"source": [
"dimensions = 'rt' # Use cylindrical geometry\n",
"lo = (0,-2.5*pulse_duration) # Lower bounds of the simulation box\n",
"hi = (5*spot_size,2.5*pulse_duration) # Upper bounds of the simulation box\n",
"num_points = (300,500) # Number of points in each dimension\n",
"dimensions = \"rt\" # Use cylindrical geometry\n",
"lo = (0, -2.5 * pulse_duration) # Lower bounds of the simulation box\n",
"hi = (5 * spot_size, 2.5 * pulse_duration) # Upper bounds of the simulation box\n",
"num_points = (300, 500) # Number of points in each dimension\n",
"\n",
"laser = Laser(dimensions,lo,hi,num_points,laser_profile)"
"laser = Laser(dimensions, lo, hi, num_points, laser_profile)"
]
},
{
Expand Down Expand Up @@ -111,8 +113,8 @@
"metadata": {},
"outputs": [],
"source": [
"z_R = 3.14159*spot_size**2/wavelength # The Rayleigh length\n",
"laser.propagate(-z_R) # Propagate the pulse upstream of the focal plane"
"z_R = 3.14159 * spot_size**2 / wavelength # The Rayleigh length\n",
"laser.propagate(-z_R) # Propagate the pulse upstream of the focal plane"
]
},
{
Expand Down Expand Up @@ -140,8 +142,8 @@
"metadata": {},
"outputs": [],
"source": [
"file_prefix = 'test_output' # The file name will start with this prefix\n",
"file_format = 'h5' # Format to be used for the output file\n",
"file_prefix = \"test_output\" # The file name will start with this prefix\n",
"file_format = \"h5\" # Format to be used for the output file\n",
"\n",
"laser.write_to_file(file_prefix, file_format)"
]
Expand Down

0 comments on commit 7016e76

Please sign in to comment.