Skip to main content

beamtrace for quick ABCD matrix calculations

Project description

Simple ABCD matrix propagator.

Main file in this directory is tracer.py.

Installation

You can install using pip at https://pypi.org/project/beamtrace/

pip install beamtrace

then in a python scipy or ipython terminal, import the BeamTrace class by running

import beamtrace
from beamtrace.tracer import BeamTrace

or if you have LIGO credentials you can git clone the directory at https://git.ligo.org/craig-cahillane/beamtrace and run

import sys
sys.path.addpath('path/to/this/directory')
from beamtrace.tracer import BeamTrace

Docstring

From beamtrace/tracer.py, the main class BeamTrace docstring;

Class BeamTrace
For very simple beam waist and gouy phase calculations in python.
No fancy optimization like alamode, no nice GUI like jammt.
Just mirrors, lenses, and lengths added in sequence.

## Other options
MATLAB alamode: https://github.com/nicolassmith/alm
JAMMT: http://www.sr.bham.ac.uk/dokuwiki/doku.php?id=geosim:jammt
Finesse + pykat: https://git.ligo.org/finesse/pykat


## Process
User adds in mirrors, lenses, and spaces *in sequential order*.
User computes the cavity ABCD matrix from the components added using calculate_cavity_ABCD().
If cavity is stable, find the fundamental eigenmode for the beam (q-parameter)
Set this q-parameter as q_input beam.
Scan the cavity beam parmater using scan_cavity().

## Quick tips
1. You *must* have a component between spaces, even if it is just a flat lens, flat mirror, or flat refraction element.
Trying to connect two spaces together directly will result in an error.

2. Refraction components only have an effect on the beam if there is a radius of curvature
to the dielectric surface.  To model a beam through flat dielectric, you must include 
a flat lens or flat refraction at the front and back surfaces of the dielectric.
See 
examples/flat_dielectric_beam_scan.py
or 
examples/curved_dielectric_beam_scan.py
in the beamtrace git repository.

## Examples
### Simple resonator
import numpy as np

my_cav = BeamTrace()        # initializes ABCD class
my_cav.add_mirror(1.0) # adds mirror with 1.0 meter radius of curvature at z=0.0 meters
my_cav.add_space(0.5)  # adds 0.5 meters of space to cavity
my_cav.add_mirror(1.0) # adds mirror with 1.0 meter radius of curvature at z=0.5 meters
my_cav.calculate_cavity_ABCD() # Finds the cavity round-trip ABCD matrix, tells you if it's stable.  If it is stable, populates the my_cav.q_input parameter
zz, ww, gouy, qq = my_cav.scan_cavity(round_trip=True) # Returns propagation distance, beam radius, accumulated gouy phase, and beam q-parameter for the entire cavity, plus the round-trip

import matplotlib.pyplot as plt
fig = my_cav.plot_cavity_scan(round_trip=True, label='Simple Cavity')
plt.show()

# LIGO arm cavity
R1 = 1934. # m
R2 = 2245. # m
L = 3994.469 # m
arm_cav = BeamTrace()

arm_cav.add_mirror(R1, name='ITMY')
arm_cav.add_space(L)
arm_cav.add_mirror(R2, name='ETMY')

fig = arm_cav.plot_cavity_scan(round_trip=True)
plt.show()

Simple ABCD matrix calculations

Space matrix, $L$ is the length of the space and $n$ is the index of refraction

$S(L,n) = \begin{bmatrix} 1 & \frac{L}{n} \\ 0 & 1 \end{bmatrix} $

Lens, $f$ is the focal length

$L(f) = \begin{bmatrix} 1 & 0 \\ -\frac{1}{f} & 1 \end{bmatrix} $

Mirror, $R$ is the radius of curvature with index of refraction $n$, same as lens with $f = RoC/2$

$M(R) = \begin{bmatrix} 1 & 0 \\ -\frac{2 n}{R} & 1 \end{bmatrix} $

Refraction through a surface with radius of curvature $R$, initial index of refraction $n1$, and final index of refraction $n2$:

$F(R, n1, n2) = \begin{bmatrix} 1 & 0 \\ \frac{n2 - n1}{n2 R} & \frac{n1}{n2} \end{bmatrix} $

Refraction does not need to be considered for flat interfaces if you include the index of refraction in the space matrix $S(L,n)$ above:

$S(L,n2) = F(inf, n2, 1.0) S(L, 1.0) F(inf, 1, n2)$

Other Options:

Finesse + pykat

MATLAB alamode

JAMMT

References:

Kogelnik and Li

Koji Arai on beam prop

Wikipedia with ABCD matrices

Stefan SRC gouy phase meas

Simple ABCD matrix derivations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

beamtrace-0.0.14-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file beamtrace-0.0.14-py3-none-any.whl.

File metadata

  • Download URL: beamtrace-0.0.14-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.9

File hashes

Hashes for beamtrace-0.0.14-py3-none-any.whl
Algorithm Hash digest
SHA256 5db766b1d0f4b7c5e0ee4394d211f49967aa925952ca0e882d143a954be631ba
MD5 87e21701830fff479c26fa1998bf9dc1
BLAKE2b-256 7fffa99efee5e7a514245a7cb7e10d51d034e372f6785a73e4708f3ba23592fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page