Skip to content

Commit

Permalink
use ds.sizes insted of ds.dims
Browse files Browse the repository at this point in the history
  • Loading branch information
niksirbi committed Sep 3, 2024
1 parent f47d6e7 commit 7b019a2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_unit/test_filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def test_interpolate_over_time_on_position(

# The number of NaNs after interpolating should be as expected
assert n_nans_after == (
valid_dataset_in_frames.dims["space"]
* valid_dataset_in_frames.dims.get("keypoints", 1)
valid_dataset_in_frames.sizes["space"]
* valid_dataset_in_frames.sizes.get("keypoints", 1)
# in bboxes dataset there is no keypoints dimension
* expected_n_nans_in_position
)
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_filter_by_confidence_on_position(
# the number of low confidence keypoints by the number of
# space dimensions
assert isinstance(position_filtered, xr.DataArray)
assert n_nans == valid_input_dataset.dims["space"] * n_low_confidence_kpts
assert n_nans == valid_input_dataset.sizes["space"] * n_low_confidence_kpts


@pytest.mark.parametrize(
Expand Down Expand Up @@ -198,15 +198,15 @@ def _assert_n_nans_in_position_per_individual(
# compute n nans in position after filtering per individual
n_nans_after_filtering_per_indiv = {
i: helpers.count_nans(position_filtered.isel(individuals=i))
for i in range(valid_input_dataset.dims["individuals"])
for i in range(valid_input_dataset.sizes["individuals"])
}

# check number of nans per indiv is as expected
for i in range(valid_input_dataset.dims["individuals"]):
for i in range(valid_input_dataset.sizes["individuals"]):
assert n_nans_after_filtering_per_indiv[i] == (
expected_nans_in_filt_position_per_indiv[i]
* valid_input_dataset.dims["space"]
* valid_input_dataset.dims.get("keypoints", 1)
* valid_input_dataset.sizes["space"]
* valid_input_dataset.sizes.get("keypoints", 1)
)

# Filter position
Expand Down

0 comments on commit 7b019a2

Please sign in to comment.