def _dhtm(mag):
 sig = np.zeros(len(mag))
 midpt = (len(mag) // 2)
 sig[1:midpt] = 1
 sig[(midpt + 1):] = (-1)
 recon = ifft((mag * np.exp(fft((sig * ifft(np.log(mag))))))).real
 return recon

def _dhtm ( mag ) : sig = np . zeros ( len ( mag ) ) midpt = ( len ( mag ) // 2 ) sig [ 1 : midpt ] = 1 sig [ ( midpt + 1 ) : ] = ( - 1 ) recon = ifft ( ( mag * np . exp ( fft ( ( sig * ifft ( np . log ( mag ) ) ) ) ) ) ) . real return recon
compute the modified 1d discrete hilbert transform parameters mag : ndarray the magnitude spectrum .