API / Code Reference
Python package for simulating light-pulse atom interferometers.
Submodules
aisim.atoms module
Classes and functions related to the atomic cloud.
- class aisim.atoms.AtomicEnsemble(phase_space_vectors, state_kets=[1, 0], time=0)
Bases:
objectRepresents an atomic ensemble consisting of n atoms.
Each atom is is defined by its phase space vector (x0, y0, z0, vx, vy, vz) at time t=0. From this phase space vector the position at later times can be calculated.
- Parameters:
phase_space_vectors (ndarray) – n × 6 dimensional array representing the phase space vectors (x0, y0, z0, vx, vy, vz) of the atoms in an atomic ensemble
state_kets (m × 1 or n × m x 1 array or list, optional) – vector(s) representing the m internal degrees of freedom of the atoms. If the list or array is one-dimensional, all atoms are initialized in the same internal state. Alternatively, each atom can be initialized with a different state vector by passing an array of state vectors for every atom. E.g. to initialize all atoms in the ground state of a two-level system, pass [1, 0] which is the default.
time (float, optional) – the initial time (default 0) when the phase space and state vectors are initialized
- phase_space_vectors
n × 6 dimensional array representing the phase space vectors (x0, y0, z0, vx, vy, vz) of the atoms in an atomic ensemble
- Type:
ndarray
- position
- velocity
- state_kets
- state_bras
- density_matrices
- density_matrix
- calc_position(t)
Calculate the positions (x, y, z) of the atoms after propagation.
- Parameters:
t (float) – time when the positions should be calculated
- Returns:
pos – n × 3 dimensional array of the positions (x, y, z)
- Return type:
array
- property density_matrices
Density matrix of the m level system of the n atoms.
These are pure states.
- Type:
(n × m x m) array
- property density_matrix
Density matrix of the ensemble’s m level system.
- Type:
(m x m) array
- fidelity(rho_target)
Calculate fidelity of ensemble’s density matrix and target matrix [1].
- Parameters:
rho_target (array) – target density matrix as m x m array
- Returns:
fidelity – fidelity of AtomicEnsemble’s compared to target density matrix
- Return type:
float
References
[1] https://en.wikipedia.org/wiki/Fidelity_of_quantum_states
- property position
Positions (x, y, z) of the atoms in the ensemble.
- Type:
(n × 3) array
- property state_bras
The bra vectors of the m level system.
- Type:
(n × 1 x m) array
- property state_kets
The ket vectors of the m level system.
- Type:
(n × m x 1) array
- state_occupation(state)
Calculate the state population of each atom in the ensemble.
- Parameters:
state (int or list_like) – Specifies which state population should be calculated. E.g. the excited state of a two-level system can be calculated by passing either 1 or [0, 1].
- Returns:
occupation – n dimensional array of the state population of each of the n atom
- Return type:
array
- property time
Time changes when propagating the atomic ensemble.
- Type:
float
- property velocity
Velocities of the atoms in the ensemble.
- Type:
array
- aisim.atoms.create_random_ensemble_from_gaussian_distribution(pos_params, vel_params, n_samples, seed=None, **kwargs)
Random atomic ensemble from normal position and velocity distributions.
- Parameters:
pos_params (dict) – Dictionary containing the parameters determining the position and velocity distributions of the atomic ensemble. Entries for position space are ‘mean_x’, ‘std_x’ ,’mean_y’, ‘std_y’, ‘mean_z’, ‘std_z’. Entries for velocity space are ‘mean_vx’,’std_vx’, ‘mean_vy’, ‘std_vy’,’mean_vz’, ‘std_vz’.
vel_params (dict) – Dictionary containing the parameters determining the position and velocity distributions of the atomic ensemble. Entries for position space are ‘mean_x’, ‘std_x’ ,’mean_y’, ‘std_y’, ‘mean_z’, ‘std_z’. Entries for velocity space are ‘mean_vx’,’std_vx’, ‘mean_vy’, ‘std_vy’,’mean_vz’, ‘std_vz’.
n_samples (float) – number of random samples
seed (int or 1-d array_like, optional) – Set the seed of the random number generator to get predictable samples. If set, this number is passed to numpy.random.seed.
**kwargs – Optional keyworded arguments passed to AtomicEnsemble
- Returns:
ensemble – Atomic ensemble containing the generated phase space vectors.
- Return type:
aisim.beam module
Classes and functions related to the interferometry lasers.
- class aisim.beam.IntensityProfile(r_profile, center_rabi_freq, r_beam=None)
Bases:
objectClass that defines a Gaussian intensity profile in terms of the Rabi frequency.
- Parameters:
r_profile (float) – 1/e² radius of the Gaussian intensity profile in m
center_rabi_freq (float) – Rabi frequency at center of intensity profile in rad/s
r_beam (float (optional)) – Beam radius in m. Can be set if the intensity profile is limited by an aperture. Rabi frequency will be set to 0 outside of the beam.
- r_profile
1/e² radius of the Gaussian intensity profile in m
- Type:
float
- center_rabi_freq
Rabi frequency at center of intensity profile in rad/s
- Type:
float
- r_beam
Beam radius in m. If set, Rabi frequency will be set to 0 outside of the beam.
- Type:
float or None
- get_rabi_freq(pos)
Rabi frequency at a position of a Gaussian beam.
- Parameters:
pos ((n × 2) array or (n × 3) array) – positions of the n atoms in two or three dimensions (x, y, [z]).
- Returns:
rabi_freqs – the Rabi frequencies for the n positions. If
r_beamis set, the Rabi frequency will be set to 0 outside of the beam.- Return type:
array of float
- class aisim.beam.Wavefront(r_wf, coeff, r_beam=None)
Bases:
objectClass that defines a wavefront.
- Parameters:
r_wf (float) – radius of the wavefront data in m
coeff (list of float) – list of 36 Zernike coefficients in multiples of the wavelength
r_beam (float (optional)) – Beam radius in m. Can be set if the beam is smaller than the wavefront data. Values outside of the beam will be set to NaN.
- r_wf
radius of the wavefront data in m
- Type:
float
- coeff
list of 36 Zernike coefficients in multiples of the wavelength
- Type:
list of float
- r_beam
Beam radius in m. If set, values outside of the beam will be set to NaN.
- Type:
float or None
- get_value(pos)
Get the wavefront at a position.
- Parameters:
pos (n × 3 array) – array of position vectors (x, y, z) where the wavefront is probed
- Returns:
wf – The value of the wavefront at the positions
- Return type:
nd array
- plot(ax=None)
Plot the wavefront data.
- Parameters:
ax (Axis , optional) – If axis is provided, they will be used for the plot. if not provided, a new plot will automatically be created.
- plot_coeff(ax=None)
Plot the coefficients as a bar chart.
- Parameters:
ax (Axis , optional) – If axis is provided, they will be used for the plot. if not provided, a new plot will automatically be created.
- static zern_iso(rho, theta, coeff, r_wf)
Calculate the sum of the first 36 Zernike polynomials.
Based on ISO24157:2008.
- Parameters:
rho (float or array of float) – Polar coordinates of the position where the sum of Zernike polynomials should be calculated.
theta (float or array of float) – Polar coordinates of the position where the sum of Zernike polynomials should be calculated.
coeff (array) – first 36 Zernike coefficients
r_beam (float) – radius of the wavefront
- Returns:
values – value(s) of the wavefront at the probed position
- Return type:
float or array of float
- class aisim.beam.Wavevectors(k1=8055366, k2=-8055366)
Bases:
objectClass that defines the wave vectors of the two Ramen beams.
- Parameters:
k1 (float) – 1D wave vectors (wavenumber) in z-direction of the two Raman beams in rad/m, defaults to 2*pi/780e-9
k2 (float) – 1D wave vectors (wavenumber) in z-direction of the two Raman beams in rad/m, defaults to 2*pi/780e-9
- k1, k2
1D wave vectors (wavenumber) in z-direction of the two Raman beams in rad/m
- Type:
float
- doppler_shift(atoms)
Calculate the Doppler shifts for an atomic ensemble.
- Parameters:
atoms (AtomicEnsemble) – an atomic enemble with a finite velocity in the z direction
- Returns:
dopler_shift – Doppler shift of each atom in the ensemble in rad/s
- Return type:
1d array
- aisim.beam.gen_wavefront(r_wf, std=0, r_beam=None)
Create an artificial wavefront.
- Parameters:
r_wf (float) – radius of the wavefront data in m
std (float) – standard deviation of each Zernike polynomial coefficient in multiples of the wavelength.
r_beam (float, optional) – Beam radius in m. Can be set if the beam is smaller than the wavefront data. Values outside of the beam will be set to NaN.
- Returns:
wf – artificial wavefront
- Return type:
aisim.convert module
Functions to convert various quantities.
- aisim.convert.arrival_time(z, t0=0.0, z0=0.0, v0=0.0, g=9.80665)
Calculate time when the atomic ensemble reaches a certaini position.
- Parameters:
z (float) – position in m
t0 (float) – time reference in s (at which z0 and v0 are known)
z0 (float) – initial position and velocity (in m and m/s, respectively), i.e. position and velocity at t_ref
v0 (float) – initial position and velocity (in m and m/s, respectively), i.e. position and velocity at t_ref
g (float) – gravitational acceleration in m/s**2
- Returns:
t – The two times when atoms reach the position z in seconds.
- Return type:
list of float
- aisim.convert.cart2pol(cart)
Convert vectors in cartesian coordinates to polar coordinates.
- Parameters:
cart (n × 3 array) – array of n vectors in cartesian coordinates (x, y, z)
- Returns:
pol – array of n vectors in polar coordinates (rho, theta, z)
- Return type:
n × 3 array
- aisim.convert.kb = 1.3806488e-23
Boltzmann constant in J/K.
- aisim.convert.mass = {'Rb87': 1.443161e-25}
Atomic mass in kg.
- aisim.convert.phase_error_to_grav(phase, T, keff)
Convert a phase error to gravitational acceleration.
Takes the phase shift measured in a Mach Zehnder atom interferometer and converts it to the corresponding gravitional accleration.
- Parameters:
phase (float) – Interferometer phase in rad
T (float) – interferometer time in s
keff (float) – effective wavenumber in rad/m
- Returns:
gravitational acceleration in in m/s^2
- Return type:
float
- aisim.convert.pol2cart(pol)
Convert vectors in polar coordinates to cartesian coordinates.
- Parameters:
pol (n × 3 array) – array of n vectors in polar coordinates (rho, theta, z)
- Returns:
cart – array of n vectors in cartesian coordinates (x, y, z)
- Return type:
n × 3 array
- aisim.convert.temp(sigma_v, species='Rb87')
Calculate the temperature of an atomic cloud from its velocity spread.
- Parameters:
sigma_v (float) – velocity spread (1 sigma) in meters per second
species (str) – the atomic species, has to be a key in mass
- Returns:
temp – temperature of the cloud in Kelvin
- Return type:
float
- Raises:
ValueError – If negative velocity spread is passed
- aisim.convert.vel_from_temp(temp, species='Rb87')
Calculate the velocity spread (1 sigma) from the temperature of the cloud.
- Parameters:
temp (float) – temperature of the cloud in Kelvin
species (str) – the atomic species, has to be a key in mass
- Returns:
vel – velocity spread (1 sigma)
- Return type:
float
- Raises:
ValueError – If negative temperature is passed
aisim.det module
Classes and functions related to the detection system.
- class aisim.det.Detector(t_det, **kwargs)
Bases:
objectA generic detection zone.
This is only a template without functionality. Deriving classes have to implement _detected_idx.
- Parameters:
t_det (float) – time of the detection
**kwargs – Additional arguments used by classes that inherit from this class. All keyworded arguments are stored as attribues.
- t_det
time of the detection
- Type:
float
- \*\* kwargs
all keyworded arguments that are passed upon creation
- detected_atoms(atoms)
Determine wheter a position is within the detection zone.
Returns a new AtomicEnsemble object containing only the detected phase space vectors.
- Parameters:
atoms (AtomicEnsemble) – the atomic ensemble
- Returns:
detected_atoms – atomic ensemble containing only phase space vectors that are eventually detected
- Return type:
- class aisim.det.PolarDetector(t_det, **kwargs)
Bases:
DetectorA spherical detection zone.
All atoms within a circle with the specified radius within the x-y plane will be detected.
- Parameters:
t_det (float) – time of the detection
r_det – radius of the spherical detection zone
- t_det
time of the detection
- Type:
float
- \*\* kwargs
all keyworded arguments that are passed upon creation
- class aisim.det.SphericalDetector(t_det, **kwargs)
Bases:
DetectorA spherical detection zone.
All atoms within a sphere of the specified radius will be detected.
- Parameters:
t_det (float) – time of the detection
r_det – radius of the spherical detection zone
- t_det
time of the detection
- Type:
float
- \*\* kwargs
all keyworded arguments that are passed upon creation
aisim.prop module
Classes to propagate atomic ensembles.
- class aisim.prop.FreePropagator(time_delta, **kwargs)
Bases:
PropagatorPropagator implementing free propagation without light-matter interaction.
- Parameters:
time_delta (float) – time that should be propagated
- class aisim.prop.Propagator(time_delta, **kwargs)
Bases:
objectA generic propagator.
This is just a template class without an implemented propagation matrix.
- Parameters:
time_delta (float) – time that should be propagated
**kwargs – Additional arguments used by classes that inherit from this class. All keyworded arguments are stored as attribues.
- propagate(atoms)
Propagate an atomic ensemble.
- Parameters:
atoms (AtomicEnsemble) – atomic ensemble that should be is propagated
- class aisim.prop.SpatialSuperpositionTransitionPropagator(time_delta, intensity_profile, n_pulses, n_pulse, wave_vectors=None, wf=None, phase_scan=0)
Bases:
TwoLevelTransitionPropagatorAn effective Raman two-level system.
It is implemented as a time propagator as defined in [1]. In addition to class TwoLevelTransitionPropagator, this adds spatial superpositions in z-direction that occour at each pulse.
- Parameters:
time_delta (float) – length of pulse
intensity_profile (IntensityProfile) – Intensity profile of the interferometry lasers
wave_vectors (Wavevectors) – wave vectors of the two Raman beams for calculation of Doppler shifts
wf (Wavefront , optional) – wavefront aberrations of the interferometry beam
phase_scan (float) – effective phase for fringe scans
n_pulses (int) – overall number of intended light pulses in symmetric atom interferometry sequence. Each pulse adds two spatial eigenstates.
n_pulse (int) – number of light pulse of symmetric atom-interferometry sequence.
References
[1] Young, B. C., Kasevich, M., & Chu, S. (1997). Precision atom interferometry with light pulses. In P. R. Berman (Ed.), Atom Interferometry (pp. 363–406). Academic Press. https://doi.org/10.1016/B978-012092460-8/50010-2
- class aisim.prop.TwoLevelTransitionPropagator(time_delta, intensity_profile, wave_vectors=None, wf=None, phase_scan=0)
Bases:
PropagatorA time propagator of an effective Raman two-level system.
- Parameters:
time_delta (float) – length of pulse
intensity_profile (IntensityProfile) – Intensity profile of the interferometry lasers
wave_vectors (Wavevectors) – wave vectors of the two Raman beams for calculation of Doppler shifts
wf (Wavefront , optional) – wavefront aberrations of the interferometry beam
phase_scan (float) – effective phase for fringe scans
Notes
The propagator is for example defined in [1].
References
[1] Young, B. C., Kasevich, M., & Chu, S. (1997). Precision atom interferometry with light pulses. In P. R. Berman (Ed.), Atom Interferometry (pp. 363–406). Academic Press. https://doi.org/10.1016/B978-012092460-8/50010-2