code: def _dhtm(mag):
      """Compute the modified 1D discrete Hilbert transform
  
      Parameters
      ----------
      mag : ndarray
          The magnitude spectrum. Should be 1D with an even length, and
          preferably a fast length for FFT/IFFT.
      """
      # Adapted based on code by Niranjan Damera-Venkata,
      # Brian L. Evans and Shawn R. McCaslin (see refs for `minimum_phase`)
      sig = np.zeros(len(mag))
      # Leave Nyquist and DC at 0, knowing np.abs(fftfreq(N)[midpt]) == 0.5
      midpt = len(mag) // 2
      sig[1:midpt] = 1
      sig[midpt + 1 :] = -1
      # eventually if we want to support complex filters, we will need a
      # np.abs() on the mag inside the log, and should remove the .real
      recon = ifft(mag * np.exp(fft(sig * ifft(np.log(mag))))).real
      return recon
  
file_path: catboost/contrib/python/scipy/py2/scipy/signal/fir_filter_design.py
imports: from __future__ import division, print_function, absolute_import
  from math import ceil, log
  import warnings
  import numpy
  from numpy.fft import irfft, fft, ifft
  from scipy.special import sinc
  from scipy.linalg import toeplitz, hankel, pinv
  from scipy._lib.six import string_types
  from .None import sigtools
label_desc: Use image node_id 9 for calling a global function with example usage: _dhtm(mag) and returns: recon