Utilities reference

The mwave.utils subpackage provides helper modules for unit conversions and simulation setup.

Cloud module

The mwave.utils.cloud module provides helpers for initializing atom clouds and computing interferometer observables.

mwave.utils.cloud.cloud_init(natoms, sigma_cloud, sigma_transverse_v, sigma_vertical_v, x_offset=0, y_offset=0, z_offset=0, vx_offset=0, vy_offset=0, vz_offset=0, seed=None)

Basic cloud initialization. For more complicated atom clouds (i.e. clouds where positions/velocities are correlated with each other), the user should write their own initialization function.

Parameters:
  • natoms – The number of atoms to initialize.

  • sigma_cloud – The standard deviation of atom position within the cloud. The user can either provide a single number (in which case the standard deviation is the same in all directions), or three numbers (in which case the standard deviation is defined as sigma_cloud=(sigma_x, sigma_y, sigma_z)).

  • sigma_transverse_v – The standard deviation of atom velocity within the cloud. The user can either provide a single number (in which case the standard deviation is same in both transverse directions), or two numbers (in which case the standard deviation is defined as sigma_transverse_v=(sigma_x, sigma_y)).

  • sigma_vertical_v – The standard deviation of atom velocity with the vertical direction of the cloud.

  • x_offset – The offset of the cloud from \(x=0\).

  • y_offset – The offset of the cloud from \(y=0\).

  • z_offset – The offset of the cloud from \(z=0\).

  • vx_offset – The offset of the cloud velocity from \(v_x=0\).

  • vy_offset – The offset of the cloud velocity from \(v_y=0\).

  • vz_offset – The offset of the cloud velocity from \(v_z=0\).

  • seed – The seed to use when drawing the positions and velocities. If this function is called within an optimization loop the seed should remain the same across function calls!

Returns:

A tuple of (x0, y0, z0, vz, vx, vy), where each element of the tuple is a numpy array of length natoms.

Units module

The mwave.utils.units module defines the Cs-133 D2-line recoil unit system and provides functions for converting between SI and recoil units.

class mwave.utils.units.RecoilUnits(omega_r=12982.94580022518, v_r=0.0035225)

Converts between SI units and the single-photon recoil unit system for Cs-133 on the D2 line. Time is in units of \(1/\omega_r\), length in \(v_r/\omega_r\), and velocity in \(v_r\).

Parameters:
  • omega_r – Recoil angular frequency in rad/s. Defaults to the Cs-133 D2 value.

  • v_r – Recoil velocity in m/s. Defaults to the Cs-133 D2 value.

Example

>>> from mwave.utils.units import recoil
>>> recoil.time(4.5e-3)        # 4.5 ms interrogation time to recoil units
58.4232561010133
>>> recoil.length(6.2e-3)      # 6.2 mm beam waist to recoil units
22851.45889606703
>>> recoil.velocity(299792458) # speed of light to recoil units
85107866004.25833
>>> recoil.time(58.4232561010133, inverse=True)  # back to SI seconds
0.0045
angular_frequency(value, inverse=False)

Convert angular frequency between SI rad/s and recoil units.

Parameters:
  • value – The value to convert.

  • inverse – If True, convert from recoil units to SI. Defaults to False.

Returns:

The converted value.

frequency(value, inverse=False)

Convert frequency between SI Hz and recoil units.

Parameters:
  • value – The value to convert.

  • inverse – If True, convert from recoil units to SI. Defaults to False.

Returns:

The converted value.

length(value, inverse=False)

Convert length between SI metres and recoil units.

Parameters:
  • value – The value to convert.

  • inverse – If True, convert from recoil units to SI. Defaults to False.

Returns:

The converted value.

time(value, inverse=False)

Convert time between SI seconds and recoil units.

Parameters:
  • value – The value to convert.

  • inverse – If True, convert from recoil units to SI. Defaults to False.

Returns:

The converted value.

velocity(value, inverse=False)

Convert velocity between SI m/s and recoil units.

Parameters:
  • value – The value to convert.

  • inverse – If True, convert from recoil units to SI. Defaults to False.

Returns:

The converted value.