Skip to content

Commit

Permalink
Preliminary unfinished test for fill values with LDOs
Browse files Browse the repository at this point in the history
  • Loading branch information
e-koch committed Sep 2, 2020
1 parent 6e0e91c commit 920df34
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spectral_cube/tests/test_projection.py
Expand Up @@ -790,3 +790,26 @@ def test_spatial_world(view, data_adv, use_dask):
for result, expected in zip(w2_flat, world):
print(result.shape, expected.flatten().shape)
assert_allclose(result, expected.flatten())


def test_LDO_fill_value():
new_quant = twelve_qty_2d.copy()

new_quant[0, :] = np.NaN

proj = Projection(new_quant)

proj_fill0 = proj.with_fill_value(0.)

assert (np.isfinite(new_quant) == np.isfinite(proj)).all()

# Try using the filled data.
assert proj_fill0.fill_value == 0.0

assert np.isfinite(proj._get_filled_data(fill=0.)).all()

assert np.isfinite(proj_fill0.filled_data[:]).all()
assert np.isfinite(proj_fill0.unitless_filled_data[:]).all()

assert np.isfinite(proj_fill0.quantity).all()
assert np.isfinite(proj_fill0.value).all()

0 comments on commit 920df34

Please sign in to comment.