# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/pl.ipynb.

# %% auto 0
__all__ = ['emi']

# %% ../nbs/API/pl.ipynb 5
import cupy as cp

# %% ../nbs/API/pl.ipynb 6
def emi(coh:cp.ndarray, #coherence ,dtype cupy.complex
       )-> cp.ndarray: # estimated phase history `ph`, dtype complex
    coh_mag = abs(coh)
    coh_mag_inv = cp.linalg.inv(coh_mag)
    min_eig = cp.linalg.eigh(coh_mag_inv*coh)[1][...,0]
    return min_eig/abs(min_eig)
