code: def spectral_moments_helper(spec_func):
      for triplet in [(20, 1000, 1000)]:
          k, m, n = triplet
          min_dim = min(m, n)
          sigma = np.diag([spec_func(i + 1, k) for i in range(min_dim)])
          seed = 1025
          np.random.seed(seed)
          U = np.linalg.qr(np.random.normal(0, 1, (m, min_dim)))[0]
          V = np.linalg.qr(np.random.normal(0, 1, (n, min_dim)))[0]
          A = U @ sigma @ V.T
          mt_A = matrix_table_from_numpy(A)
  
          moments, stdevs = hl._spectral_moments(
              _make_tsm(mt_A.ent, 128), 7
          )
          true_moments = np.array(
              [np.sum(np.power(sigma, 2 * i)) for i in range(1, 8)]
          )
          np.testing.assert_allclose(moments, true_moments, rtol=2e-01)
  
imports: import math
  import pytest
  import numpy
  import hail
  from hail.methods.pca import _make_tsm
  from ..helpers import resource, fails_local_backend, skip_when_service_backend, test_timeout
label_desc: Use image node_id 18 for calling a global function with example usage: spectral_moments_helper(spec_func) without return types