code: def calc_curlastz(ts, m, n, idx, profile_len, curlastz):
      curlastz[idx] = np.sum(ts[0:m] * ts[idx : idx + m])
  
      tmp_a = ts[m : n - idx]
      tmp_b = ts[idx + m : n]
      tmp_c = ts[0 : profile_len - idx - 1]
      tmp_d = ts[idx : profile_len - 1]
      tmp_e = tmp_a * tmp_b
      tmp_f = tmp_c * tmp_d
      curlastz[idx + 1 : profile_len] = curlastz[idx] + np.cumsum(
          tmp_e - tmp_f
      )
  
      return curlastz
  
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 20 for calling a global function with example usage: calc_curlastz(ts, m, n, idx, profile_len, curlastz) and returns: curlastz