gtrace.optics package

Submodules

gtrace.optics.cavity module

cavity.py - A Cavity class and related functions for representing a Fabry-Perot cavity

class gtrace.optics.cavity.Cavity(r1=0.9, r2=0.99, L=1.0, R1=- 1.5, R2=1.5, wl=1.064e-06, power=False)

Bases: traits.has_traits.HasTraits

A class to represent a Fabry-Perot cavity.

r1

Input mirror reflectivity (amplitude)

Type

float

r2

End mirror reflectivity (amplitude)

Type

float

rp1

Input mirror reflectivity (power)

Type

float

rp2

End mirror reflectivity (power)

Type

float

L

Length

Type

float

R1

ROC of the input mirror (positive when concave to incident light, i.e. convex seen from inside the cavity)

Type

float

R2

ROC of the end mirror (positive when concave to incident light, i.e. concave seen from inside the cavity)

Type

float

wl

Wavelength

Type

float

FSR()

Returns the free spectral range of the cavity.

Nbounce()

Bounce number

finesse()

Returns the finesse of the cavity.

intra(f=0, d=0)

Returns the intra cavity field amplitude. It assumes the cavity was locked to the incident light first. Then computes the intra-cavity field amplitude for the light with a frequency shift f from the original light with the cavity length changed by d from the initial state.

Parameters
  • f (float, optional) – Frequency shift of the light in Hz. Defaults 0.

  • d (float, optional.) – Cavity length detuning in m. Defaults 0.

Returns

The intra-cavity field amplitude at the input mirror surface (a complex number).

Return type

complex

modeSpacing()

Return the transverse mode spacing of the cavity (commonly called gamma). It is a fractional number defined by gamma = (mode spacing frequency)/FSR.

pole()

Cavity pole frequency [Hz]

powerGain()

Ratio of the intra-cavity power to the input power.

refl(f=0, d=0)

Returns the amplitude reflectivity of the cavity. It assumes the cavity was locked to the incident light first. Then computes the amplitude reflectivity for the light with a frequency shift f from the original light with the cavity length changed by d from the initial state.

Parameters
  • f (float, optional) – Frequency shift of the light in Hz. Defaults 0.

  • d (float, optional.) – Cavity length detuning in m. Defaults 0.

Returns

The amplitude reflectivity of the cavity (a complex number).

Return type

complex

spotSize()

Returns the beam spot sizes on the input and end mirrors as a tuple (w1,w2).

storageTime()

Storage time

trans(f=0, d=0)

Returns the amplitude transmissivity of the cavity. It assumes the cavity was locked to the incident light first. Then computes the amplitude transmissivity for the light with a frequency shift f from the original light with the cavity length changed by d from the initial state.

Parameters
  • f (float, optional) – Frequency shift of the light in Hz. Defaults 0.

  • d (float, optional.) – Cavity length detuning in m. Defaults 0.

Returns

The amplitude transmissivity of the cavity (a complex number).

Return type

complex

waist(size=False)

Return the q-parameter or the radius of the beam at the cavity waist.

Parameters

size (boolean, optional) – if set to true, the first element of the returned tuple will be the waist size, rather than the q-parameter.

Returns

(q0, d) – This function returns a tuple with two elements. The first element is the q-parameter of the cavity mode at the cavity waist. If size=True is given, it becomes the waist size (1/e^2 radius). The second element is the distance of the cavity waist from the input mirror.

Return type

(complex, float)

gtrace.optics.cavity.finesse(r1, r2, power=False)

Returns the finesse of a cavity

Parameters
  • r1 (float) – Reflectivity of the first mirror.

  • r2 (float) – Reflectivity of the second mirror.

  • power (boolean, optional) – If True, r1 and r2 are treated as power reflectivities. Otherwise, r1 and r2 are regarded as amplitude reflectivities. Defaults False.

gtrace.optics.consts module

gtrace.optics.consts.n_fused_silica(wl)

Calculate the index of refraction of fused silica for a given wavelength.

gtrace.optics.consts.n_sapphire_extraordinary(wl)

Calculate the index of refraction of Sapphire extraordinary axis for a given wavelength.

gtrace.optics.consts.n_sapphire_ordinary(wl)

Calculate the index of refraction of Sapphire ordinary axis for a given wavelength.

gtrace.optics.consts.sellmeier(wl, B1, B2, B3, C1, C2, C3)

Calculate index of refraction using Sellmeiers equation

n^2 = 1+B1*wl^2/(wl^2 - C1) + B2*wl^2/(wl^2 - C2) + B3*wl^2/(wl^2 - C3)

See below for the coefficients for specific materials. http://www.cvimellesgriot.com/products/Documents/Catalog/Dispersion_Equations.pdf

gtrace.optics.gaussian module

gaussian - Gaussian Optics Module

This module contains several utility functions for gaussian optics.

gtrace.optics.gaussian.InvROCandW2q(invROC=0.0, w=1.0, wl=1.064e-06)

