code: def slope(points, num_points):
      # First point has no slope
      slope_at_point = [0]
      # Start computing slope with second point
      for i in range(1, len(points)):
          x, y = list(
              zip(*enumerate(points[max(i - num_points, 0) : i + 1]))
          )
          slope_at_point.append(np.polyfit(x, y, 1)[0])
      return slope_at_point
  
file_path: sockeye/sockeye_contrib/plot_metrics.py
imports: from argparse import ArgumentParser
  from bisect import insort
  from collections import defaultdict
  from os import path
  import matplotlib.pyplot
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: slope(points, num_points) and returns: slope_at_point