code: def check_interpolateArray(order):
      pytest.importorskip("scipy")
  
      def interpolateArray(data, x):
          result = pg.interpolateArray(data, x, order=order)
          assert (
              result.shape == x.shape[:-1] + data.shape[x.shape[-1] :]
          )
          return result
  
      data = np.array(
          [[1.0, 2.0, 4.0], [10.0, 20.0, 40.0], [100.0, 200.0, 400.0]]
      )
  
      # test various x shapes
      interpolateArray(data, np.ones((1,)))
      interpolateArray(data, np.ones((2,)))
      interpolateArray(data, np.ones((1, 1)))
      interpolateArray(data, np.ones((1, 2)))
      interpolateArray(data, np.ones((5, 1)))
      interpolateArray(data, np.ones((5, 2)))
      interpolateArray(data, np.ones((5, 5, 1)))
      interpolateArray(data, np.ones((5, 5, 2)))
      with pytest.raises(TypeError):
          interpolateArray(data, np.ones((3,)))
      with pytest.raises(TypeError):
          interpolateArray(
              data,
              np.ones(
                  (
                      1,
                      3,
                  )
              ),
          )
      with pytest.raises(TypeError):
          interpolateArray(
              data,
              np.ones(
                  (
                      5,
                      5,
                      3,
                  )
              ),
          )
  
      x = np.array(
          [
              [0.3, 0.6],
              [1.0, 1.0],
              [
                  0.501,
                  1.0,
              ],  # NOTE: testing at exactly 0.5 can yield different results from map_coordinates
              [0.501, 2.501],  # due to differences in rounding
              [10.0, 10.0],
          ]
      )
  
      result = interpolateArray(data, x)
      # make sure results match ndimage.map_coordinates
      import scipy.ndimage
  
      spresult = scipy.ndimage.map_coordinates(data, x.T, order=order)
      # spresult = np.array([  5.92,  20.  ,  11.  ,   0.  ,   0.  ])  # generated with the above line
  
      assert_array_almost_equal(result, spresult)
  
      # test mapping when x.shape[-1] < data.ndim
      x = np.array([[0.3, 0], [0.3, 1], [0.3, 2]])
      r1 = interpolateArray(data, x)
      x = np.array([0.3])  # should broadcast across axis 1
      r2 = interpolateArray(data, x)
  
      assert_array_almost_equal(r1, r2)
  
      # test mapping 2D array of locations
      x = np.array(
          [
              [[0.501, 0.501], [0.501, 1.0], [0.501, 1.501]],
              [[1.501, 0.501], [1.501, 1.0], [1.501, 1.501]],
          ]
      )
  
      r1 = interpolateArray(data, x)
      r2 = scipy.ndimage.map_coordinates(
          data, x.transpose(2, 0, 1), order=order
      )
      # r2 = np.array([[   8.25,   11.  ,   16.5 ],  # generated with the above line
      # [  82.5 ,  110.  ,  165.  ]])
  
      assert_array_almost_equal(r1, r2)
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal
  import pyqtgraph
  from pyqtgraph.functions import arrayToQPath, eq
  from pyqtgraph.Qt import QtGui
label_desc: Use image node_id 4 for calling a global function with example usage: check_interpolateArray(order) and returns: result