Skip to content

Commit aadecdc

Browse files
committed
Return Path from get_path
1 parent 6826faf commit aadecdc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/ess/reduce/data.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# SPDX-License-Identifier: BSD-3-Clause
2-
# Copyright (c) 2024 Scipp contributors (https://github.com/scipp)
2+
# Copyright (c) 2025 Scipp contributors (https://github.com/scipp)
3+
4+
from pathlib import Path
35

46

57
class Registry:
@@ -29,7 +31,7 @@ def __contains__(self, key: str) -> bool:
2931
"""Return True if the key is in the registry."""
3032
return key in self._registry.registry
3133

32-
def get_path(self, name: str, unzip: bool = False) -> str:
34+
def get_path(self, name: str, unzip: bool = False) -> Path:
3335
"""
3436
Get the path to a file in the registry.
3537
@@ -45,8 +47,10 @@ def get_path(self, name: str, unzip: bool = False) -> str:
4547
:
4648
The Path to the file.
4749
"""
48-
return self._registry.fetch(
49-
name, processor=self._unzip_processor if unzip else None
50+
return Path(
51+
self._registry.fetch(
52+
name, processor=self._unzip_processor if unzip else None
53+
)
5054
)
5155

5256

@@ -94,37 +98,37 @@ def get_path(self, name: str, unzip: bool = False) -> str:
9498
)
9599

96100

97-
def bifrost_simulated_elastic() -> str:
101+
def bifrost_simulated_elastic() -> Path:
98102
"""McStas simulation with elastic incoherent scattering + phonon."""
99103
return _bifrost_registry.get_path('BIFROST_20240914T053723.h5')
100104

101105

102-
def loki_tutorial_sample_run_60250() -> str:
106+
def loki_tutorial_sample_run_60250() -> Path:
103107
"""Sample run with sample and sample holder/can, no transmission monitor in beam."""
104108
return _loki_registry.get_path('60250-2022-02-28_2215.nxs')
105109

106110

107-
def loki_tutorial_sample_run_60339() -> str:
111+
def loki_tutorial_sample_run_60339() -> Path:
108112
"""Sample run with sample and sample holder/can, no transmission monitor in beam."""
109113
return _loki_registry.get_path('60339-2022-02-28_2215.nxs')
110114

111115

112-
def loki_tutorial_background_run_60248() -> str:
116+
def loki_tutorial_background_run_60248() -> Path:
113117
"""Background run with sample holder/can only, no transmission monitor."""
114118
return _loki_registry.get_path('60248-2022-02-28_2215.nxs')
115119

116120

117-
def loki_tutorial_background_run_60393() -> str:
121+
def loki_tutorial_background_run_60393() -> Path:
118122
"""Background run with sample holder/can only, no transmission monitor."""
119123
return _loki_registry.get_path('60393-2022-02-28_2215.nxs')
120124

121125

122-
def loki_tutorial_sample_transmission_run() -> str:
126+
def loki_tutorial_sample_transmission_run() -> Path:
123127
"""Sample transmission run (sample + sample holder/can + transmission monitor)."""
124128
return _loki_registry.get_path('60394-2022-02-28_2215.nxs')
125129

126130

127-
def dream_coda_test_file() -> str:
131+
def dream_coda_test_file() -> Path:
128132
"""CODA file for DREAM where most pulses have been removed.
129133
130134
See ``tools/shrink_nexus.py``.

0 commit comments

Comments
 (0)