Numeric reference

The mwave.numeric module provides a tree-based framework for numerically simulating atom interferometers. Unlike the symbolic module, which yields analytic phase expressions, this module propagates wavefunctions through the interferometer by applying user-supplied beamsplitter and free-evolution functions at each node. This makes it suitable for simulating realistic effects such as finite pulse duration, intensity inhomogeneity, and atom cloud dynamics.

NumericBraggInterferometer class

class mwave.numeric.NumericBraggInterferometer(kmin, kmax, distance, kpad=10, x0=0, t0=0, k0=0)

A class for numerically simulating Bragg interferometers. This class allows for the definition of an interferometer geometry and the numerical propagation of wavefunctions through that geometry. See Numeric interferometer usage for example usage.

compile(split_funcs, propagate_func, output_momentums, kvector_funcs=None, func_pop_init=None, func_wf_init=None, func_wf2_init=None, x_tolerance=None)

Compiles the interferometer into a single population-calculation function.

Split and propagate functions are provided separately and interleaved automatically to match the operation sequence.

Parameters:
  • split_funcs – A list of functions, one per split operation. Each takes (*comm_args, k_init, k_final, klattice, t, x).

  • propagate_func – A single function used for all propagation steps. Takes (*comm_args, t, k).

  • output_momentums – A list of output momentum values to compute populations for.

  • kvector_funcs – Optional. A list of functions, one per split operation. Each takes (*comm_args) and returns a scalar wavevector shift dk.

  • func_pop_init – Optional. A function that initializes the population accumulator. Takes (*comm_args). Defaults to np.zeros_like(comm_args[0]).

  • func_wf_init – Optional. A function that initializes the wavefunction amplitude. Takes (*comm_args). Defaults to np.ones_like(comm_args[0]).

  • func_wf2_init – Optional. A function that initializes the wavefunction accumulator. Takes (*comm_args). Defaults to np.zeros_like(comm_args[0]).

  • x_tolerance – Optional. If provided, nodes whose position differs from an existing bucket key by less than x_tolerance are grouped into that bucket rather than creating a new one. When multiple existing keys are within tolerance, the closest one is chosen. Note that bucket keys anchor to the position of the first node assigned to them, so the resulting grouping can depend on the order in which nodes are processed.

Returns:

A function calc_pops(momentum, comm_args) that computes the population at the given momentum.

Raises:

ValueError – If the number of split_funcs or kvector_funcs does not match the number of split operations, or if function signatures are inconsistent.

get_nodes(x_tolerance=None)

Returns a dictionary of nodes at the current level, organized by momentum and position.

Parameters:

x_tolerance – Optional. If provided, nodes whose position differs from an existing bucket key by less than x_tolerance are grouped into that bucket rather than creating a new one. When multiple existing keys are within tolerance, the closest one is chosen. Note that bucket keys anchor to the position of the first node assigned to them, so the resulting grouping can depend on the order in which nodes are processed.

Returns:

A dictionary where keys are momentum states, values are dictionaries of positions, and values of those dictionaries are lists of nodes at that momentum and position.

propagate(t)

Propagates the state of all nodes at the current level for a time t.

Parameters:

t – The duration of the propagation.

split(klattice)

Applies a Bragg diffraction splitting operation to all nodes at the current level.

Parameters:

klattice – The lattice wavevector(s) for the Bragg pulse. Can be a single value or a list of values.

NumericTreeNode class

class mwave.numeric.NumericTreeNode(interferometer, x, t, k, parent=None)

Basic implementation of a directed tree. Children are stored in a list.

Parameters:

parent_node – The parent node of the new node. Must be a TreeNode. Optional.

get_ancestry()

Returns a list of ancestor nodes from the root node to this node.

Returns:

A list of NumericTreeNode objects.

get_trajectory()

Returns the trajectory (time and position) of the node and its ancestors.

Returns:

A tuple (times, positions) containing lists of times and positions.

get_wf_func(func_init)

Returns a function that computes the wavefunction at this node by tracing back through its ancestry and applying the operation functions.

Parameters:

func_init – The function to compute the initial wavefunction.

Returns:

A function that computes the wavefunction.

propagate(T)

Propagates the node for a time T, creating a single child node.

Parameters:

T – The duration of propagation.

split(klattice, distance=4, filter_func=<function NumericTreeNode.<lambda>>)

Splits the node based on Bragg diffraction, creating child nodes for the diffracted states.

Parameters:
  • klattice – The lattice wavevector(s).

  • distance – The number of momentum states to keep around the diffraction orders. Defaults to 4.

  • filter_func – A function to filter which child nodes are created. Defaults to allowing all.