From a282b1f146b5c6619ac041b999ef3bdedb543348 Mon Sep 17 00:00:00 2001 From: Ryuichi Arafune Date: Mon, 11 Mar 2024 08:42:52 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20=20x,=20y,=20z=20is=20ensure=20c?= =?UTF-8?q?oords?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/arpes/xarray_extensions.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/arpes/xarray_extensions.py b/src/arpes/xarray_extensions.py index 96303fe6..73864930 100644 --- a/src/arpes/xarray_extensions.py +++ b/src/arpes/xarray_extensions.py @@ -1314,20 +1314,11 @@ def spectrometer_settings(self) -> dict[str, Any]: @property def sample_pos(self) -> tuple[float, float, float]: - x, y, z = None, None, None - with contextlib.suppress(KeyError): - x = self._obj.attrs["x"] - - with contextlib.suppress(KeyError): - y = self._obj.attrs["y"] - - with contextlib.suppress(KeyError): - z = self._obj.attrs["z"] - - def do_float(w: float | None) -> float: - return float(w) if w is not None else np.nan - - return (do_float(x), do_float(y), do_float(z)) + return ( + float(self._obj.attrs["x"]), + float(self._obj.attrs["y"]), + float(self._obj.attrs["z"]), + ) @property def sample_angles(