keepcalculator

04 Electricity and Signals

Gaussian Beam Focus Calculator in Python

Card No. 04·0245 · Updated · Standard formula, shown below

Beam radius at distance 0.5000 mm
Rayleigh range
1,240.7554 mm
Result
Far-field half-angle divergence
0.000403 rad
Result
Beam waist radius
0.5 mm
You entered
You enter
Beam waist radius, Wavelength, Distance from waist
You get
Beam radius at distance, Rayleigh range, Far-field half-angle divergence
Rounding
4 dp · 6 dp

A Gaussian beam focus calculator in Python can estimate a beam’s waist size, Rayleigh range, and spot size at a chosen distance using the Gaussian-beam propagation equations. Enter the wavelength, beam waist, and distance from the waist; the calculator below returns the spot radius and related values, assuming an ideal paraxial beam.

Formula

For an ideal Gaussian beam, the radius at an axial distance z from the waist is:

w(z) = w₀ √[1 + (z / zR)²]

The Rayleigh range is zR = πw₀² / λ. The calculator uses millimetres for waist radius and distance, and nanometres for wavelength; it converts wavelength to millimetres with a factor of 0.000001. Its outputs are:

  • w₀: beam waist radius, in mm.
  • λ: wavelength, in nm.
  • z: distance from the waist, in mm.
  • w(z): beam radius at that distance, in mm.
  • zR: Rayleigh range, in mm.
  • θ: approximate far-field half-angle divergence, in radians, calculated as λ/(πw₀).

The beam diameter is twice the radius. The divergence output is a half-angle; double it for the full-angle divergence. These expressions assume a beam with a circular, ideal Gaussian intensity profile and a waist located at z = 0.

Worked Example

Using the defaults—waist radius 0.5 mm, wavelength 633 nm, and distance 10 mm—first convert the wavelength: 633 nm × 0.000001 = 0.000633 mm.

  • Rayleigh range: zR = π × (0.5 mm)² / 0.000633 mm ≈ 1240.2512 mm.
  • Beam radius: w(z) = √[(0.5 mm)² + (0.000633 mm × 10 mm / (π × 0.5 mm))²] ≈ 0.5000 mm.
  • Half-angle divergence: θ = 0.000633 / (π × 0.5) ≈ 0.000403 rad.

The radius changes very little over 10 mm because that distance is much shorter than the approximately 1240 mm Rayleigh range. The displayed radius is rounded to four decimal places.

How to Use a Python Calculator

To make a simple script, use Python’s built-in math module. Keep the units consistent: convert the wavelength into the same length unit used for the waist and distance before applying the equations.

import math

w0_mm = 0.5
wavelength_nm = 633
z_mm = 10

wavelength_mm = wavelength_nm * 1e-6
rayleigh_mm = math.pi * w0_mm**2 / wavelength_mm
radius_mm = w0_mm * math.sqrt(1 + (z_mm / rayleigh_mm)**2)
divergence_rad = wavelength_mm / (math.pi * w0_mm)

print(f"Beam radius: {radius_mm:.4f} mm")
print(f"Rayleigh range: {rayleigh_mm:.4f} mm")
print(f"Half-angle divergence: {divergence_rad:.6f} rad")

Python’s ** operator means “raised to a power,” and math.sqrt evaluates a square root. For a reusable tool, validate that wavelength and waist radius are positive and that distance is nonnegative if the input is intended to represent propagation away from the waist. A signed distance can also be used in the radius equation, since the spot radius is symmetric around the waist.

What the Results Mean

The waist is the narrowest point of the beam in the simple Gaussian model. At one Rayleigh range from the waist, the radius is √2 times the waist radius. At twice the Rayleigh range, it is √5 times the waist radius. Far beyond the Rayleigh range, the beam expands approximately linearly with distance, at the calculated divergence angle.

These are radii defined by the usual Gaussian-beam convention: for an ideal beam, intensity falls to 1/e² of its on-axis value at radius w. That is not the same as a full width at half maximum measurement. For a circular Gaussian intensity profile, the 1/e² diameter is 2w; the intensity full width at half maximum is about 1.177w in diameter.

Choosing Inputs and Understanding Focus

Use the wavelength in the medium where the beam propagates. The equations use wavelength in that medium, not necessarily the source’s vacuum wavelength. In a uniform material with refractive index n, the wavelength is approximately the vacuum wavelength divided by n. For air, the difference from vacuum is often small for rough estimates, but precision work should use the appropriate refractive index.

The waist radius is not automatically the same as the diameter printed on a laser or measured at an arbitrary point. A measurement away from the waist must be related to the waist through a beam-propagation model. If a lens is focusing a beam, its focal length alone does not determine the focused spot: the incoming beam size, wavelength, beam quality, and lens and alignment conditions also matter. This calculator begins at a known waist; it does not trace a lens system or locate a waist from lens specifications.

Limits and Common Mistakes

  • Mixing units: putting 633 directly into an equation expecting millimetres gives a wildly incorrect result. Convert nanometres to mm, or convert every length to metres or micrometres consistently.
  • Confusing radius and diameter: if a measured beam diameter is 1 mm, enter a 0.5 mm radius when the measurement refers to the same 1/e² definition.
  • Using the wrong distance origin: z is measured from the waist, not from the laser housing, lens, or start of an optical table.
  • Assuming all beams are ideal: real beams may have a beam-quality factor M² greater than 1, aberrations, ellipticity, or clipping. The ideal equations can then understate divergence or misestimate the spot.
  • Rounding too early: keep full precision through the calculations and round only the displayed answer, especially when comparing distances near the Rayleigh range.

For a non-ideal beam, a common propagation form uses M²: zR = πw₀²/(M²λ), with corresponding divergence approximately M²λ/(πw₀). This adjustment is meaningful only when M² and the waist are measured or otherwise known for the beam. It does not model every optical imperfection. A paraxial Gaussian approximation is also less suitable for strongly focused beams with large numerical aperture, where more complete electromagnetic or vector-optics methods may be needed.

Frequently Asked Questions

How do I calculate a Gaussian beam waist in Python?
Use the propagation equation if the waist is known. To infer the waist from measured radii, distances, or an optical setup, you need additional measurements and a suitable model; the waist cannot be determined from wavelength alone.

What is the difference between Rayleigh range and depth of focus?
The Rayleigh range is a defined Gaussian-beam length: at that distance from the waist, the radius is √2 times the waist radius. “Depth of focus” is used with different conventions in optics, so check the definition used for a particular system.

Is the calculator’s divergence angle a full angle?
No. It gives the approximate half-angle, λ/(πw₀). The full-angle divergence is approximately twice that value.

Can I enter a beam diameter instead of a radius?
Not directly. Divide a diameter measured using the same beam-width convention by two to obtain the radius. For Gaussian beams, the common 1/e² diameter is twice the 1/e² radius.

Does a lens’s focal length give the focused spot size?
No. The spot also depends on the incident beam radius and quality, wavelength, and the optical system. Use a lens-focusing model or measurements when those details matter.

Related

Formula used
in w | Beam waist radius | mm | 0.5 | 0
in lam | Wavelength | nm | 633 | 0
in z | Distance from waist | mm | 10 | 0
out wz | Beam radius at distance | mm | sqrt(w^2 + (lam * 0.000001 * z / (pi * w))^2) | 4
out zr | Rayleigh range | mm | pi * w^2 / (lam * 0.000001) | 4
out div | Far-field half-angle divergence | rad | lam * 0.000001 / (pi * w) | 6

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Electricity and Signals drawer →