#NEWLINE# def _my_hilbert( x , n_fft = None , envelope = False ) : #NEWLINE# #INDENT# ' Compute Hilbert transform of signals w/ zero padding.\n\n    Parameters\n    ----------\n    x : array, shape (n_times)\n        The signal to convert\n    n_fft : int, length > x.shape[-1] | None\n        How much to pad the signal before Hilbert transform.\n        Note that signal will then be cut back to original length.\n    envelope : bool\n        Whether to compute amplitude of the hilbert transform in order\n        to return the signal envelope.\n\n    Returns\n    -------\n    out : array, shape (n_times)\n        The hilbert transform of the signal, or the envelope.\n    ' #NEWLINE# from scipy.signal import hilbert #NEWLINE# n_fft = ( x . shape [ ( - 1 ) ] if ( n_fft is None ) else n_fft ) #NEWLINE# n_x = x . shape [ ( - 1 ) ] #NEWLINE# out = hilbert ( x , N = n_fft ) [ : n_x ] #NEWLINE# if ( envelope is True ) : #NEWLINE# #INDENT# out = np . abs ( out ) #NEWLINE# #UNINDENT# return out