diff --git a/src/ess/isissans/data.py b/src/ess/isissans/data.py index 589552ea..8a6f5020 100644 --- a/src/ess/isissans/data.py +++ b/src/ess/isissans/data.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2024 Scipp contributors (https://github.com/scipp) -from ess.sans.data import Registry +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) +from ess.reduce.data import Registry from ess.sans.types import ( BackgroundRun, DirectBeamFilename, diff --git a/src/ess/loki/data.py b/src/ess/loki/data.py index c0a6dc69..9cda0742 100644 --- a/src/ess/loki/data.py +++ b/src/ess/loki/data.py @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) +# Copyright (c) 2025 Scipp contributors (https://github.com/scipp) from pathlib import Path -from ess.sans.data import Registry +from ess.reduce.data import Registry from ess.sans.types import ( BackgroundRun, DirectBeamFilename, @@ -152,7 +152,7 @@ def loki_tutorial_mask_filenames() -> list[PixelMaskFilename]: def loki_tutorial_poly_gauss_I0() -> Path: """Analytical model for the I(Q) of the Poly-Gauss sample.""" - return Path(_registry.get_path('PolyGauss_I0-50_Rg-60.h5')) + return _registry.get_path('PolyGauss_I0-50_Rg-60.h5') def loki_tutorial_direct_beam_all_pixels() -> DirectBeamFilename: diff --git a/src/ess/sans/data.py b/src/ess/sans/data.py deleted file mode 100644 index 4e1f5201..00000000 --- a/src/ess/sans/data.py +++ /dev/null @@ -1,44 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) - - -class Registry: - def __init__( - self, - instrument: str, - files: dict[str, str], - version: str, - retry_if_failed: int = 3, - ): - import pooch - - self._registry = pooch.create( - path=pooch.os_cache(f'ess/{instrument}'), - env=f'ESS_{instrument.upper()}_DATA_DIR', - base_url=f'https://public.esss.dk/groups/scipp/ess/{instrument}/' - + '{version}/', - version=version, - retry_if_failed=retry_if_failed, - registry=files, - ) - - def __contains__(self, key): - return key in self._registry.registry - - def get_path(self, name: str, unzip: bool = False) -> str: - """ - Get the path to a file in the registry. - - Parameters - ---------- - name: - Name of the file to get the path for. - unzip: - If `True`, unzip the file before returning the path. - """ - import pooch - - return self._registry.fetch(name, processor=pooch.Unzip() if unzip else None) - - -__all__ = ['Registry']