Skip to content

odak.wave.add_phase

Definition for adding a phase to a given complex field.

Parameters:

Name Type Description Default
field np.complex64

Complex field.

required
new_phase np.complex64

Complex phase.

required

Returns:

Type Description
np.complex64

Complex field.

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

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

    Returns
    -------
    new_field    : np.complex64
                   Complex field.
    """
    phase = calculate_phase(field)
    amplitude = calculate_amplitude(field)
    new_field = amplitude*np.cos(phase+new_phase) + \
        1j*amplitude*np.sin(phase+new_phase)
    return new_field

See also