From c7b238db7be7c969b15e3267a30cb459a328626f Mon Sep 17 00:00:00 2001 From: Chris Havlin Date: Mon, 13 Nov 2023 09:31:49 -0600 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Robert --- yt/utilities/linear_interpolators.py | 4 ++-- yt/utilities/tests/test_interpolators.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/yt/utilities/linear_interpolators.py b/yt/utilities/linear_interpolators.py index 2b77ae873bf..7f741a06877 100644 --- a/yt/utilities/linear_interpolators.py +++ b/yt/utilities/linear_interpolators.py @@ -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) @@ -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: diff --git a/yt/utilities/tests/test_interpolators.py b/yt/utilities/tests/test_interpolators.py index 1b726b34709..b35a31507df 100644 --- a/yt/utilities/tests/test_interpolators.py +++ b/yt/utilities/tests/test_interpolators.py @@ -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 @@ -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))) @@ -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)