Skip to content

odak.learn.wave.set_amplitude

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

Parameters:

Name Type Description Default
field torch.cfloat

Complex field.

required
amplitude torch.cfloat or torch.float

Amplitudes.

required

Returns:

Type Description
torch.cfloat

Complex field.

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

    Parameters
    ----------
    field        : torch.cfloat
                   Complex field.
    amplitude    : torch.cfloat or torch.float
                   Amplitudes.

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

Notes

Regarding usage of this definition, you can find use cases in the engineering notes, specifically at Optimizing holograms using Odak.

See also