code: def test_receptive_field_1d(n_jobs):
      """Test that the fast solving works like Ridge."""
      pytest.importorskip("sklearn")
      from sklearn.linear_model import Ridge
  
      rng = np.random.RandomState(0)
      x = rng.randn(500, 1)
      for delay in range(-2, 3):
          y = np.zeros(500)
          slims = [(-2, 4)]
          if delay == 0:
              y[:] = x[:, 0]
          elif delay < 0:
              y[:delay] = x[-delay:, 0]
              slims += [(-4, -1)]
          else:
              y[delay:] = x[:-delay, 0]
              slims += [(1, 2)]
          for ndim in (1, 2):
              y.shape = (y.shape[0],) + (1,) * (ndim - 1)
              for slim in slims:
                  smin, smax = slim
                  lap = TimeDelayingRidge(
                      smin,
                      smax,
                      1.0,
                      0.1,
                      "laplacian",
                      fit_intercept=False,
                      n_jobs=n_jobs,
                  )
                  for estimator in (
                      Ridge(alpha=0.0),
                      Ridge(alpha=0.1),
                      0.0,
                      0.1,
                      lap,
                  ):
                      for offset in (-100, 0, 100):
                          model = ReceptiveField(
                              smin,
                              smax,
                              1.0,
                              estimator=estimator,
                              n_jobs=n_jobs,
                          )
                          use_x = x + offset
                          model.fit(use_x, y)
                          if estimator is lap:
                              continue  # these checks are too stringent
                          assert_allclose(
                              model.estimator_.intercept_,
                              -offset,
                              atol=1e-1,
                          )
                          assert_array_equal(
                              model.delays_, np.arange(smin, smax + 1)
                          )
                          expected = (model.delays_ == delay).astype(
                              float
                          )
                          expected = expected[np.newaxis]  # features
                          if y.ndim == 2:
                              expected = expected[np.newaxis]  # outputs
                          assert_equal(model.coef_.ndim, ndim + 1)
                          assert_allclose(
                              model.coef_, expected, atol=1e-3
                          )
                          start = model.valid_samples_.start or 0
                          stop = len(use_x) - (
                              model.valid_samples_.stop or 0
                          )
                          assert stop - start >= 495
                          assert_allclose(
                              model.predict(use_x)[
                                  model.valid_samples_
                              ],
                              y[model.valid_samples_],
                              atol=1e-2,
                          )
                          score = np.mean(model.score(use_x, y))
                          assert score > 0.9999
  
imports: from pathlib import Path
  import numpy
  import pytest
  from numpy import einsum
  from numpy.fft import irfft, rfft
  from numpy.testing import assert_allclose, assert_array_equal, assert_equal
  from mne.decoding import ReceptiveField, TimeDelayingRidge
  from mne.decoding.receptive_field import _SCORERS, _delay_time_series, _delays_to_slice, _times_to_delays
  from mne.decoding.time_delaying_ridge import _compute_corrs, _compute_reg_neighbors
label_desc: Use image node_id 6 for calling a global function with example usage: test_receptive_field_1d(n_jobs) without return types