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

Update deprecated numpy calls #113

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions astrocut/tests/test_make_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ def test_make_cube(tmpdir):
ecube[:, :, i, 0] = -plane
ecube[:, :, i, 1] = plane
plane += img_sz*img_sz
assert np.alltrue(cube == ecube), "Cube values do not match expected values"
assert np.all(cube == ecube), "Cube values do not match expected values"

tab = Table(hdu[2].data)
assert np.alltrue(tab['TSTART'] == np.arange(num_im)), "TSTART mismatch in table"
assert np.alltrue(tab['TSTOP'] == np.arange(num_im)+1), "TSTOP mismatch in table"
assert np.all(tab['TSTART'] == np.arange(num_im)), "TSTART mismatch in table"
assert np.all(tab['TSTOP'] == np.arange(num_im)+1), "TSTOP mismatch in table"

filenames = np.array([path.split(x)[1] for x in ffi_files])
assert np.alltrue(tab['FFI_FILE'] == np.array(filenames)), "FFI_FILE mismatch in table"
assert np.all(tab['FFI_FILE'] == np.array(filenames)), "FFI_FILE mismatch in table"

hdu.close()

Expand Down Expand Up @@ -86,7 +86,7 @@ def test_make_and_update_cube(tmpdir):
# ecube[:, :, i, 1] = plane
plane += img_sz*img_sz

assert np.alltrue(cube == ecube), "Cube values do not match expected values"
assert np.all(cube == ecube), "Cube values do not match expected values"

hdu.close()

Expand All @@ -110,14 +110,14 @@ def test_make_and_update_cube(tmpdir):
# ecube[:, :, i, 1] = plane
plane += img_sz*img_sz

assert np.alltrue(cube == ecube), "Cube values do not match expected values"
assert np.all(cube == ecube), "Cube values do not match expected values"

tab = Table(hdu[2].data)
assert np.alltrue(tab['STARTTJD'] == np.arange(num_im)), "STARTTJD mismatch in table"
assert np.alltrue(tab['ENDTJD'] == np.arange(num_im)+1), "ENDTJD mismatch in table"
assert np.all(tab['STARTTJD'] == np.arange(num_im)), "STARTTJD mismatch in table"
assert np.all(tab['ENDTJD'] == np.arange(num_im)+1), "ENDTJD mismatch in table"

filenames = np.array([path.split(x)[1] for x in ffi_files])
assert np.alltrue(tab['FFI_FILE'] == np.array(filenames)), "FFI_FILE mismatch in table"
assert np.all(tab['FFI_FILE'] == np.array(filenames)), "FFI_FILE mismatch in table"

hdu.close()

Expand Down Expand Up @@ -156,7 +156,7 @@ def test_iteration(tmpdir, capsys):
cube_2 = hdu_2[1].data

assert cube_1.shape == cube_2.shape, "Mismatch between cube shape for 1 vs 2 iterations"
assert np.alltrue(cube_1 == cube_2), "Cubes made in 1 vs 2 iterations do not match"
assert np.all(cube_1 == cube_2), "Cubes made in 1 vs 2 iterations do not match"

# expected values for cube
ecube = np.zeros((img_sz, img_sz, num_im, 2))
Expand All @@ -168,7 +168,7 @@ def test_iteration(tmpdir, capsys):
ecube[:, :, i, 1] = plane
plane += img_sz*img_sz

assert np.alltrue(cube_1 == ecube), "Cube values do not match expected values"
assert np.all(cube_1 == ecube), "Cube values do not match expected values"


@pytest.mark.parametrize("ffi_type", ["TICA", "SPOC"])
Expand Down