Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Clément Robert <cr52@protonmail.com>
  • Loading branch information
chrishavlin and neutrinoceros committed Nov 13, 2023
1 parent 0b87b8c commit c7b238d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions yt/utilities/linear_interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _validate_table(self, table_override):
if self.table is None:
msg = (
f"You must either store the table used when initializing a new "
f"{type(self).__name__} (set `store_table=True`) or you must provide a `table` when "
f"{type(self).__name__} (set `store_table=True`) or you provide a `table` when "
f"calling {type(self).__name__}"
)
raise ValueError(msg)
Expand All @@ -50,7 +50,7 @@ def _get_digitized_arrays(self, data_object):
dim_name = getattr(self, f"{dim}_name")
dim_bins = getattr(self, f"{dim}_bins")

dim_vals = data_object[dim_name].ravel().astype("float64")
dim_vals = data_object[dim_name].astype("float64").ravel()
dim_i = (np.digitize(dim_vals, dim_bins) - 1).astype(self._dim_i_type)
if np.any((dim_i == -1) | (dim_i == len(dim_bins) - 1)):
if not self.truncate:
Expand Down
6 changes: 3 additions & 3 deletions yt/utilities/tests/test_interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def test_get_vertex_centered_data():
}


@pytest.mark.parametrize("ndim", list(range(1, 5)))
@pytest.mark.parametrize("ndim", list(_lin_interpolators_by_dim.keys()))
def test_table_override(ndim):
sz = 8

Expand All @@ -189,7 +189,7 @@ def test_table_override(ndim):
with pytest.raises(
ValueError, match="You must either store the table used when initializing"
):
_ = interpolator(fv)
interpolator(fv)


@pytest.mark.parametrize("ndim", list(range(1, 5)))
Expand All @@ -212,4 +212,4 @@ def test_bin_validation(ndim):
bounds = tuple(bounds)

with pytest.raises(ValueError, match=f"{field_names[0]} bins array not"):
_ = interp_class(random_data, bounds, field_names)
interp_class(random_data, bounds, field_names)

0 comments on commit c7b238d

Please sign in to comment.