Get the q-parameter from the inverse ROC and w.

Parameters
  • invROC (float, optional) – Inverse of the ROC. Defaults 0.0.

  • w (float, optional) – Beam size. Defaults 1.0.

  • wl (float, optional) – Wavelength. Defaults 1064*nm.

Returns

Beam parameter.

Return type

complex

gtrace.optics.gaussian.ROCandWtoQ(ROC=1.0, w=1.0, wl=1.064e-06)

Convert radius of curvature and beam width to q-parameter

Parameters
  • ROC (float, optional) – Radius of curvature. Defaults to 1.0.

  • w (float, optional) – Beam width. Defaults to 1.0.

  • wl (float, optional) – Wavelength. Defaults to 1064e-9

Returns

q-parameter

Return type

complex

gtrace.optics.gaussian.Rw2q(ROC=1.0, w=1.0, wl=1.064e-06)

Get the q-parameter from the ROC and w.

ROCfloat, optional

Radius of curvature.

wfloat, optional

Beam size. Defaults 1.0.

wlfloat, optional

Wavelength. Defaults 1064*nm.

Returns

Beam parameter.

Return type

complex

gtrace.optics.gaussian.appertureCut(r=1.0, w=3.0)

Apperture cut.

Parameters
  • r (float) –

  • w (float) –

Returns

Return type

float

gtrace.optics.gaussian.beamClip(a=1.0, w=3.0)

Beam clip

Parameters
  • a (float) –

  • w (float) –

Returns

Return type

float

gtrace.optics.gaussian.modeMatching(q1, q2x, q2y=False)

Mode matching between two beams with different q-parameters. The axes of the two beams are assumed to be matched.

Parameters
  • q1 (complex) – q-parameter of the first beam. This beam is assumed to be circular.

  • q2x (complex) – q-parameter of the second beam in x-direction. If the second beam is also circular, omit the next argument.

  • q2y (complex, optional) – q-parameter of the second beam in y-direction. Specify this parameter if the second beam is eliptic. Defaults False.

gtrace.optics.gaussian.modeMatchingElliptic(q1x, q1y, q2x, q2y)

Mode matching between two elliptic beams.

Parameters
  • q1x (complex) – q-parameter of the first beam in x-direction.

  • q1y (complex) – q-parameter of the first beam in y-direction.

  • q2x (complex) – q-parameter of the second beam in x-direction.

  • q2y (complex) – q-parameter of the second beam in y-direction.

Returns

Return type

float

gtrace.optics.gaussian.modeSpacing(g1, g2)
gtrace.optics.gaussian.optimalMatching(q1, q2)

Returns a mode (q-parameter) which best matches the given two q-parameters, q1 and q2.

Parameters
  • q1 (complex) – q-parameter of the first beam. This beam is assumed to be circular.

  • q2 (complex) – q-parameter of the second beam. This beam is assumed to be circular.

Returns

(q, match)

q: The best matching q-parameter

match: Mode matching rate

Return type

(complex, match?)

gtrace.optics.gaussian.q2R(q)

Convert a q-parameter to the ROC

Parameters

q (complex) – Beam parameter.

Returns

Radius of curvature.

Return type

float

gtrace.optics.gaussian.q2w(q, wl=1.064e-06)

Convert a q-parameter to the beam size

Parameters
  • q (complex) – Beam parameter.

  • wl (float, optional) – Wavelength. Defaults 1064*nm.

Returns

w – Beam size.

Return type

float

gtrace.optics.gaussian.q2zr(q)

Convert a q-parameter to Rayleigh range.

Parameters

q (complex) – Beam parameter.

Returns

zr – Rayleigh range.

Return type

float

gtrace.optics.gaussian.qToROC(q)

Convert a q-parameter to radius of curvature.

Parameters

q (complex) – Beam parameter.

Returns

Radius of curvature.

Return type

float

gtrace.optics.gaussian.qToRadius(q, wl=1.064e-06)

Convert a q-parameter to the beam size

Parameters
  • q (complex) – Beam parameter.

  • wl (float, optional) – Wavelength. Defaults 1064e-9.

Returns

Radius.

Return type

float

gtrace.optics.gaussian.w02zr(w0, wl=1.064e-06)

Convert waist size to Rayleigh range

Parameters
  • w0 (float) – Waist size.

  • wl (float, optional) – Wavelength. Defaults 1064*nm.

gtrace.optics.gaussian.zr2w0(zr, wl=1.064e-06)

Convert Rayleigh range to the waist size

Parameters
  • zr (float) – Rayleigh range.

  • wl (float, optional) – Wavelength. Defaults 1064*nm.

Returns

Waist size.

Return type

float

gtrace.optics.geometric module

gtrace.optics.geometric.cyl_refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None, curve_direction='h')

Returns a tuples of reflection and deflection angles for incidence of a beam into a cylindrical surface.

