Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New test_downsampling failure #137

Closed
weaverba137 opened this issue May 15, 2024 · 1 comment
Closed

New test_downsampling failure #137

weaverba137 opened this issue May 15, 2024 · 1 comment

Comments

@weaverba137
Copy link
Member

While working on #136, most tests succeeded, but specsim.tests.test_camera.test_downsampling was one unexpected failure.

=================================== FAILURES ===================================
______________________________ test_downsampling _______________________________

    def test_downsampling():
        c = specsim.config.load_config('test')
        i = specsim.instrument.initialize(c)
        camera = i.cameras[0]
    
        # Use an intermediate dense matrix for downsampling.
        # This is the old implementation of get_output_resolution_matrix()
        # which uses too much memory.
        n = len(camera._output_wavelength)
        m = camera._downsampling
        i0 = camera.ccd_slice.start - camera.response_slice.start
        R1 = (camera._resolution_matrix[: n * m, i0 : i0 + n * m].toarray()
             .reshape(n, m, n, m).sum(axis=3).sum(axis=1) / float(m))
    
        # Use the new sparse implementation of get_output_resolution_matrix().
        R2 = camera.get_output_resolution_matrix()
    
>       assert np.allclose(R1, R2.toarray())
E       AssertionError: assert False
E        +  where False = <function allclose at 0x7f5074f20ee0>(array([[0.6386939 , 0.17828141, 0.00237037, ..., 0.        , 0.        ,\n        0.        ],\n       [0.17828141, 0.63...9 ,\n        0.17828141],\n       [0.        , 0.        , 0.        , ..., 0.0023727 , 0.17828141,\n        0.6386939 ]]), array([[7.21582136e-01, 1.38638623e-01, 5.69036350e-04, ...,\n        0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n...\n       [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,\n        5.71582129e-04, 1.38638623e-01, 7.21582136e-01]]))
E        +    where <function allclose at 0x7f5074f20ee0> = np.allclose
E        +    and   array([[7.21582136e-01, 1.38638623e-01, 5.69036350e-04, ...,\n        0.00000000e+00, 0.00000000e+00, 0.00000000e+00],\n...\n       [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,\n        5.71582129e-04, 1.38638623e-01, 7.21582136e-01]]) = <bound method spmatrix.toarray of <1500x1500 sparse matrix of type '<class 'numpy.float64'>'\n	with 7494 stored elements (5 diagonals) in DIAgonal format>>()
E        +      where <bound method spmatrix.toarray of <1500x1500 sparse matrix of type '<class 'numpy.float64'>'\n	with 7494 stored elements (5 diagonals) in DIAgonal format>> = <1500x1500 sparse matrix of type '<class 'numpy.float64'>'\n	with 7494 stored elements (5 diagonals) in DIAgonal format>.toarray

I have temporarily marked this test with pytest.mark.xfail so that other tests are not impeded.

@weaverba137
Copy link
Member Author

Fixed in #132.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant