code: def downsample(data, n, axis=0):
      """Downsample by averaging points together across axis.
      If multiple axes are specified, runs once per axis.
      """
      if hasattr(axis, "__len__"):
          if not hasattr(n, "__len__"):
              n = [n] * len(axis)
          for i in range(len(axis)):
              data = downsample(data, n[i], axis[i])
          return data
  
      if n <= 1:
          return data
      nPts = int(data.shape[axis] / n)
      s = list(data.shape)
      s[axis] = nPts
      s.insert(axis + 1, n)
      sl = [slice(None)] * data.ndim
      sl[axis] = slice(0, nPts * n)
      d1 = data[tuple(sl)]
      d1.shape = tuple(s)
      d2 = d1.mean(axis + 1)
  
      return d2
  
imports: import time
  import os
  import sys
  import inspect
  import base64
  from subprocess import check_call, CalledProcessError
  import numpy
  from http.client import HTTPConnection
  from urllib.parse import urlencode
  from ..None import scene, config
  from ..io import read_png, write_png
  from ..gloo.util import _screenshot
  from ..util import run_subprocess
  from .None import IS_CI
label_desc: Use image node_id 7 for calling a global function with example usage: downsample(data, n, axis) and returns: d2, data, data