Parameters
  • beamAngle (float) – The angle formed by the propagation direction vector of the incident beam and the x-axis.

  • normAngle (float) – The angle formed by the normal vector of the surface and the x-axis.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

  • invROC (float or None, optional) – Inverse of the radius of curvature.

  • curve_direction (str, optional) – Direction of curvature. Either ‘h’ or ‘v’.

gtrace.optics.geometric.deflection_angle(theta, n1, n2, deg=True)

Calculate deflection angle according to Snell’s law.

Parameters
  • theta (float) – Angle of incidence.

  • n1 (float) – Refractive index of the first medium.

  • n2 (float) – Refraction index of the second medium.

  • deg (boolean, optional) – True if theta is specified in degrees.

gtrace.optics.geometric.line_arc_intersection(pos, dirVect, chord_center, chordNormVect, invROC, diameter, verbose=False)

Compute the intersection point between a line and an arc.

Parameters
  • pos (array) – Origin of the line.

  • dirVect (array) – Direction of the line.

  • chord_center (array) – The center of the chord made by the arc.

  • chordNormVect (array) – Normal vector of the chord.

  • invROC (float) – Inverse of the ROC of the arc. Positive for concave surface.

  • diameter (float) – Length of the chord.

  • verbose (boolean, optional) – Prints useful information.

Returns

The returned value is a dictionary with the following keys: “Intersection Point”: numpy array of the coordinates of the intersection point. “isHit”: A boolean value of whether the line intersects with the plane or not. “distance”: Distance between the origin of the line and the intersection point. “localNormVect”: localNormVect, “localNormAngle”: localNormAngle.

Return type

dict

gtrace.optics.geometric.line_plane_intersection(pos, dirVect, plane_center, normalVector, diameter)

Compute the intersection point between a line and a plane

Parameters
  • pos (array) – The position of the end point of the line.

  • dirVert (array) – The directional vector specifying the line.

  • plane_center (array) – The position of the center of the plane.

  • normalVector (array) – The normal vector of the plane.

  • diameter (float) – The diameter of the plane.

Returns

The returned value is a dictionary with the following keys: “Intersection Point”: numpy array of the coordinates of the intersection point. “isHit”: A boolean value of whether the line intersects with the plane or not. “distance”: Distance between the origin of the line and the intersection point. “distance from center”: Distance between the center of the plane and the intersection point.

Return type

dict

gtrace.optics.geometric.normSpheric(normAngle, invROC, dist_from_center)

Returns the local normal angle of a spheric mirror at a distance from the center.

Parameters
  • normAngle (float) – The angle formed by the normal vector of the mirror at the center and the x-axis.

  • invROC (float) – 1/R, where R is the ROC of the mirror.

  • dist_from_center (float) – The distance from the center of the point where the local normal is requested. This is a signed value. For a mirror facing +x (the normal vector points towards positive x direction), this distance is positive for points with positive y coordinate, and negative for points with negative y coordinate.

Returns

The local normal angle of a spheric mirror at a distance from the center.

Return type

float

gtrace.optics.geometric.refl_defl_angle(beamAngle, normAngle, n1, n2, invROC=None)

Returns a tuples of reflection and deflection angles.

Parameters
  • beamAngle (float) – The angle formed by the propagation direction vector of the incident beam and the x-axis.

  • normAngle (float) – The angle formed by the normal vector of the surface and the x-axis.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

  • invROC (float or None, optional) – Inverse of the radius of curvature.

Returns

  • 6-tuple or 2-tuple

  • (reflAngle, deflAngle, Mrx, Mry, Mtx, Mty) or (reflAngle, deflAngle)

gtrace.optics.geometric.vc_deflect(theta, theta1, n1, n2)

Deflection angle helper function for VariCAD.

Parameters
  • theta (float) – Angle of the surface measured from right.

  • theta1 (float) – Angle of the incident beam measured from right.

  • n1 (float) – Index of refraction of the incident side medium.

  • n2 (float) – Index of refraction of the transmission side medium.

Returns

phi2 – Angle of the deflected beam measured from right.

Return type

float

gtrace.optics.geometric.vc_reflect(theta, theta1)

Convert theta and theta1 to 0-360 format.

Parameters
  • theta (float) – Angle of the surface measured from right.

  • theta1 (float) – Angle of the incident beam measured from right.

Returns

Return type

float

gtrace.optics.geometric.vector_normalize(vect)

Normalize a vector

Parameters

vect (array) – The vector to be normalized

Returns

The normalized vector.

Return type

array

gtrace.optics.geometric.vector_rotation_2D(vect, angle)

Rotate a 2D vector by an angle.

Parameters
  • vect (array) – A 2D vector.

  • angle (float) – Angle of rotation in radians.

Returns

The rotated vector.

Return type

array

gtrace.optics.unit module

gtrace.optics.unit.deg2rad(deg)
gtrace.optics.unit.rad2deg(rad)

Module contents

gtrace.optics

This package provides utility functions and classes for Gaussian optics.