Skip to content

Commit

Permalink
Make test more complex to try to understand failure
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Sep 20, 2024
1 parent 5477a28 commit 8c68c3a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/test_soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from tests.helper import requires

from swiftsimio import load, mask
import unyt


@requires("soap_example.hdf5")
Expand Down Expand Up @@ -42,11 +43,24 @@ def test_soap_can_mask_non_spatial(filename):
def test_soap_can_mask_spatial_and_non_spatial_actually_use(filename):
this_mask = mask(filename, spatial_only=False)

this_mask.constrain_mask("spherical_overdensity_200_mean", "total_mass", 1e5, 1e9)
lower = unyt.unyt_quantity(1e5, "Msun")
upper = unyt.unyt_quantity(1e13, "Msun")
this_mask.constrain_mask("spherical_overdensity_200_mean", "total_mass", lower, upper)

data = load(filename, mask=this_mask)

data.spherical_overdensity_200_mean.total_mass[0]
masses = data.spherical_overdensity_200_mean.total_mass

assert len(masses) > 0

data2 = load(filename)

masses2 = data2.spherical_overdensity_200_mean.total_mass

# Manually mask
custom_mask = (masses2 >= lower) & (masses2 <= upper)

assert len(masses2[custom_mask]) == len(masses)


@requires("soap_example.hdf5")
Expand Down

0 comments on commit 8c68c3a

Please sign in to comment.