Skip to content

odak.wave.set_amplitude

Definition to keep phase as is and change the amplitude of a given field.

Parameters:

Name Type Description Default
field np.complex64

Complex field.

required
amplitude np.array or np.complex64

Amplitudes.

required

Returns:

Type Description
np.complex64

Complex field.

Source code in odak/wave/__init__.py
def set_amplitude(field, amplitude):
    """
    Definition to keep phase as is and change the amplitude of a given field.

    Parameters
    ----------
    field        : np.complex64
                   Complex field.
    amplitude    : np.array or np.complex64
                   Amplitudes.

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

See also