Skip to content

Commit

Permalink
fix a second test
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Jun 12, 2022
1 parent d3b09a1 commit 3f69c11
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions spectral_cube/tests/test_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,19 @@ def test_spectral_smooth_4cores(data_522_delta):

cube, data = cube_and_raw(data_522_delta, use_dask=False)

result = cube.spectral_smooth(kernel=convolution.Gaussian1DKernel(1.0), num_cores=4, use_memmap=True)
kernel = convolution.Gaussian1DKernel(1.0)
result = cube.spectral_smooth(kernel=kernel, num_cores=4, use_memmap=True)

assert kernel.array.size == 9
np.testing.assert_almost_equal(result[:,0,0].value,
convolution.Gaussian1DKernel(1.0,
x_size=5).array,
kernel.array[2:-2],
4)

# this is one way to test non-parallel mode
result = cube.spectral_smooth(kernel=convolution.Gaussian1DKernel(1.0), num_cores=4, use_memmap=False)
result = cube.spectral_smooth(kernel=kernel, num_cores=4, use_memmap=False)

np.testing.assert_almost_equal(result[:,0,0].value,
convolution.Gaussian1DKernel(1.0,
x_size=5).array,
kernel.array[2:-2],
4)

# num_cores = 4 is a contradiction with parallel=False, so we want to make
Expand All @@ -205,12 +205,11 @@ def test_spectral_smooth_4cores(data_522_delta):
"multiple cores were: these are incompatible "
"options. Either specify num_cores=1 or "
"parallel=True")):
result = cube.spectral_smooth(kernel=convolution.Gaussian1DKernel(1.0),
result = cube.spectral_smooth(kernel=kernel,
num_cores=4, parallel=False)

np.testing.assert_almost_equal(result[:,0,0].value,
convolution.Gaussian1DKernel(1.0,
x_size=5).array,
kernel.array[2:-2],
4)


Expand Down

0 comments on commit 3f69c11

Please sign in to comment.