Skip to content

odak.wave.add_random_phase

Definition for adding a random phase to a given complex field.

Parameters:

Name Type Description Default
field np.complex64

Complex field.

required

Returns:

Type Description
np.complex64

Complex field.

Source code in odak/wave/__init__.py
def add_random_phase(field):
    """
    Definition for adding a random phase to a given complex field.

    Parameters
    ----------
    field        : np.complex64
                   Complex field.

    Returns
    -------
    new_field    : np.complex64
                   Complex field.
    """
    random_phase = np.pi*np.random.random(field.shape)
    new_field = add_phase(field, random_phase)
    return new_field

See also