code: def test_chebyshev(barbell):
      """
      This test checks that the Chebyshev approximation accurately calculates the wavelets. It calculates
      the wavelets exactly using eigenvalues and compares this to the Chebyshev approximation.
      """
      scales = (1, 5, 10)
      sample_points = np.linspace(0, 100, 50).astype(np.float32)
      generator = GraphWaveGenerator(
          barbell,
          scales=scales,
          degree=50,
      )
  
      # calculate wavelets exactly using eigenvalues
      adj = np.asarray(barbell.to_adjacency_matrix().todense()).astype(
          np.float32
      )
  
      degree_mat = sps.diags(np.asarray(adj.sum(1)).ravel())
      laplacian = degree_mat - adj
  
      eigenvals, eigenvecs = np.linalg.eig(laplacian)
      eigenvecs = np.asarray(eigenvecs)
  
      psis = [
          eigenvecs.dot(np.diag(np.exp(-s * eigenvals))).dot(
              eigenvecs.transpose()
          )
          for s in scales
      ]
      psis = np.stack(psis, axis=1).astype(np.float32)
      ts = tf.convert_to_tensor(sample_points)
  
      expected_dataset = tf.data.Dataset.from_tensor_slices(psis).map(
          lambda x: _empirical_characteristic_function(x, ts),
      )
      expected_embeddings = _epoch_as_matrix(expected_dataset)
  
      actual_dataset = generator.flow(
          node_ids=barbell.nodes(),
          sample_points=sample_points,
          batch_size=1,
          repeat=False,
      )
      actual_embeddings = _epoch_as_matrix(actual_dataset)
  
      # compare exactly calculated wavelets to chebyshev
      np.testing.assert_allclose(
          actual_embeddings, expected_embeddings, rtol=1e-2
      )
  
file_path: stellargraph/tests/mapper/test_graphwave_generator.py
imports: from stellargraph.core.graph import *
  from stellargraph.mapper.graphwave_generator import GraphWaveGenerator, _empirical_characteristic_function
  from ..test_utils.graphs import barbell
  import numpy
  import pytest
  import scipy.sparse
  import tensorflow
label_desc: Use image node_id 12 for calling a global function with example usage: test_chebyshev(barbell) without return types