Skip to content

odak.wave.calculate_phase

Definition to calculate phase of a single or multiple given electric field(s).

Parameters:

Name Type Description Default
field ndarray.complex or complex

Electric fields or an electric field.

required
deg bool

If set True, the angles will be returned in degrees.

False

Returns:

Type Description
float

Phase or phases of electric field(s) in radians.

Source code in odak/wave/utils.py
def calculate_phase(field, deg=False):
    """ 
    Definition to calculate phase of a single or multiple given electric field(s).

    Parameters
    ----------
    field        : ndarray.complex or complex
                   Electric fields or an electric field.
    deg          : bool
                   If set True, the angles will be returned in degrees.

    Returns
    -------
    phase        : float
                   Phase or phases of electric field(s) in radians.
    """
    phase = np.angle(field)
    if deg == True:
        phase *= 180./np.pi
    return phase

See also