code: def test_laplacian_accuracy_fourier_series(
      filename,
      make_plot=False,
  ):
      # Load data in a ditionary
      test_data = load_test_data(filename)
  
      # Making fields
      domain = Domain(test_data["x"].shape, test_data["step_size"])
      x = FourierSeries.from_grid(test_data["x"], domain)
  
      # Getting gradient
      y_pred = laplacian(x)
  
      # Checking if similar
      if len(test_data["y"].shape) == len(x.domain.N):
          y = jnp.expand_dims(test_data["y"], -1)
      else:
          y = test_data["y"]
      norm = jnp.linalg.norm(y)
      relErr = jnp.amax(jnp.abs(y_pred.on_grid - y)) / norm
  
      # Check that the maximum error is smaller than 0.01%
      print("\n|")
      print("- Size: ", y.shape)
      print("- Stepsize: ", test_data["step_size"])
      print("- Complex: ", test_data["is_complex"])
      print("- Relative max error = ", 100 * relErr, "%")
  
      # Plot fft of the two signals
      if make_plot:
          from matplotlib import pyplot as plt
  
          if len(test_data["step_size"]) == 1:
              f1 = jnp.fft.fftn(y[..., 0])
              f2 = jnp.fft.fftn(y_pred.on_grid[..., 0])
              plt.plot(y[..., 0], marker="o")
              plt.plot(y_pred.on_grid[..., 0], marker="o")
              plt.legend()
              plt.savefig(TEST_DATA_PATH + "/last_test.png")
              plt.close()
  
              plt.plot(f1, label="true spectrum", marker="o")
              plt.plot(f2, label="predicted spectrum", marker="o")
              plt.legend()
              plt.savefig(TEST_DATA_PATH + "/last_test_spect.png")
              plt.close()
  
      assert relErr < 1e-4
  
file_path: jaxdf/tests/test_laplacian_accuracy.py
imports: import json
  import os
  from typing import List
  import numpy
  import pytest
  from jax import numpy
  from jaxdf import FourierSeries
  from jaxdf.geometry import Domain
  from jaxdf.operators import laplacian
label_desc: Use image node_id 3 for calling a global function with example usage: test_laplacian_accuracy_fourier_series(filename, make_plot) without return types