code: def mass(query, ts):
      """
      Calculates Mueen's ultra-fast Algorithm for Similarity Search (MASS): a Euclidian distance similarity search algorithm. Note that we are returning the square of MASS.
  
      Parameters
      ----------
      :query: Time series snippet to evaluate. Note that the query does not have to be a subset of ts.
      :ts: Time series to compare against query.
      """
  
      # query_normalized = zNormalize(np.copy(query))
      m = len(query)
      q_mean = np.mean(query)
      q_std = np.std(query)
      mean, std = movmeanstd(ts, m)
      dot = slidingDotProduct(query, ts)
  
      # res = np.sqrt(2*m*(1-(dot-m*mean*q_mean)/(m*std*q_std)))
      res = 2 * m * (1 - (dot - m * mean * q_mean) / (m * std * q_std))
  
      return res
  
file_path: matrixprofile-ts/matrixprofile/utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import numpy
  import numpy.fft
label_desc: Use image node_id 7 for calling a global function with example usage: mass(query, ts) and returns: res