code: def calc_distance_profile(X, y, n, m, meanx, sigmax):
      # reverse the query
      y = np.flip(y, 0)
  
      # make y same size as ts with zero fill
      y = np.concatenate([y, np.zeros(n - m)])
  
      # main trick of getting dot product in O(n log n) time
      Y = np.fft.fft(y)
      Z = X * Y
      z = np.fft.ifft(Z)
  
      # compute y stats in O(n)
      sumy = np.sum(y)
      sumy2 = np.sum(np.power(y, 2))
      meany = sumy / m
      sigmay2 = sumy2 / m - meany**2
      sigmay = np.sqrt(sigmay2)
  
      dist = (z[m - 1 : n] - m * meanx * meany) / (sigmax * sigmay)
      dist = m - dist
      dist = np.real(2 * dist)
  
      return np.sqrt(np.absolute(dist))
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import math
  import time
  import warnings
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: calc_distance_profile(X, y, n, m, meanx, sigmax) and returns: np